summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f2b0b16)
raw | patch | inline | side by side (parent: f2b0b16)
author | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Thu, 18 Mar 2010 02:59:43 +0000 (03:59 +0100) | ||
committer | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Thu, 18 Mar 2010 02:59:43 +0000 (03:59 +0100) |
src/ui/tool/multi-path-manipulator.cpp | patch | blob | history | |
src/ui/tool/path-manipulator.cpp | patch | blob | history |
index fe97058c456d2231c624c93d4063c83e444b7396..2025a12d7b4826cc54f7de1d9306792eec78dabc 100644 (file)
}
if (which == 0) break; // no handle chosen
bool one_pixel = _tracker.leftAlt() || _tracker.rightAlt();
+ bool handled = true;
switch (key) {
// single handle functions
case GDK_less:
pm.scaleHandle(n, which, -1, one_pixel);
break;
+ default:
+ handled = false;
+ break;
}
- return true;
+
+ if (handled) return true;
} while(0);
}
index f6d5bde37124654d85b22d03773f55a8be6b108b..66f72f379ee985706ba107d7d4492da579804cee 100644 (file)
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;
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();