So I've got a canvas that's drawing lines and listening for mouse clicks, and I'm working thru the details of some state transitions.
A click stores a point. If there's a previous point, those two are grouped together, essentially. The details there are not important. Mouse movement "carries" the endpoint of the unfinished line segment as well, so you can see how you're stretching the line.
Now I want to turn "off" the recording of points. Unfortunately, I don't think I can listen for both clicks and double-clicks, so I can't use the double-click (I bet I can, but I just don't know how to unsort the two events properly).
So, if the mouse clicks on, say, the toolbar instead of the canvas, then I'll stop recording. If there's a partial segment at the end of the list, I'll delete it.
To add to the fun, I've also got quadratic Bézier curves, which as you may know has an additional control point in addition to the start and endpoints. In curve mode, you're not just drawing lines on a polygon. Still, possibly the best way to roughly lay out a hull shape is to let curves be 'flat' or defaulted, and let the user later drag the control points around as needed.
A click stores a point. If there's a previous point, those two are grouped together, essentially. The details there are not important. Mouse movement "carries" the endpoint of the unfinished line segment as well, so you can see how you're stretching the line.
Now I want to turn "off" the recording of points. Unfortunately, I don't think I can listen for both clicks and double-clicks, so I can't use the double-click (I bet I can, but I just don't know how to unsort the two events properly).
So, if the mouse clicks on, say, the toolbar instead of the canvas, then I'll stop recording. If there's a partial segment at the end of the list, I'll delete it.
To add to the fun, I've also got quadratic Bézier curves, which as you may know has an additional control point in addition to the start and endpoints. In curve mode, you're not just drawing lines on a polygon. Still, possibly the best way to roughly lay out a hull shape is to let curves be 'flat' or defaulted, and let the user later drag the control points around as needed.