vasend / jsvectoreditor

Automatically exported from code.google.com/p/jsvectoreditor
0 stars 0 forks source link

Make the shape selected after drawing #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Draw the shape.

What is the expected output? What do you see instead?
It's much more convenient to have the shape auto-selected (and the tool 
changed to 'pointer') after drawing. What for?
To make the new shape configurable through properties (fill, stroke), to 
allow dragging it instantly after creation.

Original issue reported on code.google.com by emiro...@gmail.com on 30 Dec 2009 at 2:03

GoogleCodeExporter commented 9 years ago
Well, this is something more specific to a certain application, but the code is 
simple, 
just add:
{{{

editor.on("addedshape",function(shape){
//change interface here to select tool
editor.setMode("select");
editor.select(shape)
})

}}}

Original comment by Antimatter15 on 30 Dec 2009 at 5:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for the comment. I'll give it a try tonight.

Original comment by emiro...@gmail.com on 3 Jan 2010 at 4:34

GoogleCodeExporter commented 9 years ago
This doesn't work.
The event is fired when the shape is created, the mode is changed and future 
mouse 
moves do not scale/draw the shape.
The mouseup event doesn't look appropriate too as it's fired before the main 
processing.
Generally, I think that the events should be fired after they are tracked by 
the main 
code. Or two events (beforemousemove and mousemove, for example) can be used, 
and if 
some of the before- event listeners return false, the main processing should 
abort.

Original comment by emiro...@gmail.com on 5 Jan 2010 at 11:28

GoogleCodeExporter commented 9 years ago
not working for me as well following code just enabled select mode as 
addedshape called before drawing any object please provide the solution for this

editor.on("addedshape", function(event, shape, no_select){

  editor.setMode("select");
  editor.select(shape); 

});

Original comment by ng...@intellobuild.com on 26 Apr 2014 at 11:23