summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-06 18:43:09 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-06 18:43:09 +0000
commitb7c253a177de4edc08593676647d0c9d1c9f5206 (patch)
tree8d4fc47028de23246be1eed3d2ada5cf72716be4 /src/ui
parentI'm an idiot (diff)
parentUpdate to trunk r13497 (diff)
downloadinkscape-b7c253a177de4edc08593676647d0c9d1c9f5206.tar.gz
inkscape-b7c253a177de4edc08593676647d0c9d1c9f5206.zip
Update to experimental r13460
(bzr r13090.1.98)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/tool/path-manipulator.cpp6
-rw-r--r--src/ui/tools/node-tool.cpp13
-rw-r--r--src/ui/tools/node-tool.h2
-rw-r--r--src/ui/tools/pen-tool.cpp16
4 files changed, 24 insertions, 13 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/node-tool.cpp b/src/ui/tools/node-tool.cpp
index f7e232d36..e675df871 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -19,6 +19,7 @@
#include "display/curve.h"
#include "display/sp-canvas.h"
#include "document.h"
+#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
#include "message-context.h"
#include "selection.h"
@@ -168,6 +169,9 @@ NodeTool::~NodeTool() {
if (this->flash_tempitem) {
this->desktop->remove_temporary_canvasitem(this->flash_tempitem);
}
+ if (this->helperpath_tmpitem) {
+ this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
+ }
if (this->helperpath_tmpitem) {
this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
@@ -252,6 +256,7 @@ void NodeTool::setup() {
)))
);
+ this->helperpath_tmpitem = NULL;
this->cursor_drag = false;
this->show_transform_handles = true;
this->single_node_transform_handles = false;
@@ -288,12 +293,15 @@ void NodeTool::setup() {
this->update_helperpath();
}
-void NodeTool::update_helperpath(){
+// show helper paths of the applied LPE, if any
+void NodeTool::update_helperpath () {
Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+
if (this->helperpath_tmpitem) {
this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
this->helperpath_tmpitem = NULL;
}
+
if (SP_IS_LPE_ITEM(selection->singleItem())) {
Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE();
if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) {
@@ -310,7 +318,7 @@ void NodeTool::update_helperpath(){
c->transform(selection->singleItem()->i2dt_affine());
SPCanvasItem *helperpath = sp_canvas_bpath_new(sp_desktop_tempgroup(this->desktop), c);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath),
- 0x0000ff9A, 1.0,
+ 0x0000ff9A, 1.0,
SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO);
this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath,0);
@@ -474,6 +482,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
switch (event->type)
{
case GDK_MOTION_NOTIFY: {
+ this->update_helperpath();
combine_motion_events(desktop->canvas, event->motion, 0);
this->update_helperpath();
SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button),
diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h
index 9f0c40aa8..ab72f3632 100644
--- a/src/ui/tools/node-tool.h
+++ b/src/ui/tools/node-tool.h
@@ -66,8 +66,8 @@ private:
sigc::connection _sizeUpdatedConn;
SPItem *flashed_item;
- Inkscape::Display::TemporaryItem *flash_tempitem;
Inkscape::Display::TemporaryItem *helperpath_tmpitem;
+ Inkscape::Display::TemporaryItem *flash_tempitem;
Inkscape::UI::Selector* _selector;
Inkscape::UI::PathSharedData* _path_data;
SPCanvasGroup *_transform_handle_group;
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];
}