diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-08-04 09:21:54 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-08-04 09:21:54 +0000 |
| commit | b2842360758b2333a651ef9932c1e438e90628e3 (patch) | |
| tree | cde6a1848389e11a6f23fb0b54015151c093d2d9 /src/ui | |
| parent | Fix type in 'mix-blend-mode'. (diff) | |
| download | inkscape-b2842360758b2333a651ef9932c1e438e90628e3.tar.gz inkscape-b2842360758b2333a651ef9932c1e438e90628e3.zip | |
Fixed some redraw problems moving nodes in bspline mode
(bzr r13341.1.115)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 6 | ||||
| -rw-r--r-- | src/ui/tools/pen-tool.cpp | 16 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 01cff5ad7..9839be437 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1219,6 +1219,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ h = h2; } double pos = 0.0000; + const double handleCubicGap = 0.01; Node *n = h->parent(); Node * nextNode = NULL; nextNode = n->nodeToward(h); @@ -1226,7 +1227,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); } if (pos == 0.0000 && !h2){ return BSplineHandlePosition(h, h->other()); @@ -1244,6 +1245,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; + const double handleCubicGap = 0.01; Geom::Point ret = h->position(); Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; @@ -1255,7 +1257,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); ret = SBasisInsideNodes.valueAt(pos); - ret = Geom::Point(ret[X] + 0.005,ret[Y] + 0.005); + ret = Geom::Point(ret[X] + handleCubicGap,ret[Y] + handleCubicGap); }else{ if(pos == 0.0000){ ret = n->position(); diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index d826eaf48..9a73d497f 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -84,7 +84,7 @@ namespace Tools { static Geom::Point pen_drag_origin_w(0, 0); static bool pen_within_tolerance = false; static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical - +const double handleCubicGap = 0.01; namespace { ToolBase* createPenContext() { return new PenTool(); @@ -1454,7 +1454,7 @@ void PenTool::_bspline_spiro_on() this->p[0] = this->red_curve->first_segment()->initialPoint(); this->p[3] = this->red_curve->first_segment()->finalPoint(); this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]); - this->p[2] = Geom::Point(this->p[2][X] + 0.005,this->p[2][Y] + 0.005); + this->p[2] = Geom::Point(this->p[2][X] + handleCubicGap,this->p[2][Y] + handleCubicGap); } } @@ -1522,7 +1522,7 @@ void PenTool::_bspline_spiro_start_anchor_on() Geom::Point A = tmpCurve->last_segment()->initialPoint(); Geom::Point D = tmpCurve->last_segment()->finalPoint(); Geom::Point C = D + (1./3)*(A - D); - C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); + C = Geom::Point(C[X] + handleCubicGap,C[Y] + handleCubicGap); if(cubic){ lastSeg->moveto(A); lastSeg->curveto((*cubic)[1],C,D); @@ -1580,10 +1580,10 @@ void PenTool::_bspline_spiro_motion(bool shift){ this->npoints = 5; SPCurve *tmpCurve = new SPCurve(); this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]); - this->p[2] = Geom::Point(this->p[2][X] + 0.005,this->p[2][Y] + 0.005); + this->p[2] = Geom::Point(this->p[2][X] + handleCubicGap,this->p[2][Y] + handleCubicGap); 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] + 0.005,this->p[1][Y] + 0.005); + this->p[1] = Geom::Point(this->p[1][X] + handleCubicGap,this->p[1][Y] + handleCubicGap); }else if(!this->green_curve->is_empty()){ tmpCurve = this->green_curve->copy(); }else{ @@ -1608,7 +1608,7 @@ void PenTool::_bspline_spiro_motion(bool shift){ WPower->reset(); this->p[1] = SBasisWPower.valueAt(WP); if(!Geom::are_near(this->p[1],this->p[0])) - this->p[1] = Geom::Point(this->p[1][X] + 0.005,this->p[1][Y] + 0.005); + this->p[1] = Geom::Point(this->p[1][X] + handleCubicGap,this->p[1][Y] + handleCubicGap); if(shift) this->p[2] = this->p[3]; }else{ @@ -1638,7 +1638,7 @@ void PenTool::_bspline_spiro_end_anchor_on() using Geom::X; using Geom::Y; this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]); - this->p[2] = Geom::Point(this->p[2][X] + 0.005,this->p[2][Y] + 0.005); + this->p[2] = Geom::Point(this->p[2][X] + handleCubicGap,this->p[2][Y] + handleCubicGap); SPCurve *tmpCurve = new SPCurve(); SPCurve *lastSeg = new SPCurve(); Geom::Point C(0,0); @@ -1661,7 +1661,7 @@ void PenTool::_bspline_spiro_end_anchor_on() Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const*>(&*tmpCurve->last_segment()); if(this->bspline){ C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint()); - C = Geom::Point(C[X] + 0.005,C[Y] + 0.005); + C = Geom::Point(C[X] + handleCubicGap,C[Y] + handleCubicGap); }else{ C = this->p[3] + this->p[3] - this->p[2]; } |
