From 0403ae2f0f76e56b31e369160648968671324d13 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 16 Sep 2014 01:07:32 +0200 Subject: fixing cusp node bug on bspline -problems moving nodes because tiny handles (bzr r13341.1.209) --- src/ui/tool/path-manipulator.cpp | 4 +++- src/ui/tools/pen-tool.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 5f20aece7..f30ecb1d1 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1227,7 +1227,9 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); + if(!are_near(h->position(), n->position())){ + pos = Geom::nearest_point(Geom::Point(h->position()[X] ,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); + } } if (pos == 0.0000 && !h2){ return BSplineHandlePosition(h, h->other()); diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 318591df5..b68231e10 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1586,6 +1586,9 @@ void PenTool::_bspline_spiro_motion(bool shift){ if(this->green_curve->is_empty() && !this->sa){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); this->p[1] = Geom::Point(this->p[1][X] + handleCubicGap,this->p[1][Y] + handleCubicGap); + if(shift){ + this->p[2] = this->p[3]; + } }else if(!this->green_curve->is_empty()){ tmpCurve = this->green_curve->copy(); }else{ @@ -1609,8 +1612,11 @@ void PenTool::_bspline_spiro_motion(bool shift){ SBasisWPower = WPower->first_segment()->toSBasis(); WPower->reset(); this->p[1] = SBasisWPower.valueAt(WP); - if(!Geom::are_near(this->p[1],this->p[0])) + if(!Geom::are_near(this->p[1],this->p[0])){ this->p[1] = Geom::Point(this->p[1][X] + handleCubicGap,this->p[1][Y] + handleCubicGap); + } else { + this->p[1] = this->p[0]; + } if(shift) this->p[2] = this->p[3]; }else{ -- cgit v1.2.3