freegroup / draw2d

Create Visio like drawings, diagrams or workflows with JavaScript and HTML5
https://freegroup.github.io/draw2d/#/examples
MIT License
738 stars 227 forks source link

extends function not set with jason reader #208

Open hbagheri opened 2 years ago

hbagheri commented 2 years ago

Thank you for your grate Library

i've added draw2d.Connection.extend to show a right click menu for connections It works properly while create a new connection but not works if the connection was loaded from a saved JSON. would you please help me to solve my problem

freegroup commented 2 years ago

if your read/write JSON from your drawd2d diagram, it is important that all elements has the attribute NAME. This attribute is use late to create JS object instances. https://github.com/freegroup/draw2d/blob/master/examples/connection_with_contextmenu/MyConnection.js#L12

If this attribute exists, the constructor of your Connection class is correct called and the coding for the cotext menue is executed.

https://freegroup.github.io/draw2d/#/examples/connection_with_contextmenu