Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 10146) +++ trunk/src/crosshair.c (revision 10147) @@ -1320,6 +1320,9 @@ if (ans != PCB_TYPE_NONE) { pcb_pad_t *pad = (pcb_pad_t *) ptr2; check_snap_object(&snap_data, (pad->Point1.X + pad->Point2.X) / 2, (pad->Point1.Y + pad->Point2.Y) / 2, pcb_true); + pcb_crosshair.snapped_pad = pad; + } else { + pcb_crosshair.snapped_pad = 0; } ans = PCB_TYPE_NONE; @@ -1334,6 +1337,9 @@ if (ans != PCB_TYPE_NONE) { pcb_pin_t *pin = (pcb_pin_t *) ptr2; check_snap_object(&snap_data, pin->X, pin->Y, pcb_true); + pcb_crosshair.snapped_pin = pin; + } else { + pcb_crosshair.snapped_pin = 0; } ans = PCB_TYPE_NONE; @@ -1347,6 +1353,7 @@ if (ans != PCB_TYPE_NONE) { pcb_pin_t *pin = (pcb_pin_t *) ptr2; check_snap_object(&snap_data, pin->X, pin->Y, pcb_true); + pcb_crosshair.snapped_pin = pin; } ans = PCB_TYPE_NONE; Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 10146) +++ trunk/src/crosshair.h (revision 10147) @@ -81,6 +81,8 @@ enum pcb_crosshair_shape_e shape; /* shape of crosshair */ vtop_t onpoint_objs; vtop_t old_onpoint_objs; + pcb_pad_t *snapped_pad; + pcb_pin_t *snapped_pin; /* list of object IDs that could have been dragged so that they can be cycled */ long int *drags; Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 10146) +++ trunk/src/gui_act.c (revision 10147) @@ -1375,6 +1375,41 @@ dy = pcb_get_value_ex(argv[2], argv[3], NULL, extra_units_y, "", NULL); if (!conf_core.editor.view.flip_y) dy = -dy; + + /* Allow leaving snapped pin/pad */ + if (pcb_crosshair.snapped_pad) { + pcb_pad_t *pad = pcb_crosshair.snapped_pad; + pcb_coord_t width = pad->Thickness; + pcb_coord_t height = pcb_distance(pad->Point1.X, pad->Point1.Y, pad->Point2.X, pad->Point2.Y)+width; + if (pad->Point1.Y == pad->Point2.Y) { + pcb_coord_t tmp = width; + width = height; + height = tmp; + } + if (dx < 0) { + dx -= width/2; + } else if (dx > 0) { + dx += width/2; + } + if (dy < 0) { + dy -= height/2; + } else if (dy > 0) { + dy += height/2; + } + } else if (pcb_crosshair.snapped_pin) { + pcb_pin_t *pin = pcb_crosshair.snapped_pin; + pcb_coord_t radius = pin->Thickness/2; + if (dx < 0) { + dx -= radius; + } else if (dx > 0) { + dx += radius; + } + if (dy < 0) { + dy -= radius; + } else if (dy > 0) { + dy += radius; + } + } pcb_event_move_crosshair(pcb_crosshair.X + dx, pcb_crosshair.Y + dy); pcb_gui->set_crosshair(pcb_crosshair.X, pcb_crosshair.Y, pan_warp);