summaryrefslogtreecommitdiffstats
path: root/src/display/snap-indicator.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2015-06-12 21:50:13 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2015-06-12 21:50:13 +0000
commite90dafdefd3ea63ca7c4f1e070eb367ec4d54e5c (patch)
tree66f962207453d2a97c5757add39c8c2b90dd551b /src/display/snap-indicator.cpp
parent"13940 was not a terrible mistake!" (diff)
downloadinkscape-e90dafdefd3ea63ca7c4f1e070eb367ec4d54e5c.tar.gz
inkscape-e90dafdefd3ea63ca7c4f1e070eb367ec4d54e5c.zip
Make the behavior of the snap indicator fully transparent, such that all events are sent to the items or canvas as intended
Fixed bugs: - https://launchpad.net/bugs/1420301 (bzr r14201)
Diffstat (limited to 'src/display/snap-indicator.cpp')
-rw-r--r--src/display/snap-indicator.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp
index 8c0c8163f..926b35599 100644
--- a/src/display/snap-indicator.cpp
+++ b/src/display/snap-indicator.cpp
@@ -258,6 +258,19 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
const int timeout_val = 4000;
+ // The snap indicator will be deleted after some time-out, and sp_canvas_item_dispose
+ // will be called. This will set canvas->current_item to NULL if the snap indicator was
+ // the current item, after which any events will go to the root handler instead of any
+ // item handler. Dragging an object which has just snapped might therefore not be possible
+ // without selecting / repicking it again. To avoid this, we make sure here that the
+ // snap indicator will never be picked, and will therefore never be the current item.
+ // Reported bugs:
+ // - scrolling when hovering above a pre-snap indicator won't work (for example)
+ // (https://bugs.launchpad.net/inkscape/+bug/522335/comments/8)
+ // - dragging doesn't work without repicking
+ // (https://bugs.launchpad.net/inkscape/+bug/1420301/comments/15)
+ SP_CTRL(canvasitem)->pickable = false;
+
SP_CTRL(canvasitem)->moveto(p.getPoint());
_snaptarget = _desktop->add_temporary_canvasitem(canvasitem, timeout_val);
_snaptarget_is_presnap = pre_snap;
@@ -282,6 +295,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
SPCanvasItem *canvas_tooltip = sp_canvastext_new(_desktop->getTempGroup(), _desktop, tooltip_pos, tooltip_str);
sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize);
+ SP_CANVASTEXT(canvas_tooltip)->pickable = false; // See the extensive comment above
SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff;
SP_CANVASTEXT(canvas_tooltip)->outline = false;
SP_CANVASTEXT(canvas_tooltip)->background = true;
@@ -306,6 +320,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
SP_CTRLRECT(box)->setRectangle(*bbox);
SP_CTRLRECT(box)->setColor(pre_snap ? 0x7f7f7fff : 0xff0000ff, 0, 0);
SP_CTRLRECT(box)->setDashed(true);
+ SP_CTRLRECT(box)->pickable = false; // See the extensive comment above
sp_canvas_item_move_to_z(box, 0);
_snaptarget_bbox = _desktop->add_temporary_canvasitem(box, timeout_val);
}