kimoa / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
3 stars 0 forks source link

New event when element inserted #785

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I find it very useful, especially for plugins, to have an event when a new 
element is created.

I have attached a patch that fires the event "elementCreated" when a new shape 
is inserted.

Original issue reported on code.google.com by niels.sa...@gmail.com on 16 Feb 2011 at 8:46

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for the patch and idea.  Unfortunately I think there are a couple 
questions that need to be addressed by this:

1) when should the event be fired?  When the user first starts drawing the 
shape or when they've finished drawing it and moused up?  Currently your patch 
would fire upon mouseDown() which is when addSvgElementFromJson() is called

2) if mouseDown is ok, then what about for freehand drawing modes (in this 
mode, users start drawing a path, but when the mouseUp, they get an ellipse, 
rect, etc).  In this case you'd get two fired events, one upon mouseDown and 
one upon mouseUp, which would be confusing.

3) are there any other times that addSvgElementFromJson() which we would not 
want to fire the created event?

Original comment by codedr...@gmail.com on 16 Feb 2011 at 4:50