From 28f85747ca2130aeb381d460a828e6ccd0236ddd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 8 Jul 2020 21:49:31 -0600 Subject: [PATCH] Canvas: fix behavior of Rectangle when used in a constraint packer ::size_allocate() sets the _position *and* the "self" rect appropriately --- libs/canvas/rectangle.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc index 760ac6efb0..174a2d626a 100644 --- a/libs/canvas/rectangle.cc +++ b/libs/canvas/rectangle.cc @@ -288,12 +288,15 @@ Rectangle::vertical_fraction (double y) const void Rectangle::size_allocate (Rect const & r) { - /* leave position alone */ - _allocation = r; if (_layout_sensitive) { - set (r); + /* set position, and then set the _rect member with values that + use _position as the origin. + */ + _position = Duple (r.x0, r.y0); + Rect r2 (0, 0, r.x1 - r.x0, r.y1 - r.y0); + set (r2); } } @@ -306,3 +309,4 @@ Rectangle::set_corner_radius (double r) _corner_radius = r; end_change (); } +