summaryrefslogtreecommitdiffstats
path: root/src/ui/tool/node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/tool/node.cpp')
-rw-r--r--src/ui/tool/node.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 447133b7c..4cac0e543 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -138,11 +138,14 @@ void Handle::move(Geom::Point const &new_pos)
//BSpline
bool isBSpline = false;
double pos = 0;
- Handle *h = this;
+ Handle *h = NULL;
+ Handle *h2 = NULL;
if(_pm().isBSpline()){
isBSpline = true;
- //BSpline End
+ if(!_parent->selected())
+ _parent->_selection.insert(_parent);
}
+ //BSpline End
if (Geom::are_near(new_pos, _parent->position())) {
// The handle becomes degenerate.
@@ -176,12 +179,11 @@ void Handle::move(Geom::Point const &new_pos)
setPosition(new_pos);
//BSpline
if(isBSpline){
+ h = this;
setPosition(_pm().BSplineHandleReposition(h));
pos = _pm().BSplineHandlePosition(h);
- other->setPosition(_pm().BSplineHandleReposition(other,pos));
- if(pos == 0){
- _parent->setPosition(h->position());
- }
+ h2 = this->other();
+ this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos));
}
//BSpline End
return;
@@ -216,12 +218,11 @@ void Handle::move(Geom::Point const &new_pos)
setPosition(new_pos);
//BSpline
if(isBSpline){
+ h = this;
setPosition(_pm().BSplineHandleReposition(h));
pos = _pm().BSplineHandlePosition(h);
- other->setPosition(_pm().BSplineHandleReposition(other,pos));
- if(pos == 0){
- _parent->setPosition(h->position());
- }
+ h2 = this->other();
+ this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos));
}
//BSpline End
}
@@ -577,17 +578,35 @@ void Node::move(Geom::Point const &new_pos)
Geom::Point old_pos = position();
Geom::Point delta = new_pos - position();
//BSpline
+ double prevPos = 0;
double pos = 0;
+ double nextPos = 0;
+ Node *n = this;
+ Node * nextNode = n->nodeToward(n->front());
+ Node * prevNode = n->nodeToward(n->back());
if(_pm().isBSpline()){
- Node *n = this;
+ if(prevNode)
+ prevPos = _pm().BSplineHandlePosition(prevNode->front());
pos = _pm().BSplineHandlePosition(n->front());
if(pos == 0)
pos = _pm().BSplineHandlePosition(n->back());
+ if(nextNode)
+ nextPos = _pm().BSplineHandlePosition(nextNode->back());
}
//BSpline End
setPosition(new_pos);
+ //BSpline
+ if(prevNode)
+ prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos));
+ if(nextNode)
+ nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos));
+ //BSpline End
_front.setPosition(_front.position() + delta);
_back.setPosition(_back.position() + delta);
+ //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);
//BSpline
if(_pm().isBSpline()){
Handle* front = &_front;
@@ -595,10 +614,6 @@ void Node::move(Geom::Point const &new_pos)
_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);
}
void Node::transform(Geom::Affine const &m)