diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-02-28 03:43:21 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Zenotz <jtx@jtx.marker.es> | 2013-02-28 03:43:21 +0000 |
| commit | ecc57932f1e7d157950ada2901f6ea6f3acc8aad (patch) | |
| tree | a709f96bc323c5e7b69d09ece12aefebfb0e14d8 /src/ui/tool/path-manipulator.cpp | |
| parent | BSpline refactor (diff) | |
| download | inkscape-ecc57932f1e7d157950ada2901f6ea6f3acc8aad.tar.gz inkscape-ecc57932f1e7d157950ada2901f6ea6f3acc8aad.zip | |
Fixed closed pc->ea
(bzr r11950.1.40)
Diffstat (limited to 'src/ui/tool/path-manipulator.cpp')
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index ecb8abcf4..7c23ee153 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1182,15 +1182,20 @@ bool PathManipulator::isBSpline(){ } return false; } + double PathManipulator::BSplineHandlePosition(Handle *h){ + using Geom::X; + using Geom::Y; double pos = 0; Node *n = h->parent(); SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); - if(nextNode){ + Geom::Point positionH = h->position(); + positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); + if(nextNode && n->position() != h->position()){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); } return pos; } @@ -1201,18 +1206,23 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ } Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ + using Geom::X; + using Geom::Y; + Geom::Point ret(0,0); Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); - if(nextNode){ + if(nextNode && pos != 0){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + ret = SBasisInsideNodes.valueAt(pos); + ret = Geom::Point(ret[X] + 0.0625,ret[Y] + 0.0625); }else{ - return n->position(); + ret = n->position(); } - return SBasisInsideNodes.valueAt(pos); + return ret; } /** Construct the geometric representation of nodes and handles, update the outline @@ -1229,26 +1239,8 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) continue; } NodeList::iterator prev = subpath->begin(); - //BSpline - double pos =0; - bool isBSpline = false; - if(this->isBSpline()) - isBSpline = true; - if(isBSpline){ - pos = BSplineHandlePosition(prev.ptr()->front()); - prev->front()->setPosition(BSplineHandleReposition(prev->front(),pos)); - } - //BSpline End builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { - //BSpline - if (isBSpline) { - pos = BSplineHandlePosition(i->back()); - i->front()->setPosition(BSplineHandleReposition(i->front(),pos)); - i->back()->setPosition(BSplineHandleReposition(i->back(),pos)); - } - - //BSpline End build_segment(builder, prev.ptr(), i.ptr()); prev = i; } @@ -1256,13 +1248,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) if (subpath->closed()) { // Here we link the last and first node if the path is closed. // If the last segment is Bezier, we add it. - //BSpline - if (isBSpline) { - pos = BSplineHandlePosition(prev.next()->back()); - subpath->begin()->front()->setPosition(BSplineHandleReposition(subpath->begin()->front(),pos)); - prev.next()->back()->setPosition(BSplineHandleReposition(prev.next()->back(),pos)); - } - //BSpline End if (!prev->front()->isDegenerate() || !subpath->begin()->back()->isDegenerate()) { build_segment(builder, prev.ptr(), subpath->begin().ptr()); } |
