fix regression: constrained move (V/H) when creating polygons

This commit is contained in:
stefan schippers 2025-04-03 01:54:21 +02:00
parent cd0a78d9ff
commit 320aa96f98
2 changed files with 14 additions and 14 deletions

View File

@ -3415,10 +3415,10 @@ void new_polygon(int what, double mousex_snap, double mousey_snap)
}
if( what & ADD)
{
if(xctx->mousex_snap < xctx->nl_x1) xctx->nl_x1 = xctx->mousex_snap;
if(xctx->mousex_snap > xctx->nl_x2) xctx->nl_x2 = xctx->mousex_snap;
if(xctx->mousey_snap < xctx->nl_y1) xctx->nl_y1 = xctx->mousey_snap;
if(xctx->mousey_snap > xctx->nl_y2) xctx->nl_y2 = xctx->mousey_snap;
if(mousex_snap < xctx->nl_x1) xctx->nl_x1 = mousex_snap;
if(mousex_snap > xctx->nl_x2) xctx->nl_x2 = mousex_snap;
if(mousey_snap < xctx->nl_y1) xctx->nl_y1 = mousey_snap;
if(mousey_snap > xctx->nl_y2) xctx->nl_y2 = mousey_snap;
/* closed poly */
if(what & END) {
/* delete last rubber */
@ -3428,8 +3428,8 @@ void new_polygon(int what, double mousex_snap, double mousey_snap)
/* add point */
} else if(xctx->nl_polyx[xctx->nl_points] != xctx->nl_polyx[xctx->nl_points-1] ||
xctx->nl_polyy[xctx->nl_points] != xctx->nl_polyy[xctx->nl_points-1]) {
xctx->nl_polyx[xctx->nl_points] = xctx->mousex_snap;
xctx->nl_polyy[xctx->nl_points] = xctx->mousey_snap;
xctx->nl_polyx[xctx->nl_points] = mousex_snap;
xctx->nl_polyy[xctx->nl_points] = mousey_snap;
} else {
return;
}
@ -3456,16 +3456,16 @@ void new_polygon(int what, double mousex_snap, double mousey_snap)
}
if(what & RUBBER)
{
if(xctx->mousex_snap < xctx->nl_x1) xctx->nl_x1 = xctx->mousex_snap;
if(xctx->mousex_snap > xctx->nl_x2) xctx->nl_x2 = xctx->mousex_snap;
if(xctx->mousey_snap < xctx->nl_y1) xctx->nl_y1 = xctx->mousey_snap;
if(xctx->mousey_snap > xctx->nl_y2) xctx->nl_y2 = xctx->mousey_snap;
if(mousex_snap < xctx->nl_x1) xctx->nl_x1 = mousex_snap;
if(mousex_snap > xctx->nl_x2) xctx->nl_x2 = mousex_snap;
if(mousey_snap < xctx->nl_y1) xctx->nl_y1 = mousey_snap;
if(mousey_snap > xctx->nl_y2) xctx->nl_y2 = mousey_snap;
/* fprintf(errfp, "new_poly: RUBBER\n"); */
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1, 0);
xctx->nl_polyy[xctx->nl_points] = xctx->mousey_snap;
xctx->nl_polyx[xctx->nl_points] = xctx->mousex_snap;
xctx->nl_polyy[xctx->nl_points] = mousey_snap;
xctx->nl_polyx[xctx->nl_points] = mousex_snap;
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
/* xctx->nl_x2 = xctx->mousex_snap; xctx->nl_y2 = xctx->mousey_snap; */
/* xctx->nl_x2 = mousex_snap; xctx->nl_y2 = mousey_snap; */
drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1, 0);
}
}

View File

@ -2133,6 +2133,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(res, S(res), "color_ps=%d\n", color_ps); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "hilight_nets=%d\n", xctx->hilight_nets); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "semaphore=%d\n", xctx->semaphore); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "constr_mv=%d\n", xctx->constr_mv); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "ui_state=%d\n", xctx->ui_state); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "ui_state2=%d\n", xctx->ui_state2); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "drag_elements=%d\n", xctx->drag_elements); Tcl_AppendResult(interp, res, NULL);
@ -2244,7 +2245,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
/* help
* Print command help */
else if(!strcmp(argv[1], "help"))