Hide y-label on level line mouse over

basic_orders
Tyler Goodlet 2021-02-11 23:41:40 -05:00
parent bf78c13df4
commit aec8f1d25c
2 changed files with 11 additions and 3 deletions

View File

@ -141,6 +141,7 @@ class FastAppendCurve(pg.PlotCurveItem):
w = hb_size.width() + 1 w = hb_size.width() + 1
h = hb_size.height() + 1 h = hb_size.height() + 1
br = QtCore.QRectF( br = QtCore.QRectF(
# top left # top left

View File

@ -490,6 +490,7 @@ class LevelLine(pg.InfiniteLine):
cur = chart._cursor cur = chart._cursor
cur.add_hovered(self) cur.add_hovered(self)
cur.graphics[chart]['yl'].hide() cur.graphics[chart]['yl'].hide()
cur.graphics[chart]['hl'].hide()
for at, label in self._labels: for at, label in self._labels:
label.show() label.show()
@ -504,7 +505,10 @@ class LevelLine(pg.InfiniteLine):
cur = chart._cursor cur = chart._cursor
cur._hovered.remove(self) cur._hovered.remove(self)
cur.graphics[chart]['yl'].show() if self not in cur._trackers:
g = cur.graphics[chart]
g['yl'].show()
g['hl'].show()
if not self._always_show_labels: if not self._always_show_labels:
for at, label in self._labels: for at, label in self._labels:
@ -519,7 +523,9 @@ class LevelLine(pg.InfiniteLine):
chart = self._chart chart = self._chart
# hide y-crosshair # hide y-crosshair
chart._cursor.graphics[chart]['hl'].hide() graphics = chart._cursor.graphics[chart]
graphics['hl'].hide()
graphics['yl'].hide()
# highlight # highlight
self.currentPen = self.hoverPen self.currentPen = self.hoverPen
@ -534,7 +540,8 @@ class LevelLine(pg.InfiniteLine):
# This is the final position in the drag # This is the final position in the drag
if ev.isFinish(): if ev.isFinish():
# show y-crosshair again # show y-crosshair again
chart._cursor.graphics[chart]['hl'].show() graphics['hl'].show()
graphics['yl'].show()
def delete(self) -> None: def delete(self) -> None:
"""Remove this line from containing chart/view/scene. """Remove this line from containing chart/view/scene.