From fd1fd8d49b67970010253b3f7345528e29dfb06b Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 11 Feb 2023 15:36:02 -0500 Subject: [PATCH] Facepalm, align overlay plot view exactly to parent Previously we were aligning the child's `PlotItem` to the "root" (top most) overlays `ViewBox`..smh. This is why there was a weird gap on the LHS next to the 'left' price axes: something weird in the implied axes offsets was getting jammed in that rect. Also comments out "the-skipping-of" moving axes from the overlay's `PlotItem.layout` to the root's linear layout(s) when an overlay's axis is read as not visible; this isn't really necessary nor useful and if we want to remove the axes entirely we should do it explicitly and/or provide a way through the `ComposeGridLayout` API. --- piker/ui/_overlay.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/piker/ui/_overlay.py b/piker/ui/_overlay.py index ad11c5e4..6b2d1bd5 100644 --- a/piker/ui/_overlay.py +++ b/piker/ui/_overlay.py @@ -201,18 +201,19 @@ class ComposedGridLayout: axis_view = axis.linkedView() assert axis_view is plotitem.vb - if ( - not axis.isVisible() + # if ( + # not axis.isVisible() - # XXX: we never skip moving the axes for the *root* - # plotitem inserted (even if not shown) since we need to - # move all the hidden axes into linear sub-layouts for - # that "central" plot in the overlay. Also if we don't - # do it there's weird geomoetry calc offsets that make - # view coords slightly off somehow .. smh - and not len(self.pitems) == 0 - ): - continue + # # XXX: we never skip moving the axes for the *root* + # # plotitem inserted (even if not shown) since we need to + # # move all the hidden axes into linear sub-layouts for + # # that "central" plot in the overlay. Also if we don't + # # do it there's weird geomoetry calc offsets that make + # # view coords slightly off somehow .. smh + # and not len(self.pitems) == 0 + # ): + # print(f'SKIPPING MOVE: {plotitem.name}:{name} -> {axis}') + # continue # invert insert index for layouts which are # not-left-to-right, top-to-bottom insert oriented @@ -498,10 +499,10 @@ class PlotItemOverlay: else: insert_index, axes = self.layout.insert_plotitem(index, plotitem) - plotitem.setGeometry(root.vb.sceneBoundingRect()) + plotitem.vb.setGeometry(root.vb.sceneBoundingRect()) def size_to_viewbox(vb: 'ViewBox'): - plotitem.setGeometry(vb.sceneBoundingRect()) + plotitem.vb.setGeometry(root.vb.sceneBoundingRect()) root.vb.sigResized.connect(size_to_viewbox)