intuitive interface, directly drag elements: default to wire stretch if enable_stretch is activated and normal move if using ctrl key and the other way around if enable_stretch is unset

This commit is contained in:
stefan schippers 2025-01-26 01:06:48 +01:00
parent 01989bba0c
commit 70156a3bda
2 changed files with 14 additions and 3 deletions

View File

@ -4026,25 +4026,31 @@ int rstate; /* (reduced state, without ShiftMask) */
waves_callback(event, mx, my, key, button, aux, state);
break;
}
/* terminate a schematic pan action */
if(xctx->ui_state & STARTPAN) {
xctx->ui_state &=~STARTPAN;
break;
}
/* select instance and connected nets stopping at wire junctions */
if(button == Button3 && state == ControlMask && xctx->semaphore <2)
{
Selected sel;
sel = select_object(xctx->mousex, xctx->mousey, SELECTED, 0, NULL);
if(sel.type) select_connected_nets(1);
}
/* break wire at mouse coordinates, move break point to nearest grid point */
else if(button == Button3 && EQUAL_MODMASK && !(state & ShiftMask) && xctx->semaphore <2)
{
break_wires_at_point(xctx->mousex_snap, xctx->mousey_snap, 1);
}
/* break wire at mouse coordinates */
else if(button == Button3 && EQUAL_MODMASK && (state & ShiftMask) && xctx->semaphore <2)
{
break_wires_at_point(xctx->mousex_snap, xctx->mousey_snap, 0);
}
/* select instance and connected nets NOT stopping at wire junctions */
else if(button == Button3 && state == ShiftMask && xctx->semaphore <2)
{
Selected sel;
@ -4057,6 +4063,8 @@ int rstate; /* (reduced state, without ShiftMask) */
* context_menu_action(xctx->mousex_snap, xctx->mousey_snap);
* }
*/
/* zoom rectangle by right clicking and drag */
else if(button == Button3 && state == 0 && xctx->semaphore < 2) {
zoom_rectangle(START);break;
}
@ -4109,6 +4117,7 @@ int rstate; /* (reduced state, without ShiftMask) */
}
/* handle all object insertions started from Tools/Edit menu */
if(check_menu_start_commands(c_snap)) break;
/* complete the STARTWIRE, STARTRECT, STARTZOOM, STARTCOPY ... operations */
if(end_place_move_copy_zoom()) break;
@ -4174,12 +4183,15 @@ int rstate; /* (reduced state, without ShiftMask) */
/* intuitive interface: directly drag elements */
if(sel.type && xctx->intuitive_interface && xctx->lastsel >= 1 &&
!xctx->shape_point_selected) {
/* xctx->push_undo(); */
int stretch = (state & ControlMask ? 1 : 0) ^ enable_stretch;
xctx->drag_elements = 1;
if( (state & ControlMask) && !(state & ShiftMask) && !enable_stretch) {
/* select attached nets depending on ControlMask and enable_stretch */
if(stretch && !(state & ShiftMask)) {
select_attached_nets(); /* stretch nets that land on selected instance pins */
}
/* if dragging instances with Ctrl and Shift down add wires to pins attached to something */
if(state == (ShiftMask | ControlMask) ) {
xctx->connect_by_kissing = 2; /* 2 will be used to reset var to 0 at end of move */
move_objects(START,0,0,0);

View File

@ -475,7 +475,6 @@ Selected find_closest_obj(double mx, double my, int override_lock)
distance = DBL_MAX;
find_closest_line(mx, my);
find_closest_polygon(mx, my);
dbg(0, "find_closest_obj(): mx=%g, my=%g\n", mx, my);
/* dbg(1, "1 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
find_closest_box(mx, my, override_lock);
find_closest_arc(mx, my);