summaryrefslogtreecommitdiffstats
path: root/src/ui/tool/path-manipulator.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-04-01 12:02:22 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-04-01 12:02:22 +0000
commit0f78c1425e814758c0a0d7f0c2578eae88fe3ab6 (patch)
treefa65ea104ff6fa39aae2e1a74a63fdf1da74ed35 /src/ui/tool/path-manipulator.cpp
parentSome node.cpp/h work moved to path_manipulator. (diff)
downloadinkscape-0f78c1425e814758c0a0d7f0c2578eae88fe3ab6.tar.gz
inkscape-0f78c1425e814758c0a0d7f0c2578eae88fe3ab6.zip
A refactor for fixing some issues. Pending how to handle static functions
Vinícius for handle tips in his static functions i know two ways: A: A bool property in node class of node.h to handle if curve is bspline B: Call another non static function from the static tips one -not tested- (bzr r11950.1.323)
Diffstat (limited to 'src/ui/tool/path-manipulator.cpp')
-rw-r--r--src/ui/tool/path-manipulator.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 905df61f4..487c31b10 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -667,10 +667,10 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite
// if we are removing, we readjust the handlers
if(isBSpline()){
if(start.prev()){
- start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),true));
+ start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),start.prev()->back()));
}
if(end){
- end->back()->setPosition(BSplineHandleReposition(end->back(),true));
+ end->back()->setPosition(BSplineHandleReposition(end->back(),end->front()));
}
}
@@ -1207,31 +1207,31 @@ bool PathManipulator::isBSpline(bool recalculate){
}
// returns the corresponding strength to the position of the handlers
-double PathManipulator::BSplineHandlePosition(Handle *h, bool other){
+double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){
using Geom::X;
using Geom::Y;
+ if(h2){
+ h = h2;
+ }
double pos = 0.0000;
Node *n = h->parent();
Node * nextNode = NULL;
- if(other){
- h = h->other();
- }
nextNode = n->nodeToward(h);
- if(nextNode && !Geom::are_near(n->position(), h->position())){
+ if(nextNode){
SPCurve *lineInsideNodes = new SPCurve();
lineInsideNodes->moveto(n->position());
lineInsideNodes->lineto(nextNode->position());
pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment());
}
- if ((pos == 0.0000 || pos == 1.0000) && other == false){
- return BSplineHandlePosition(h, true);
+ if (pos == 0.0000 && !h2){
+ return BSplineHandlePosition(h, h->other());
}
return pos;
}
// give the location for the handler in the corresponding position
-Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, bool other){
- double pos = this->BSplineHandlePosition(h, other);
+Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){
+ double pos = this->BSplineHandlePosition(h, h2);
return BSplineHandleReposition(h,pos);
}