summaryrefslogtreecommitdiffstats
path: root/src/ui/tool/transform-handle-set.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-12-16 22:07:52 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-12-16 22:07:52 +0000
commitd18ee1bd701f1e78a42fc4253f7a5c4e7ece714a (patch)
tree7b62d3e3d71832d75c18b67771a5b413293a8683 /src/ui/tool/transform-handle-set.cpp
parentNode tool: fix snapping during constrained rotation of handles (diff)
downloadinkscape-d18ee1bd701f1e78a42fc4253f7a5c4e7ece714a.tar.gz
inkscape-d18ee1bd701f1e78a42fc4253f7a5c4e7ece714a.zip
Node tool: fix snapping of node rotation center
Fixed bugs: - https://launchpad.net/bugs/667072 (bzr r9960)
Diffstat (limited to 'src/ui/tool/transform-handle-set.cpp')
-rw-r--r--src/ui/tool/transform-handle-set.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp
index ef93a3767..cafd592a3 100644
--- a/src/ui/tool/transform-handle-set.cpp
+++ b/src/ui/tool/transform-handle-set.cpp
@@ -18,6 +18,8 @@
#include "desktop-handles.h"
#include "display/sodipodi-ctrlrect.h"
#include "preferences.h"
+#include "snap.h"
+#include "sp-namedview.h"
#include "ui/tool/commit-events.h"
#include "ui/tool/control-point.h"
#include "ui/tool/event-utils.h"
@@ -473,7 +475,23 @@ public:
}
protected:
-
+ virtual void dragged(Geom::Point &new_pos, GdkEventMotion *event) {
+ SnapManager &sm = _desktop->namedview->snap_manager;
+ sm.setup(_desktop);
+ bool snap = !held_shift(*event) && sm.someSnapperMightSnap();
+ if (held_control(*event)) {
+ // constrain to axes
+ Geom::Point origin = _last_drag_origin();
+ std::vector<Inkscape::Snapper::SnapConstraint> constraints;
+ constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, Geom::Point(1, 0)));
+ constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, Geom::Point(0, 1)));
+ new_pos = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos,
+ SNAPSOURCE_ROTATION_CENTER), constraints, held_shift(*event)).getPoint();
+ } else if (snap) {
+ sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_ROTATION_CENTER);
+ }
+ sm.unSetup();
+ }
virtual Glib::ustring _getTip(unsigned /*state*/) {
return C_("Transform handle tip",
"<b>Rotation center</b>: drag to change the origin of transforms");