Skip to content

Commit

Permalink
Facepalm, align overlay plot view exactly to parent
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
goodboy committed Feb 11, 2023
1 parent e6abc03 commit d4262c9
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions piker/ui/_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,19 @@ def insert_plotitem(
axis_view = axis.linkedView()
assert axis_view is plotitem.vb

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
# 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
# ):
# 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
Expand Down Expand Up @@ -498,10 +499,10 @@ def broadcast(
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)

Expand Down

0 comments on commit d4262c9

Please sign in to comment.