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: Pere P. i C. <per...@gm...> - 2024-06-01 13:48:23
|
El ds. 01 de 06 de 2024 a les 01:48 -0700, en/na Bill Kendrick va escriure: > 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_). Better :) Could be improved if a click in the starting point closes the polygon, as it is now you have to click outside the starting point and drag into it, the following works for me. git diff diff --git a/magic/src/polyfill.c b/magic/src/polyfill.c index 25e4cc436..6f1d51bd6 100644 --- a/magic/src/polyfill.c +++ b/magic/src/polyfill.c @@ -401,7 +401,7 @@ polyfill_release(magic_api * api, int which ATTRIBUTE_UNUSED, /* If they simply clicked the first point (without drawing to move it), and there are enough points, consider it a final placement of a new point! */ - if (polyfill_editing == 0 && polyfill_dragged == 0 && polyfill_num_pts > 2 && polyfill_num_pts < MAX_PTS) + if (polyfill_editing == 0 && polyfill_dragged == 0 && polyfill_num_pts > 2 && polyfill_num_pts <= MAX_PTS) { #ifdef DEBUG printf("Clicked first point to end polygon!\n"); > > > 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! Works fine as far as I've tested :), the only improvement I could imagine is to use the first Undo just to clear the auxiliary stuff, withouth undoing previous work, other Undo acting as of now. Best Pere 2am, why this doesn't surprises me? XDD > > 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! > > > > _______________________________________________ > Tuxpaint-devel mailing list > Tux...@li... > https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel |