summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-03-18 02:59:43 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-03-18 02:59:43 +0000
commite46805d62ddb2975490a42c16a44d2232c7dbf37 (patch)
treeaa74060d68578e73c8bf941473d435f89dbfd921 /src
parentSet transform center so that odd stars and polygons rotate correctly. (diff)
downloadinkscape-e46805d62ddb2975490a42c16a44d2232c7dbf37.tar.gz
inkscape-e46805d62ddb2975490a42c16a44d2232c7dbf37.zip
Fix a few remaining oddities in handle scaling via keyboard
(bzr r9205)
Diffstat (limited to 'src')
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp7
-rw-r--r--src/ui/tool/path-manipulator.cpp25
2 files changed, 21 insertions, 11 deletions
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp
index fe97058c4..2025a12d7 100644
--- a/src/ui/tool/multi-path-manipulator.cpp
+++ b/src/ui/tool/multi-path-manipulator.cpp
@@ -464,6 +464,7 @@ bool MultiPathManipulator::event(GdkEvent *event)
}
if (which == 0) break; // no handle chosen
bool one_pixel = _tracker.leftAlt() || _tracker.rightAlt();
+ bool handled = true;
switch (key) {
// single handle functions
@@ -485,8 +486,12 @@ bool MultiPathManipulator::event(GdkEvent *event)
case GDK_less:
pm.scaleHandle(n, which, -1, one_pixel);
break;
+ default:
+ handled = false;
+ break;
}
- return true;
+
+ if (handled) return true;
} while(0);
}
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index f6d5bde37..66f72f379 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -747,6 +747,7 @@ void PathManipulator::scaleHandle(Node *n, int which, int dir, bool pixel)
Geom::Point relpos;
if (h->isDegenerate()) {
+ if (dir < 0) return;
Node *nh = n->nodeToward(h);
if (!nh) return;
relpos = Geom::unit_vector(nh->position() - n->position()) * length_change;
@@ -788,20 +789,24 @@ void PathManipulator::rotateHandle(Node *n, int which, int dir, bool pixel)
Handle *PathManipulator::_chooseHandle(Node *n, int which)
{
- // Rationale for this choice:
- // Imagine you have two handles pointing right, where one of them is only slighty higher
- // than the other. Extending one of the handles could make its X coord larger than
- // the second one, and keeping the shortcut pressed would result in two handles being
- // extended alternately. This appears like extending both handles at once and is confusing.
- // Using the unit vector avoids this problem and remains fairly intuitive.
- Geom::Point f = Geom::unit_vector(n->front()->position());
- Geom::Point b = Geom::unit_vector(n->back()->position());
+ NodeList::iterator i = NodeList::get_iterator(n);
+ Node *prev = i.prev().ptr();
+ Node *next = i.next().ptr();
+
+ // on an endnode, the remaining handle automatically wins
+ if (!next) return n->back();
+ if (!prev) return n->front();
+
+ // compare X coord ofline segments
+ Geom::Point npos = next->position();
+ Geom::Point ppos = prev->position();
if (which < 0) {
// pick left handle.
// we just swap the handles and pick the right handle below.
- std::swap(f, b);
+ std::swap(npos, ppos);
}
- if (f[Geom::X] >= b[Geom::X]) {
+
+ if (npos[Geom::X] >= ppos[Geom::X]) {
return n->front();
} else {
return n->back();