summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/gradient-tool.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-10 04:07:19 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-10 04:07:19 +0000
commit3511d63cc7b04e5fc5ae0ff8de616f0594c5dbcb (patch)
tree098a9224d7da89f11ac1936174b71a3f2cabd643 /src/ui/tools/gradient-tool.cpp
parentOops (diff)
downloadinkscape-3511d63cc7b04e5fc5ae0ff8de616f0594c5dbcb.tar.gz
inkscape-3511d63cc7b04e5fc5ae0ff8de616f0594c5dbcb.zip
Get gradient tool to shut up about invalid casts with meshes
(bzr r13341.1.131)
Diffstat (limited to 'src/ui/tools/gradient-tool.cpp')
-rw-r--r--src/ui/tools/gradient-tool.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index a0bbfbaf1..4f9a7b59b 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -213,17 +213,20 @@ sp_gradient_context_is_over_line (GradientTool *rc, SPItem *item, Geom::Point ev
//Translate mouse point into proper coord system
rc->mousepoint_doc = desktop->w2d(event_p);
- SPCtrlLine* line = SP_CTRLLINE(item);
+ if (SP_IS_CTRLLINE(item)) {
+ SPCtrlLine* line = SP_CTRLLINE(item);
- Geom::LineSegment ls(line->s, line->e);
- Geom::Point nearest = ls.pointAt(ls.nearestPoint(rc->mousepoint_doc));
- double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom();
+ Geom::LineSegment ls(line->s, line->e);
+ Geom::Point nearest = ls.pointAt(ls.nearestPoint(rc->mousepoint_doc));
+ double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom();
- double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance;
+ double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance;
- bool close = (dist_screen < tolerance);
+ bool close = (dist_screen < tolerance);
- return close;
+ return close;
+ }
+ return false;
}
static std::vector<Geom::Point>