summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@jtx.marker.es>2013-04-17 21:03:51 +0000
committerroot <root@jtx.marker.es>2013-04-17 21:03:51 +0000
commit458ca2842297a5eae7e4f6fc394b227d61881c8d (patch)
treeb707b844e1265fd31ca3861c250778f7ad6329d8
parentHalo (diff)
downloadinkscape-458ca2842297a5eae7e4f6fc394b227d61881c8d.tar.gz
inkscape-458ca2842297a5eae7e4f6fc394b227d61881c8d.zip
Update color lines overlay, with halo of 1 px matched by Gez. Fix some crash snapping. Added new button widget to make cusp node
(bzr r11950.1.96)
-rw-r--r--src/display/canvas-bpath.cpp2
-rw-r--r--src/live_effects/lpe-bspline.cpp95
-rw-r--r--src/live_effects/lpe-bspline.h2
-rw-r--r--src/pen-context.cpp62
-rw-r--r--src/pencil-context.cpp8
-rw-r--r--src/ui/tool/node.cpp17
-rw-r--r--src/ui/tool/path-manipulator.cpp12
7 files changed, 126 insertions, 72 deletions
diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp
index 651440512..a53b88efb 100644
--- a/src/display/canvas-bpath.cpp
+++ b/src/display/canvas-bpath.cpp
@@ -159,7 +159,7 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf)
}
if (dostroke) {
- ink_cairo_set_source_rgba32(buf->ct, 0xffffff4c);
+ ink_cairo_set_source_rgba32(buf->ct, 0xffffff42);
cairo_set_line_width(buf->ct, 3);
cairo_stroke_preserve(buf->ct);
cairo_restore(buf->ct);
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index 37bf24021..cc1b86e72 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -170,7 +170,7 @@ LPEBSpline::doEffect(SPCurve * curve)
SBasisOut = out->first_segment()->toSBasis();
nextPointAt1 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[1],*out->first_segment()));
nextPointAt2 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[2],*out->first_segment()));;
- nextPointAt3 = (*cubic)[3];
+ nextPointAt3 = out->first_segment()->finalPoint();
}else{
nextPointAt1 = out->first_segment()->initialPoint();
nextPointAt2 = out->first_segment()->finalPoint();
@@ -299,20 +299,25 @@ LPEBSpline::newWidget()
defaultWeight->signal_clicked().connect(sigc::mem_fun (*this,&LPEBSpline::toDefaultWeight));
Gtk::Widget* defaultWeightWidget = dynamic_cast<Gtk::Widget *>(defaultWeight);
vbox->pack_start(*defaultWeightWidget, true, true,2);
+ Gtk::Button* makeCusp = Gtk::manage(new Gtk::Button(Glib::ustring(_("Make cusp"))));
+ makeCusp->set_alignment(0.0, 0.5);
+ makeCusp->signal_clicked().connect(sigc::mem_fun (*this,&LPEBSpline::toMakeCusp));
+ Gtk::Widget* makeCuspWidget = dynamic_cast<Gtk::Widget *>(makeCusp);
+ vbox->pack_start(*makeCuspWidget, true, true,2);
return dynamic_cast<Gtk::Widget *>(vbox);
}
void
LPEBSpline::toDefaultWeight(){
- Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param_vector[3]->param_newWidget());
- Inkscape::UI::Widget::Scalar * widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
- widgRegistered->setValue(0.3334);
- widgRegistered->update();
- weight.param_set_value(0.3334);
changeWeight(0.3334);
}
void
+LPEBSpline::toMakeCusp(){
+ changeWeight(0.0000);
+}
+
+void
LPEBSpline::toWeight(){
changeWeight(weight);
}
@@ -434,24 +439,32 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
SBasisIn = in->first_segment()->toSBasis();
if(!onlySelected){
if(cubic){
- if(!ignoreCusp || (!Geom::are_near((*cubic)[1],in->first_segment()->initialPoint()) && weightValue !=0)){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[1],pointAt0)){
pointAt1 = SBasisIn.valueAt(weightValue);
- pointAt1 = Geom::Point(pointAt1[X] + 0.0625,pointAt1[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ pointAt1 = Geom::Point(pointAt1[X] + 0.0001,pointAt1[Y] + 0.0001);
+ }
}else{
pointAt1 = in->first_segment()->initialPoint();
}
- if((!ignoreCusp || !Geom::are_near((*cubic)[2],in->first_segment()->finalPoint())) && weightValue !=0){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[2],pointAt3)){
pointAt2 = SBasisIn.valueAt(1-weightValue);
- pointAt2 = Geom::Point(pointAt2[X] + 0.0625,pointAt2[Y] + 0.0625);
- }else{
+ if(weightValue !=0.0000){
+ pointAt2 = Geom::Point(pointAt2[X] + 0.0001,pointAt2[Y] + 0.0001);
+ }
+ }else{
pointAt2 = in->first_segment()->finalPoint();
}
}else{
- if(!ignoreCusp && weightValue !=0){
+ if(!ignoreCusp && weightValue !=0.0000){
pointAt1 = SBasisIn.valueAt(weightValue);
- pointAt1 = Geom::Point(pointAt1[X] + 0.0625,pointAt1[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ pointAt1 = Geom::Point(pointAt1[X] + 0.0001,pointAt1[Y] + 0.0001);
+ }
pointAt2 = SBasisIn.valueAt(1-weightValue);
- pointAt2 = Geom::Point(pointAt2[X] + 0.0625,pointAt2[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ pointAt2 = Geom::Point(pointAt2[X] + 0.0001,pointAt2[Y] + 0.0001);
+ }
}else{
pointAt1 = in->first_segment()->initialPoint();
pointAt2 = in->first_segment()->finalPoint();
@@ -459,20 +472,24 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
}
}else{
if(cubic){
- if(!ignoreCusp || (!Geom::are_near((*cubic)[1],in->first_segment()->initialPoint())&& weightValue !=0)){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[1],pointAt0)){
if(nodeIsSelected(pointAt0)){
pointAt1 = SBasisIn.valueAt(weightValue);
- pointAt1 = Geom::Point(pointAt1[X] + 0.0625,pointAt1[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ pointAt1 = Geom::Point(pointAt1[X] + 0.0001,pointAt1[Y] + 0.0001);
+ }
}else{
pointAt1 = (*cubic)[1];
}
}else{
pointAt1 = in->first_segment()->initialPoint();
}
- if(!ignoreCusp || (!Geom::are_near((*cubic)[2],in->first_segment()->finalPoint()) && weightValue !=0)){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[2],pointAt3)){
if(nodeIsSelected(pointAt3)){
pointAt2 = SBasisIn.valueAt(1-weightValue);
- pointAt2 = Geom::Point(pointAt2[X] + 0.0625,pointAt2[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ pointAt2 = Geom::Point(pointAt2[X] + 0.0001,pointAt2[Y] + 0.0001);
+ }
}else{
pointAt2 = (*cubic)[2];
}
@@ -480,16 +497,16 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
pointAt2 = in->first_segment()->finalPoint();
}
}else{
- if(!ignoreCusp && weightValue !=0){
+ if(!ignoreCusp && weightValue !=0.000){
if(nodeIsSelected(pointAt0)){
pointAt1 = SBasisIn.valueAt(weightValue);
- pointAt1 = Geom::Point(pointAt1[X] + 0.0625,pointAt1[Y] + 0.0625);
+ pointAt1 = Geom::Point(pointAt1[X] + 0.0001,pointAt1[Y] + 0.0001);
}else{
pointAt1 = in->first_segment()->initialPoint();
}
if(nodeIsSelected(pointAt3)){
pointAt2 = SBasisIn.valueAt(weightValue);
- pointAt2 = Geom::Point(pointAt2[X] + 0.0625,pointAt2[Y] + 0.0625);
+ pointAt2 = Geom::Point(pointAt2[X] + 0.0001,pointAt2[Y] + 0.0001);
}else{
pointAt2 = in->first_segment()->finalPoint();
}
@@ -520,24 +537,28 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
cubic = dynamic_cast<Geom::CubicBezier const*>(&*curve_it1);
if(!onlySelected){
if(cubic){
- if((!ignoreCusp || !Geom::are_near((*cubic)[1],out->first_segment()->initialPoint()))&& weightValue !=0){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[1],nextPointAt0)){
nextPointAt1 = SBasisOut.valueAt(weightValue);
- nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0625,nextPointAt1[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0001,nextPointAt1[Y] + 0.0001);
+ }
}else{
nextPointAt1 = out->first_segment()->initialPoint();
}
- if((!ignoreCusp || !Geom::are_near((*cubic)[2],out->first_segment()->finalPoint()))&& weightValue !=0){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[2],nextPointAt3)){
nextPointAt2 = SBasisOut.valueAt(1-weightValue);
- nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0625,nextPointAt2[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0001,nextPointAt2[Y] + 0.0001);
+ }
}else{
nextPointAt2 = out->first_segment()->finalPoint();
}
}else{
- if(!ignoreCusp && weightValue !=0){
+ if(!ignoreCusp && weightValue !=0.0000){
nextPointAt1 = SBasisOut.valueAt(weightValue);
- nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0625,nextPointAt1[Y] + 0.0625);
+ nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0001,nextPointAt1[Y] + 0.0001);
nextPointAt2 = SBasisOut.valueAt(1-weightValue);
- nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0625,nextPointAt2[Y] + 0.0625);
+ nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0001,nextPointAt2[Y] + 0.0001);
}else{
nextPointAt1 = out->first_segment()->initialPoint();
nextPointAt2 = out->first_segment()->finalPoint();
@@ -545,20 +566,24 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
}
}else{
if(cubic){
- if(!ignoreCusp || (!Geom::are_near((*cubic)[1],out->first_segment()->initialPoint()) && weightValue !=0)){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[1],nextPointAt0)){
if(nodeIsSelected(nextPointAt0)){
nextPointAt1 = SBasisOut.valueAt(weightValue);
- nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0625,nextPointAt1[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0001,nextPointAt1[Y] + 0.0001);
+ }
}else{
nextPointAt1 = (*cubic)[1];
}
}else{
nextPointAt1 = out->first_segment()->initialPoint();
}
- if(!ignoreCusp || (!Geom::are_near((*cubic)[2],out->first_segment()->finalPoint()) && weightValue !=0)){
+ if(!ignoreCusp || !Geom::are_near((*cubic)[2],nextPointAt3)){
if(nodeIsSelected(nextPointAt3)){
nextPointAt2 = SBasisOut.valueAt(1-weightValue);
- nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0625,nextPointAt2[Y] + 0.0625);
+ if(weightValue !=0.0000){
+ nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0001,nextPointAt2[Y] + 0.0001);
+ }
}else{
nextPointAt2 = (*cubic)[2];
}
@@ -566,16 +591,16 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
nextPointAt2 = out->first_segment()->finalPoint();
}
}else{
- if(!ignoreCusp && weightValue !=0){
+ if(!ignoreCusp && weightValue !=0.0000){
if(nodeIsSelected(nextPointAt0)){
nextPointAt1 = SBasisOut.valueAt(weightValue);
- nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0625,nextPointAt1[Y] + 0.0625);
+ nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0001,nextPointAt1[Y] + 0.0001);
}else{
nextPointAt1 = out->first_segment()->initialPoint();
}
if(nodeIsSelected(nextPointAt3)){
nextPointAt2 = SBasisOut.valueAt(weightValue);
- nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0625,nextPointAt2[Y] + 0.0625);
+ nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0001,nextPointAt2[Y] + 0.0001);
}else{
nextPointAt2 = out->first_segment()->finalPoint();
}
diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h
index 103f09338..510f9c989 100644
--- a/src/live_effects/lpe-bspline.h
+++ b/src/live_effects/lpe-bspline.h
@@ -37,6 +37,8 @@ public:
virtual void toDefaultWeight();
+ virtual void toMakeCusp();
+
virtual void toWeight();
ScalarParam steps;
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index c0fc908f0..181579fa2 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -656,7 +656,6 @@ static gint pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion cons
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint const tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
//"spiro_color" lo ejecutamos siempre sea o no spiro
- bspline_spiro_color(pc);
if (pen_within_tolerance) {
if ( Geom::LInfty( event_w - pen_drag_origin_w ) < tolerance) {
return FALSE; // Do not drag if we're within tolerance from origin.
@@ -781,6 +780,7 @@ static gint pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion cons
//BSpline
//Lanzamos la función "bspline_spiro_motion" al moverse el ratón o cuando se para.
if ( Geom::LInfty( event_w - pen_drag_origin_w ) > tolerance || mevent.time == 0) {
+ bspline_spiro_color(pc);
bspline_spiro_motion(pc,(mevent.state & GDK_SHIFT_MASK));
pen_drag_origin_w = event_w;
}
@@ -1452,31 +1452,48 @@ static void spdc_pen_set_angle_distance_status_message(SPPenContext *const pc, G
g_string_free(dist, FALSE);
}
-
-
//Esta función cambia los colores rojo,verde y azul haciendolos transparentes o no en función de si se usa spiro
static void bspline_spiro_color(SPPenContext *const pc)
{
+ bool remake_green_bpaths = false;
if(pc->spiro){
- pc->red_color = 0xffffff00;
- pc->green_color = 0xffffff00;
- pc->blue_color = 0x23abcdff;
- }else if (pc->bspline){
- pc->red_color = 0xe68024ff;
- pc->green_color = 0xe68024ff;
- pc->blue_color = 0x23abcdff;
- }else{
- pc->red_color = 0xe68024ff;
- pc->green_color = 0xf372ebff;
- pc->blue_color = 0x23abcdff;
- }
+ //If the colour is not defined as trasparent, por example when changing
+ //from drawing to spiro mode or when selecting the pen tool
+ if(pc->green_color != 0x00ff000){
+ //We change the green and red colours to transparent, so this lines are not necessary
+ //to the drawing with spiro
+ pc->red_color = 0x00ff000;
+ pc->green_color = 0x00ff000;
+ pc->blue_color = 0x23abcdff;
+ remake_green_bpaths = true;
+ }
+ }else if(pc->bspline){
+ //If we come from working with the spiro curve and change the mode the "green_curve" colour is transparent
+ if(pc->green_color != 0xe68024ff){
+ //since we are not im spiro mode, we assign the original colours
+ //to the red and the green curve, removing their transparency
+ pc->red_color = 0xe68024ff;
+ pc->green_color = 0xe68024ff;
+ pc->blue_color = 0x23abcdff;
+ remake_green_bpaths = true;
+ }
//we hide the spiro/bspline rests
+ }else{
+ if(pc->green_color != 0xf372ebff){
+ //since we are not im spiro mode, we assign the original colours
+ //to the red and the green curve, removing their transparency
+ pc->red_color = 0xe68024ff;
+ pc->green_color = 0xf372ebff;
+ pc->blue_color = 0x23abcdff;
+ remake_green_bpaths = true;
+ }
+ }
if(!pc->bspline){
sp_canvas_item_hide(pc->blue_bpath);
}
//We erase all the "green_bpaths" to recreate them after with the colour
//transparency recently modified
- if (pc->green_bpaths) {
+ if (pc->green_bpaths && remake_green_bpaths) {
// remove old piecewise green canvasitems
while (pc->green_bpaths) {
sp_canvas_item_destroy(SP_CANVAS_ITEM(pc->green_bpaths->data));
@@ -1491,6 +1508,7 @@ static void bspline_spiro_color(SPPenContext *const pc)
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->red_bpath), pc->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
}
+
static void bspline_spiro(SPPenContext *const pc, bool shift)
{
if(!pc->spiro && !pc->bspline)
@@ -1511,7 +1529,7 @@ static void bspline_spiro_on(SPPenContext *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.0625,pc->p[2][Y] + 0.0625);
+ pc->p[2] = Geom::Point(pc->p[2][X] + 0.0001,pc->p[2][Y] + 0.0001);
}
}
@@ -1552,7 +1570,7 @@ static void bspline_spiro_start_anchor_on(SPPenContext *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.0625,C[Y] + 0.0625);
+ C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001);
if(cubic){
lastSeg->moveto(A);
lastSeg->curveto((*cubic)[1],C,D);
@@ -1637,7 +1655,7 @@ static void bspline_spiro_motion(SPPenContext *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.0625,pc->p[1][Y] + 0.0625);
+ pc->p[1] = Geom::Point(pc->p[1][X] + 0.0001,pc->p[1][Y] + 0.0001);
}else{
pc->p[1] = (*cubic)[3] + (Geom::Point)((*cubic)[3] - (*cubic)[2] );
}
@@ -1662,7 +1680,7 @@ static void bspline_spiro_end_anchor_on(SPPenContext *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.0625,pc->p[2][Y] + 0.0625);
+ pc->p[2] = Geom::Point(pc->p[2][X] + 0.0001,pc->p[2][Y] + 0.0001);
SPCurve *tmpCurve = new SPCurve();
SPCurve *lastSeg = new SPCurve();
Geom::Point C(0,0);
@@ -1671,7 +1689,7 @@ static void bspline_spiro_end_anchor_on(SPPenContext *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.0625,C[Y] + 0.0625);
+ C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001);
}else{
C = pc->p[3] + (Geom::Point)(pc->p[3] - pc->p[2] );
}
@@ -1700,7 +1718,7 @@ static void bspline_spiro_end_anchor_on(SPPenContext *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.0625,C[Y] + 0.0625);
+ C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001);
}else{
C = pc->p[3] + (Geom::Point)(pc->p[3] - pc->p[2] );
}
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index a7fa5e111..304f81890 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -766,9 +766,9 @@ interpolate(SPPencilContext *pc)
//Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc
if(mode == 2){
Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]);
- BP = Geom::Point(BP[X] + 0.0625,BP[Y] + 0.0625);
+ BP = Geom::Point(BP[X] + 0.0001,BP[Y] + 0.0001);
Geom::Point CP = b[4*c+3] + (1./3)*(b[4*c+0] - b[4*c+3]);
- CP = Geom::Point(CP[X] + 0.0625,CP[Y] + 0.0625);
+ CP = Geom::Point(CP[X] + 0.0001,CP[Y] + 0.0001);
pc->green_curve->curveto(BP,CP,b[4*c+3]);
}else{
pc->green_curve->curveto(b[4*c+1], b[4*c+2], b[4*c+3]);
@@ -922,9 +922,9 @@ fit_and_split(SPPencilContext *pc)
guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0);
if(mode == 2){
Geom::Point B = b[0] + (1./3)*(b[3] - b[0]);
- B = Geom::Point(B[X] + 0.0625,B[Y] + 0.0625);
+ B = Geom::Point(B[X] + 0.0001,B[Y] + 0.0001);
Geom::Point C = b[3] + (1./3)*(b[0] - b[3]);
- C = Geom::Point(C[X] + 0.0625,C[Y] + 0.0625);
+ C = Geom::Point(C[X] + 0.0001,C[Y] + 0.0001);
pc->red_curve->curveto(B,C,b[3]);
}else{
pc->red_curve->curveto(b[1], b[2], b[3]);
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 8f1c37649..011d0d296 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -146,10 +146,8 @@ void Handle::move(Geom::Point const &new_pos)
Set &nodes = _parent->_selection.allPoints();
for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) {
Node *n = static_cast<Node*>(*i);
- if(n != _parent)
- _parent->_selection.erase(n);
+ _parent->_selection.erase(n);
}
- if(!_parent->selected())
_parent->_selection.insert(_parent);
}
//BSpline End
@@ -187,8 +185,8 @@ void Handle::move(Geom::Point const &new_pos)
//BSpline
if(_pm().isBSpline){
h = this;
- setPosition(_pm().BSplineHandleReposition(h));
_parent->bsplineWeight = _pm().BSplineHandlePosition(h);
+ setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight));
h2 = this->other();
this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight));
}
@@ -422,6 +420,16 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE);
}
sm.unSetup();
+ //BSpline
+ if(_pm().isBSpline){
+ Handle *h = NULL;
+ _parent->bsplineWeight = 0;
+ h = this;
+ setPosition(new_pos);
+ _parent->bsplineWeight = _pm().BSplineHandlePosition(h);
+ new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight);
+ }
+ //BSpline End
}
@@ -452,6 +460,7 @@ void Handle::ungrabbed(GdkEventButton *event)
Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position());
if (dist.length() <= drag_tolerance) {
move(_parent->position());
+ _parent->bsplineWeight = 0;
}
}
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 6cad60fee..9da27e807 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1204,14 +1204,14 @@ int PathManipulator::getSteps(){
double PathManipulator::BSplineHandlePosition(Handle *h){
using Geom::X;
using Geom::Y;
- double pos = 0;
+ double pos = 0.0000;
Node *n = h->parent();
SPCurve *lineInsideNodes = new SPCurve();
Node * nextNode = NULL;
if(!n->isEndNode())
nextNode = n->nodeToward(h);
Geom::Point positionH = h->position();
- positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625);
+ positionH = Geom::Point(positionH[X] + 0.0001,positionH[Y] + 0.0001);
if(nextNode && n->position() != h->position()){
lineInsideNodes->moveto(n->position());
lineInsideNodes->lineto(nextNode->position());
@@ -1235,12 +1235,12 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){
Node * nextNode = NULL;
if(!n->isEndNode())
nextNode = n->nodeToward(h);
- if(nextNode && pos != 0){
+ if(nextNode && pos != 0.0000){
lineInsideNodes->moveto(n->position());
lineInsideNodes->lineto(nextNode->position());
SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis();
ret = SBasisInsideNodes.valueAt(pos);
- ret = Geom::Point(ret[X] + 0.0625,ret[Y] + 0.0625);
+ ret = Geom::Point(ret[X] + 0.0001,ret[Y] + 0.0001);
}else{
ret = n->position();
}
@@ -1251,8 +1251,8 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){
if(n->selected()){
Node * nextNode = n->nodeToward(n->front());
Node * prevNode = n->nodeToward(n->back());
- double prevPos = 0;
- double nextPos = 0;
+ double prevPos = 0.0000;
+ double nextPos = 0.0000;
if(prevNode)
prevPos = BSplineHandlePosition(prevNode->front());
if(nextNode)