From b0b3b6402261d812e0deaaab662000aad7cc4817 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Thu, 30 May 2024 23:50:00 -0700 Subject: [PATCH] Filled Polygon: Mention merging. Max pt handling. In instructions, mention that adjacent points may be merged. When no more space is available for additional points, simply move the last point to the new location (rather than silently doing nothing). h/t Pere for the ideas --- magic/src/polyfill.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/magic/src/polyfill.c b/magic/src/polyfill.c index 2a3a33960..7877db791 100644 --- a/magic/src/polyfill.c +++ b/magic/src/polyfill.c @@ -7,7 +7,7 @@ Scanline polygon fill routine based on public-domain code by Darel Rex Finley, 2007 - Last updated: May 28, 2024 + Last updated: May 30, 2024 */ @@ -31,7 +31,7 @@ char *polyfill_names[NUM_TOOLS] = { char *polyfill_descr[NUM_TOOLS] = { gettext_noop - ("Click multiple times in your picture to create a filled polygon. You may drag control points to alter the shape. Click the first point to complete the shape."), + ("Click multiple times in your picture to create a filled polygon. You may drag points to alter the shape. Drag adjacent points together to merge them. Connect the first and last points to complete the shape."), }; char *polyfill_icon_filenames[NUM_TOOLS] = { @@ -263,7 +263,14 @@ polyfill_click(magic_api * api, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_U } else { - /* Out of points! */ + /* Out of points! Move the last one to the new position */ + polyfill_pt_x[polyfill_num_pts - 1] = x; + polyfill_pt_y[polyfill_num_pts - 1] = y; + polyfill_editing = polyfill_num_pts - 1; + + polyfill_drag(api, which, canvas, snapshot, x, y, x, y, update_rect); + api->playsound(snd_effects[SND_PLACE], (x * 255) / canvas->w, 255); + #ifdef DEBUG printf("Out of space for new points!\n"); #endif