From 9f04c22aa0834a46809c25bab92774b80d135b85 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 1 Mar 2024 20:05:45 +0100 Subject: [PATCH] UI cleanups related to polygon point dragging. Prepare for polygon add/delete points --- src/callback.c | 10 +++++++--- src/move.c | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/callback.c b/src/callback.c index 66259476..7dfefca9 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1368,7 +1368,7 @@ int rstate; /* (reduced state, without ShiftMask) */ } /* Unselect by area */ if((state & Button1Mask) && (SET_MODMASK) && !(state & ShiftMask) && - !(xctx->ui_state & STARTPAN) && + !(xctx->ui_state & STARTPAN) && !xctx->poly_point_selected && !(xctx->ui_state & (PLACE_SYMBOL | PLACE_TEXT))) { /* unselect area */ if( !(xctx->ui_state & STARTSELECT)) { select_rect(START,0); @@ -1376,7 +1376,7 @@ int rstate; /* (reduced state, without ShiftMask) */ } /* Select by area. Shift pressed */ else if((state&Button1Mask) && (state & ShiftMask) && - !(xctx->ui_state & (PLACE_SYMBOL | PLACE_TEXT)) && + !(xctx->ui_state & (PLACE_SYMBOL | PLACE_TEXT)) && !xctx->poly_point_selected && !(xctx->ui_state & STARTPAN) ) { if(mx != xctx->mx_save || my != xctx->my_save) { if( !(xctx->ui_state & STARTSELECT)) { @@ -3148,6 +3148,7 @@ int rstate; /* (reduced state, without ShiftMask) */ polygon_n = xctx->sel_array[0].n; polygon_c = xctx->sel_array[0].col; } + /* If no shift was pressed while Button1Press delete selection */ if( !(state & ShiftMask) && !(SET_MODMASK) ) { unselect_all(1); } @@ -3161,6 +3162,10 @@ int rstate; /* (reduced state, without ShiftMask) */ POINTINSIDE(xctx->mousex, xctx->mousey, p->x[i] - ds, p->y[i] - ds, p->x[i] + ds, p->y[i] + ds) ) { + + if( (state & ShiftMask) && !(SET_MODMASK) ) { + unselect_all(1); + } dbg(1, "selecting point %d\n", i); xctx->poly[polygon_c][polygon_n].selected_point[i] = 1; xctx->poly_point_selected = 1; @@ -3168,7 +3173,6 @@ int rstate; /* (reduced state, without ShiftMask) */ } } if(xctx->poly_point_selected) { - /* select_polygon(polygon_c, polygon_n, SELECTED1,1); */ xctx->poly[polygon_c][polygon_n].sel = SELECTED1; xctx->need_reb_sel_arr=1; move_objects(START,0,0,0); diff --git a/src/move.c b/src/move.c index ba9fa8c9..b210bc75 100644 --- a/src/move.c +++ b/src/move.c @@ -904,6 +904,7 @@ void move_objects(int what, int merge, double dx, double dy) } if(what & RUBBER) /* abort operation */ { + xctx->x2=xctx->mousex_snap;xctx->y_2=xctx->mousey_snap; draw_selection(xctx->gctiled,0); xctx->deltax = xctx->x2-xctx->x1; xctx->deltay = xctx->y_2 - xctx->y_1; @@ -1268,7 +1269,7 @@ void move_objects(int what, int merge, double dx, double dy) set_modify(1); /* must be done before draw() if floaters are present to force cached values update */ draw(); xctx->rotatelocal=0; - } + } /* what & end */ draw_selection(xctx->gc[SELLAYER], 0); if(tclgetboolvar("draw_crosshair")) draw_crosshair(0); }