diff options
| author | jtx <javier.arraiza@marker.es> | 2013-02-19 16:48:44 +0000 |
|---|---|---|
| committer | jtx <javier.arraiza@marker.es> | 2013-02-19 16:48:44 +0000 |
| commit | e77f8af15850e964f5d69c84b0f45a66ae229d94 (patch) | |
| tree | 66eeb27d793d6874bc51e7e2601b1b41fa6aae81 /src/ui/tool/node.cpp | |
| parent | Fix cusp continuous? path close broken (diff) | |
| parent | Mayor refactor (diff) | |
| download | inkscape-e77f8af15850e964f5d69c84b0f45a66ae229d94.tar.gz inkscape-e77f8af15850e964f5d69c84b0f45a66ae229d94.zip | |
Refactor problem cusp nodes
(bzr r11950.3.2)
Diffstat (limited to 'src/ui/tool/node.cpp')
| -rw-r--r-- | src/ui/tool/node.cpp | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index dc6e0fbae..447133b7c 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -13,7 +13,6 @@ #include <glib/gi18n.h> #include <2geom/bezier-utils.h> #include <2geom/transforms.h> - #include "display/sp-ctrlline.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" @@ -136,6 +135,14 @@ void Handle::move(Geom::Point const &new_pos) Node *node_away = _parent->nodeAwayFrom(this); // node in the opposite direction Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; + //BSpline + bool isBSpline = false; + double pos = 0; + Handle *h = this; + if(_pm().isBSpline()){ + isBSpline = true; + //BSpline End + } if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. @@ -167,6 +174,16 @@ void Handle::move(Geom::Point const &new_pos) } } setPosition(new_pos); + //BSpline + if(isBSpline){ + setPosition(_pm().BSplineHandleReposition(h)); + pos = _pm().BSplineHandlePosition(h); + other->setPosition(_pm().BSplineHandleReposition(other,pos)); + if(pos == 0){ + _parent->setPosition(h->position()); + } + } + //BSpline End return; } @@ -196,8 +213,17 @@ void Handle::move(Geom::Point const &new_pos) break; default: break; } - setPosition(new_pos); + //BSpline + if(isBSpline){ + setPosition(_pm().BSplineHandleReposition(h)); + pos = _pm().BSplineHandlePosition(h); + other->setPosition(_pm().BSplineHandleReposition(other,pos)); + if(pos == 0){ + _parent->setPosition(h->position()); + } + } + //BSpline End } void Handle::setPosition(Geom::Point const &p) @@ -550,10 +576,26 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); + //BSpline + double pos = 0; + if(_pm().isBSpline()){ + Node *n = this; + pos = _pm().BSplineHandlePosition(n->front()); + if(pos == 0) + pos = _pm().BSplineHandlePosition(n->back()); + } + //BSpline End setPosition(new_pos); _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); - + //BSpline + if(_pm().isBSpline()){ + Handle* front = &_front; + Handle* back = &_back; + _front.setPosition(_pm().BSplineHandleReposition(front,pos)); + _back.setPosition(_pm().BSplineHandleReposition(back,pos)); + } + //BSpline End // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); |
