From ca6b8fe85b2b55c27a4e6e00b02ed0f42d7a57c4 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Thu, 16 Jan 2025 17:19:42 +0100 Subject: [PATCH] end_shape_point_edit(): fix erroneous set_modify because comparing unsmapped mouse saved coords with snapped actual mouse coords --- src/callback.c | 10 +++++++--- xschem_library/ngspice/solar_panel.sch | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/callback.c b/src/callback.c index b4697452..3b0e50ae 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1985,9 +1985,10 @@ static int handle_mouse_wheel(int event, int mx, int my, KeySym key, int button, return 0; } -static void end_shape_point_edit() +static void end_shape_point_edit(double c_snap) { int save = xctx->modified; + double sx, sy; dbg(1, "%g %g %g %g\n", xctx->mx_double_save, xctx->my_double_save, xctx->mousex_snap, xctx->mousey_snap); if(xctx->lastsel == 1 && xctx->sel_array[0].type==POLYGON) { @@ -2033,7 +2034,10 @@ static void end_shape_point_edit() xctx->shape_point_selected = 0; xctx->need_reb_sel_arr=1; } - if(xctx->mx_double_save == xctx->mousex_snap && xctx->my_double_save == xctx->mousey_snap) { + sx = my_round(xctx->mx_double_save / c_snap) * c_snap; + sy = my_round(xctx->my_double_save / c_snap) * c_snap; + + if(sx == xctx->mousex_snap && sy == xctx->mousey_snap) { set_modify(save); } } @@ -4106,7 +4110,7 @@ int rstate; /* (reduced state, without ShiftMask) */ /* if a polygon/bezier/rectangle control point was clicked, end point move operation * and set polygon state back to SELECTED from SELECTED1 */ else if((xctx->ui_state & (STARTMOVE | SELECTION)) && xctx->shape_point_selected) { - end_shape_point_edit(); + end_shape_point_edit(c_snap); } if(xctx->ui_state & STARTPAN) { diff --git a/xschem_library/ngspice/solar_panel.sch b/xschem_library/ngspice/solar_panel.sch index 8cd6c87a..046ef49c 100644 --- a/xschem_library/ngspice/solar_panel.sch +++ b/xschem_library/ngspice/solar_panel.sch @@ -295,7 +295,7 @@ lab=0} C {title.sym} 160 -40 0 0 {name=l1 author="Stefan Schippers"} C {code_shown.sym} 170 -310 0 0 {name=CONTROL value="tcleval( -.option savecurrents +.probe alli .control * example of tcl evaluation of code blocks: * current path: $path