Re: [Tuxpaint-devel] Polygon fill messing with other tools drawing
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
From: Bill K. <nb...@so...> - 2024-06-01 08:48:44
|
On Wed, May 29, 2024 at 10:06:07AM +0200, Pere Pujal i Carabantes wrote: > Hi Bill, and all, > > A problem, start drawing a polygon and do as many points as possible (17?) > then you are blocked, you can either switch out of the tool or drag the > latest point to the origin closing the polygon, which is not very intuitive. > Assuming the only thing you can do in the tool is to close the polygon, > I suggest to do this automatically. I think we can raise the number of points. In the meantime, I updated it so that clicking again will simply move the end point (rather than silently and confusingly doing _nothing_). > Then there is the interaction with the Undo tool: draw say 5 points and go > to another tool without closing the polygon, the helper lines and points > disappear (by design?), hit Undo and they reappear, > I'd suggest to either keep them in the drawing or erase them from the undo stack. Okay, I've made an attempt to prevent the previews from landing in the undo history. This is via a new Magic API function that magic tools may call: api->retract_undo(). It basically just rolls back `cur_undo` and `newest_undo` by one, so whatever was just snapped (during a mousedown event, just prior to the Magic tool's `_click()` from being called) gets "forgotten". So for example, I can click a bunch of times to make a new polygon, and when I hit Undo, it goes back to the canvas as it appeared before I added the very first point. And when I hit Redo, the entire polygon reappears in its final (non-preview) form. HOPEFULLY this works well. It's almost 2am, and I was tired many hours _before_ I tried tackling this. :-D Before I go to bed I'm going to add info about this to the API docs. Hopefully in the next few days I can see about utilizing this with other Magic tools that offer "previews" that live beyond the (1) click, (2) drag, (3) release lifespan (e.g., Clone, and the Perspective drawing tools)... so they will stop "corrupting" the Undo history with their outline and crosshair nonsense. ;-) This is quite a hack, I admit, so wish me luck! And PLEASE TEST! Bang on it as much as you can, and report back! Thanks, PS - I also updated the description to mention that points may be merged. (Sorry to translators for asking for updated localizations, and then immediately going in and messing with strings :-[ ) PPS - The commit (so far) that adds this new functionality is: https://sourceforge.net/p/tuxpaint/tuxpaint/ci/01afb5846c2b9d7c58961d38b27cd597d367d766/ ("api->retract_undo() added to Magic API; used by Filled Polygon") -bill! |