chenbo007 / svg-edit

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

Add polyline/polygon mode (Path Editing Phase 1) #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A first step to Bézier curves would be to add support for polylines at
first. I believe the easiest way would be to add new points to path on each
click. This would become "add points mode".

The next step could be "move points mode" - drag nearest point of the
selected path or maybe little circles could be drawn in some working layer
- not saved during save, and hidden or removed after changing tools or modes.

Then I think there should be some "edit points mode" - at first this could
simple make corners switch from sharp corners, to round corners.
Eventually, there should be some kind of edit mode for Bézier points (I
mean points that control the curve).

Original issue reported on code.google.com by e...@wp.pl on 22 Jun 2009 at 7:33

GoogleCodeExporter commented 9 years ago

Original comment by narendra.sisodiya on 22 Jun 2009 at 9:42

GoogleCodeExporter commented 9 years ago

Original comment by narendra.sisodiya on 22 Jun 2009 at 9:42

GoogleCodeExporter commented 9 years ago
Changing this to high priority.  Obviously to be a true vector editor we need 
actual
path editing (curve/line segments) and not just sketching.  I would put this at 
the
top of the list for 2.3

Original comment by codedr...@gmail.com on 27 Jun 2009 at 3:47

GoogleCodeExporter commented 9 years ago

Original comment by codedr...@gmail.com on 8 Jul 2009 at 1:14

GoogleCodeExporter commented 9 years ago
I agree with the poster's suggestion here:

- first a polyline tool and mode that creates a path of line segments
- from a UI perspective, if you click a path it will select it (as today), if 
you
click a selected path AGAIN, then it will enter "path edit" mode, clicking a 
third
time will toggle back to "select" mode
- we should name paths drawn with the pencil tool as id="fhX", etc - then the 
editor
can distinguish between a freehand path and an editable path (similarly, a rect
created with a Square tool would be id="sqY"

Original comment by codedr...@gmail.com on 8 Jul 2009 at 10:17

GoogleCodeExporter commented 9 years ago
Thinking about it a bit, I think we need to break Full Path Editing mode into 
smaller
steps.  This bug will track Phase 1:  Polygon/Polyline Mode.

This mode will allow an artist to create a polygon or polyline by clicking a 
series
of points on the canvas.  Such an entity will be referred to as "poly" in this 
spec,
though it will be implemented as a simple <path> element in the canvas.  
Artists will
be able to close the poly or keep the poly open.  Artists will be able to drag 
the
points of a poly around after it has been created.

Requirements:

1) New button in main toolbar: Poly

2) new mode in canvas: "poly", canvas remembers all points created while in 
poly mode

3) in poly mode, mousedown has no effect

4) in poly mode, mousemove: if a previous point exists, draw a line from the 
previous
point to the current point (this line is temporary and is removed upon next 
mousemove
or mouseup)

5) in poly mode, if mouseup and the poly has not been created, create the <path>
element with a "polyXXX" id.  upon mouseup if it is not overtop an existing 
point in
this poly, the canvas creates and stores a new point at the current point.  if
mouseup occurs over the first point created, then close the poly and exit "poly"
creation mode.  if mouseup occurs over any other point created, then exit "poly"
creation mode and leave the poly opened.

6) if a poly is selected or multi-selected, show the bounding box as normal.  
if a
poly is clicked on and it is already singly-selected, then remove resize grips 
from
bounding box and add in a grip for every point in the poly.  Parse all points 
from
the currently selected poly into memory, go into poly_edit mode.

7) if in poly_edit mode and the poly stroke or fill (but not a grip) is 
clicked, go
back to selected mode for that poly

7) if mousedown while in poly_edit mode, determine which point that we're 
dragging

8) if mousemove while in poly_edit mode, move the point and update the poly 
element

9) if mouseup while dragging a point in poly_edit mode clear the point that 
we're
dragging

Note that there is no way to add or remove points from a poly in this phase of 
the
feature.  That's already a lot to implement so we'll save subsequent 
enhancements for
later phases.

Original comment by codedr...@gmail.com on 9 Jul 2009 at 8:41

GoogleCodeExporter commented 9 years ago
Replace 5) above with this:

5) in poly mode, if mouseup and the poly has not been created, create the <path>
element with a "polyXXX" id.  upon mouseup if it is not overtop an existing 
point in
this poly, the canvas creates and stores a new point at the current point.  if
mouseup occurs over the first point created and at least two points have been
created, then close the poly and exit "poly" creation mode.  if mouseup occurs 
over
any other point created, then exit "poly" creation mode and leave the poly 
opened.

Original comment by codedr...@gmail.com on 20 Jul 2009 at 6:57

GoogleCodeExporter commented 9 years ago
Requirements 1-5 have been implemented as of r359.  It is now possible to
draw/move/resize a polygon/polyline.  

It is not possible to edit the individual points on the polygon yet.

Original comment by codedr...@gmail.com on 7 Aug 2009 at 5:45

GoogleCodeExporter commented 9 years ago
By the way, I've decided not to distinguish between freehand sketch paths and 
poly
paths.  This means it will be possible to tweak the points of a freehand 
scribble as
well as a path.  Unfortunately freehand sketch paths have a lot of points so 
I'll
have to be careful about that.

Original comment by codedr...@gmail.com on 7 Aug 2009 at 5:49

GoogleCodeExporter commented 9 years ago
Reqts 6) and 7) implemented as of r366

Original comment by codedr...@gmail.com on 8 Aug 2009 at 2:03

GoogleCodeExporter commented 9 years ago
Reqts 8 and 9) implemented and issue closed as of r368

Original comment by codedr...@gmail.com on 8 Aug 2009 at 10:18