enhance drawing wires in intuitive_interface by dragging away from an instance pin or wire endpoint. Allow set manhattan/oblique direction as with w keybind

This commit is contained in:
stefan schippers 2025-01-19 13:59:18 +01:00
parent 17b09bc203
commit 2bd1c79cd5
1 changed files with 16 additions and 22 deletions

View File

@ -1576,6 +1576,7 @@ static int check_menu_start_commands(double c_snap)
static int add_wire_from_inst_pin(Selected *sel, double mx, double my)
{
int res = 0;
int prev_state = xctx->ui_state;
int i, type = sel->type;
double pinx0, piny0;
if(type == ELEMENT) {
@ -1589,19 +1590,13 @@ static int add_wire_from_inst_pin(Selected *sel, double mx, double my)
}
}
if(i < npin) {
int save = xctx->modified;
dbg(1, "pin: %g %g\n", pinx0, piny0);
unselect_all(1);
xctx->push_undo();
storeobject(-1, pinx0, piny0, pinx0, piny0, WIRE, 0, SELECTED1, NULL);
set_modify(save);
xctx->shape_point_selected = 1;
xctx->prep_hash_wires=0;
xctx->need_reb_sel_arr = 1;
xctx->kissing = 1;
rebuild_selected_array();
move_objects(START,0,0,0);
xctx->ui_state |= START_SYMPIN; /* avoid double push_undo() in move_objects() */
start_wire(xctx->mousex_snap, xctx->mousey_snap);
if(prev_state == STARTWIRE) {
tcleval("set constr_mv 0" );
xctx->constr_mv=0;
}
res = 1;
}
} else if(type == WIRE) {
@ -1611,18 +1606,12 @@ static int add_wire_from_inst_pin(Selected *sel, double mx, double my)
double x2 = xctx->wire[n].x2;
double y2 = xctx->wire[n].y2;
if( (mx == x1 && my == y1) || (mx == x2 && my == y2) ) {
int save = xctx->modified;
unselect_all(1);
xctx->push_undo();
storeobject(-1, mx, my, mx, my, WIRE, 0, SELECTED1, NULL);
set_modify(save);
xctx->shape_point_selected = 1;
xctx->prep_hash_wires=0;
xctx->need_reb_sel_arr = 1;
xctx->kissing = 1;
rebuild_selected_array();
move_objects(START,0,0,0);
xctx->ui_state |= START_SYMPIN; /* avoid double push_undo() in move_objects() */
start_wire(xctx->mousex_snap, xctx->mousey_snap);
if(prev_state == STARTWIRE) {
tcleval("set constr_mv 0" );
xctx->constr_mv=0;
}
res = 1;
}
}
@ -4180,6 +4169,11 @@ int rstate; /* (reduced state, without ShiftMask) */
xctx->semaphore = savesem;
}
/* end wire creation when dragging in intuitive interface from an inst pin ow wire endpoint */
else if(xctx->intuitive_interface && (xctx->ui_state & STARTWIRE)) {
if(end_place_move_copy_zoom()) break;
}
/* end intuitive_interface copy or move */
if(xctx->ui_state & STARTCOPY && xctx->drag_elements) {
copy_objects(END);