Skip to content

Improve the way custom shapes are instantiated #258

@ghost

Description

Currently the only way to use custom graphics is to customize a graphics class and inherit the mojs.CustomShape class, and then add it to mojs using the mojs.addShape() method. Then you can set and use custom graphics in the shape attribute.

One disadvantage of this method is that the added custom graphics class is global, and sometimes the added custom graphics will only be used in a certain module. My feeling is'this pollutes the global attributes'. For example, I want to use custom graphics menu and close in the Menu component. But in other components, I don't want to use the two custom graphics menu and close.

So one way I recommend is to support the use of the class type attribute value for the shape attribute. e.g. new mojs.Shape({ shape: MyCustomShapeClass })

Of course, my thinking is not complete, because I don't know much about the source code of mojs, and there is a better way that would be better. Hope Add support for modular use of custom graphics

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurefeature request to implement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions