Always set marker y-pos even if we're tracking its x-pos

history_view
Tyler Goodlet 2022-09-19 14:05:58 -04:00
parent fd8c05e024
commit 7c6d12d982
1 changed files with 20 additions and 19 deletions

View File

@ -350,7 +350,7 @@ class LevelLine(pg.InfiniteLine):
from pg.. from pg..
''' '''
# p.setRenderHint(p.Antialiasing) p.setRenderHint(p.Antialiasing)
# these are in viewbox coords # these are in viewbox coords
vb_left, vb_right = self._endPoints vb_left, vb_right = self._endPoints
@ -378,14 +378,14 @@ class LevelLine(pg.InfiniteLine):
elif self._marker: elif self._marker:
if self.track_marker_pos: if self.track_marker_pos:
# make the line end at the marker's x pos # make the line end at the marker's x pos
line_end = self._marker.pos().x() line_end = marker_right = self._marker.pos().x()
else:
# TODO: make this label update part of a scene-aware-marker # TODO: make this label update part of a scene-aware-marker
# composed annotation # composed annotation
self._marker.setPos( self._marker.setPos(
QPointF(marker_right, self.scene_y()) QPointF(marker_right, self.scene_y())
) )
if hasattr(self._marker, 'label'): if hasattr(self._marker, 'label'):
self._marker.label.update() self._marker.label.update()
@ -407,16 +407,14 @@ class LevelLine(pg.InfiniteLine):
def hide(self) -> None: def hide(self) -> None:
super().hide() super().hide()
if self._marker: mkr = self._marker
self._marker.hide() if mkr:
# needed for ``order_line()`` lines currently mkr.hide()
self._marker.label.hide()
def show(self) -> None: def show(self) -> None:
super().show() super().show()
if self._marker: if self._marker:
self._marker.show() self._marker.show()
# self._marker.label.show()
def scene_y(self) -> float: def scene_y(self) -> float:
return self.getViewBox().mapFromView( return self.getViewBox().mapFromView(
@ -461,8 +459,10 @@ class LevelLine(pg.InfiniteLine):
cur = self._chart.linked.cursor cur = self._chart.linked.cursor
# hovered # hovered
if (not ev.isExit()) and ev.acceptDrags(QtCore.Qt.LeftButton): if (
not ev.isExit()
and ev.acceptDrags(QtCore.Qt.LeftButton)
):
# if already hovered we don't need to run again # if already hovered we don't need to run again
if self.mouseHovering is True: if self.mouseHovering is True:
return return
@ -765,7 +765,8 @@ def order_line(
if action != 'alert': if action != 'alert':
# add a partial position label if we also added a level marker # add a partial position label if we also added a level
# marker
pp_size_label = Label( pp_size_label = Label(
view=view, view=view,
color=line.color, color=line.color,
@ -799,9 +800,9 @@ def order_line(
# XXX: without this the pp proportion label next the marker # XXX: without this the pp proportion label next the marker
# seems to lag? this is the same issue we had with position # seems to lag? this is the same issue we had with position
# lines which we handle with ``.update_graphcis()``. # lines which we handle with ``.update_graphcis()``.
# marker._on_paint=lambda marker: pp_size_label.update()
marker._on_paint = lambda marker: pp_size_label.update() marker._on_paint = lambda marker: pp_size_label.update()
# XXX: THIS IS AN UNTYPED MONKEY PATCH!?!?!
marker.label = label marker.label = label
# sanity check # sanity check