summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-01-02 15:15:27 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-01-02 15:15:27 +0000
commitc08c28e9a22f0fe5f06e9dc34430c3acb16f3c13 (patch)
treedc64d1ef21b86f0907a254f89391f5b4aa1860ba /src
parentfix a bug whith degenerate handles (diff)
downloadinkscape-c08c28e9a22f0fe5f06e9dc34430c3acb16f3c13.tar.gz
inkscape-c08c28e9a22f0fe5f06e9dc34430c3acb16f3c13.zip
Fixed a boring bug sometimes curves be converted to lines, increasing a bit the distance from the handle to the line
(bzr r11950.1.230)
Diffstat (limited to 'src')
-rw-r--r--src/ui/tool/node.cpp21
-rw-r--r--src/ui/tool/path-manipulator.cpp6
-rw-r--r--src/ui/tools/pen-tool.cpp29
3 files changed, 37 insertions, 19 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index a932e5b7b..39b21ae6d 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -1388,6 +1388,12 @@ Node *Node::nodeAwayFrom(Handle *h)
Glib::ustring Node::_getTip(unsigned state) const
{
+ //spanish: un truco par, si el nodo tiene fuerza, nos marca que es
+ //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados
+ //no lo podemos hacer de otra forma al ser constante la funcion
+ bool isBSpline = false;
+ if( this->bsplineWeight != 0.0000)
+ isBSpline = true;
if (state_held_shift(state)) {
bool can_drag_out = (_next() && _front.isDegenerate()) || (_prev() && _back.isDegenerate());
if (can_drag_out) {
@@ -1417,15 +1423,24 @@ Glib::ustring Node::_getTip(unsigned state) const
// No modifiers: assemble tip from node type
char const *nodetype = node_type_to_localized_string(_type);
if (_selection.transformHandlesEnabled() && selected()) {
- if (_selection.size() == 1) {
+ if (_selection.size() == 1 && !isBSpline) {
return format_tip(C_("Path node tip",
"<b>%s</b>: drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype);
+ }else if(_selection.size() == 1){
+ return format_tip(C_("Path node tip",
+ "<b>BSpline node</b>: %g weight, drag to shape the path (more: Shift, Ctrl, Alt)"),this->bsplineWeight);
}
return format_tip(C_("Path node tip",
"<b>%s</b>: drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype);
}
- return format_tip(C_("Path node tip",
- "<b>%s</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype);
+ if (!isBSpline) {
+ return format_tip(C_("Path node tip",
+ "<b>%s</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype);
+ }else{
+ return format_tip(C_("Path node tip",
+ "<b>BSpline node</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"));
+
+ }
}
Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) const
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index e70717728..cda8374c5 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1219,13 +1219,11 @@ double PathManipulator::BSplineHandlePosition(Handle *h){
Node *n = h->parent();
Node * nextNode = NULL;
nextNode = n->nodeToward(h);
- Geom::Point positionH = h->position();
- positionH = Geom::Point(positionH[X] + 0.0001,positionH[Y] + 0.0001);
if(nextNode && n->position() != h->position()){
SPCurve *lineInsideNodes = new SPCurve();
lineInsideNodes->moveto(n->position());
lineInsideNodes->lineto(nextNode->position());
- pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment());
+ pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment());
}
return pos;
}
@@ -1252,7 +1250,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){
SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis();
n->bsplineWeight = pos;
ret = SBasisInsideNodes.valueAt(pos);
- ret = Geom::Point(ret[X] + 0.0001,ret[Y] + 0.0001);
+ ret = Geom::Point(ret[X] + 0.005,ret[Y] + 0.005);
}else{
if(pos == 0.0000){
n->bsplineWeight = 0.0000;
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 9b5acb6cc..a48f8911a 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -959,7 +959,7 @@ static void pen_redraw_all (PenTool *const pc)
}
}
- //spanish: simplemente redibujamos la spiro teniendo en cuenta si el nodo es cusp o symm.
+ //spanish: simplemente redibujamos la spiro.
//como es un redibujo simplemente no llamamos a la función global sino al final de esta
//Lanzamos solamente el redibujado
bspline_spiro_build(pc);
@@ -1451,7 +1451,7 @@ static void bspline_spiro_on(PenTool *const pc)
pc->p[0] = pc->red_curve->first_segment()->initialPoint();
pc->p[3] = pc->red_curve->first_segment()->finalPoint();
pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]);
- pc->p[2] = Geom::Point(pc->p[2][X] + 0.0001,pc->p[2][Y] + 0.0001);
+ pc->p[2] = Geom::Point(pc->p[2][X] + 0.005,pc->p[2][Y] + 0.005);
}
}
@@ -1492,7 +1492,7 @@ static void bspline_spiro_start_anchor_on(PenTool *const pc)
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.0001,C[Y] + 0.0001);
+ C = Geom::Point(C[X] + 0.005,C[Y] + 0.005);
if(cubic){
lastSeg->moveto(A);
lastSeg->curveto((*cubic)[1],C,D);
@@ -1549,19 +1549,23 @@ static void bspline_spiro_motion(PenTool *const pc, bool shift){
using Geom::X;
using Geom::Y;
+ if(pc->red_curve->is_empty()) return;
+ pc->npoints = 5;
SPCurve *tmpCurve = new SPCurve();
pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]);
+ pc->p[2] = Geom::Point(pc->p[2][X] + 0.005,pc->p[2][Y] + 0.005);
if(pc->green_curve->is_empty() && !pc->sa){
pc->p[1] = pc->p[0] + (1./3)*(pc->p[3] - pc->p[0]);
+ pc->p[1] = Geom::Point(pc->p[1][X] + 0.005,pc->p[1][Y] + 0.005);
}else if(!pc->green_curve->is_empty()){
tmpCurve = pc->green_curve->copy();
}else{
tmpCurve = pc->sa->curve->copy();
if(pc->sa->start)
tmpCurve = tmpCurve->create_reverse();
-
}
- if(!tmpCurve->is_empty() && !pc->red_curve->is_empty()){
+
+ if(!tmpCurve->is_empty()){
Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const*>(&*tmpCurve->last_segment());
if(cubic){
if(pc->bspline){
@@ -1577,16 +1581,17 @@ static void bspline_spiro_motion(PenTool *const pc, bool shift){
WPower->reset();
pc->p[1] = SBasisWPower.valueAt(WP);
if(!Geom::are_near(pc->p[1],pc->p[0]))
- pc->p[1] = Geom::Point(pc->p[1][X] + 0.0001,pc->p[1][Y] + 0.0001);
+ pc->p[1] = Geom::Point(pc->p[1][X] + 0.005,pc->p[1][Y] + 0.005);
if(shift)
- pc->p[2]=pc->p[3];
- else
- pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]);
+ pc->p[2] = pc->p[3];
}else{
pc->p[1] = (*cubic)[3] + (Geom::Point)((*cubic)[3] - (*cubic)[2] );
+ pc->p[1] = Geom::Point(pc->p[1][X] + 0.005,pc->p[1][Y] + 0.005);
}
}else{
pc->p[1] = pc->p[0];
+ if(shift)
+ pc->p[2] = pc->p[3];
}
}
@@ -1606,7 +1611,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc)
using Geom::X;
using Geom::Y;
pc->p[2] = pc->p[3] + (1./3)*(pc->p[0] - pc->p[3]);
- pc->p[2] = Geom::Point(pc->p[2][X] + 0.0001,pc->p[2][Y] + 0.0001);
+ pc->p[2] = Geom::Point(pc->p[2][X] + 0.005,pc->p[2][Y] + 0.005);
SPCurve *tmpCurve = new SPCurve();
SPCurve *lastSeg = new SPCurve();
Geom::Point C(0,0);
@@ -1616,7 +1621,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc)
Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const*>(&*tmpCurve->last_segment());
if(pc->bspline){
C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint());
- C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001);
+ C = Geom::Point(C[X] + 0.005,C[Y] + 0.005);
}else{
C = pc->p[3] + (Geom::Point)(pc->p[3] - pc->p[2] );
}
@@ -1645,7 +1650,7 @@ static void bspline_spiro_end_anchor_on(PenTool *const pc)
Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const*>(&*tmpCurve->last_segment());
if(pc->bspline){
C = tmpCurve->last_segment()->finalPoint() + (1./3)*(tmpCurve->last_segment()->initialPoint() - tmpCurve->last_segment()->finalPoint());
- C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001);
+ C = Geom::Point(C[X] + 0.005,C[Y] + 0.005);
}else{
C = pc->p[3] + (Geom::Point)(pc->p[3] - pc->p[2] );
}