summaryrefslogtreecommitdiffstats
path: root/src/shape-editor.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-09-08 22:20:36 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-09-08 22:20:36 +0000
commitb7b17f36b9e3d2814dcf0f4db1fb329976c2e85a (patch)
tree7d9c97f8bd561cd70afd0fe44e507a6e4f91dfd3 /src/shape-editor.cpp
parentadd missing #include for gtk version check (diff)
downloadinkscape-b7b17f36b9e3d2814dcf0f4db1fb329976c2e85a.tar.gz
inkscape-b7b17f36b9e3d2814dcf0f4db1fb329976c2e85a.zip
2geom update (rev. 1578); fixes node editing of some degenerate paths
(bzr r6784)
Diffstat (limited to 'src/shape-editor.cpp')
-rw-r--r--src/shape-editor.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index f7aefdabe..32c20ace6 100644
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
@@ -366,9 +366,13 @@ bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) {
SPCurve *curve = this->nodepath->curve; // not sure if np->curve is always up to date...
Geom::PathVector const &pathv = curve->get_pathvector();
- Geom::PathVectorPosition pvpos = Geom::nearestPoint(pathv, this->curvepoint_doc);
+ boost::optional<Geom::PathVectorPosition> pvpos = Geom::nearestPoint(pathv, this->curvepoint_doc);
+ if (!pvpos) {
+ g_print("Warning! Possible error?\n");
+ return false;
+ }
- NR::Point nearest = pathv[pvpos.path_nr].pointAt(pvpos.t);
+ NR::Point nearest = pathv[pvpos->path_nr].pointAt(pvpos->t);
NR::Point delta = nearest - this->curvepoint_doc;
delta = desktop->d2w(delta);
@@ -385,9 +389,9 @@ bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) {
if (remember && close) {
// calculate index for nodepath's representation.
double int_part;
- double t = std::modf(pvpos.t, &int_part);
+ double t = std::modf(pvpos->t, &int_part);
unsigned int segment_index = (unsigned int)int_part + 1;
- for (unsigned int i = 0; i < pvpos.path_nr; ++i) {
+ for (unsigned int i = 0; i < pvpos->path_nr; ++i) {
segment_index += pathv[i].size() + 1;
if (pathv[i].closed())
segment_index += 1;