summaryrefslogtreecommitdiff
path: root/libs/canvas/arrow.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-01-16 22:04:26 -0500
committerDavid Robillard <d@drobilla.net>2015-01-16 22:04:26 -0500
commitfc70b5a9f92a501053658c90c0a7af26deb9d74d (patch)
tree3c10fb4a0c6a394a6f9abb99be6da0274069fc14 /libs/canvas/arrow.cc
parent8f823388d9bd5aa8e297ab05be8c9fb323518945 (diff)
Compute arrow bbox manually to appease crazy canvas.
Diffstat (limited to 'libs/canvas/arrow.cc')
-rw-r--r--libs/canvas/arrow.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/canvas/arrow.cc b/libs/canvas/arrow.cc
index 92a795c954..d78b04ef58 100644
--- a/libs/canvas/arrow.cc
+++ b/libs/canvas/arrow.cc
@@ -63,6 +63,23 @@ Arrow::setup ()
CANVAS_DEBUG_NAME (_line, "arrow line");
}
+void
+Arrow::compute_bounding_box () const
+{
+ /* Compute our bounding box manually rather than using the default
+ container algorithm, since having the bounding box with origin other
+ than zero causes strange problems for mysterious reasons. */
+
+ const double outline_pad = 0.5 + (_line->outline_width() / 2.0);
+ const double head_width = std::max(_heads[0].width, _heads[1].width);
+
+ _bounding_box = Rect(0,
+ 0,
+ _line->x1() + (head_width / 2.0) + outline_pad,
+ _line->y1());
+
+ _bounding_box_dirty = false;
+}
/** Set whether to show an arrow head at one end or other
* of the line.