From 6473cc7cb431abe71721341c550130e61cf64aa1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 4 Nov 2013 11:56:10 -0500 Subject: drop use of bounding box to determine whether an item covers a point; add Item::covers(Duple const&) Default implementation for Item still uses bounding box, but specializations for Arc (Circle), Polygon, Line and PolyLine have been added --- libs/canvas/arrow.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libs/canvas/arrow.cc') diff --git a/libs/canvas/arrow.cc b/libs/canvas/arrow.cc index f82f2d96de..55f5173253 100644 --- a/libs/canvas/arrow.cc +++ b/libs/canvas/arrow.cc @@ -221,3 +221,20 @@ Arrow::set_color (Color color) _heads[i].polygon->set_fill_color (color); } } + +bool +Arrow::covers (Duple const & point) const +{ + if (_heads[0].polygon && _heads[0].polygon->covers (point)) { + return true; + } + if (_line && _line->covers (point)) { + return true; + } + + if (_heads[1].polygon && _heads[1].polygon->covers (point)) { + return true; + } + + return false; +} -- cgit v1.2.3