Support hiding only "half" the xhair
parent
e1dc2b9225
commit
2c7d8cdbb0
|
@ -380,17 +380,19 @@ class Cursor(pg.GraphicsObject):
|
||||||
# px perfect...
|
# px perfect...
|
||||||
line_offset = self._lw / 2
|
line_offset = self._lw / 2
|
||||||
|
|
||||||
|
# update y-range items
|
||||||
if iy != last_iy:
|
if iy != last_iy:
|
||||||
|
|
||||||
# update y-range items
|
|
||||||
self.graphics[plot]['hl'].setY(iy + line_offset)
|
|
||||||
|
|
||||||
if self._y_label_update:
|
if self._y_label_update:
|
||||||
self.graphics[self.active_plot]['yl'].update_label(
|
self.graphics[self.active_plot]['yl'].update_label(
|
||||||
abs_pos=plot.mapFromView(QPointF(ix, iy + line_offset)),
|
abs_pos=plot.mapFromView(QPointF(ix, iy + line_offset)),
|
||||||
value=iy
|
value=iy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# only update horizontal xhair line if label is enabled
|
||||||
|
self.graphics[plot]['hl'].setY(iy + line_offset)
|
||||||
|
|
||||||
|
|
||||||
# update all trackers
|
# update all trackers
|
||||||
for item in self._trackers:
|
for item in self._trackers:
|
||||||
# print(f'setting {item} with {(ix, y)}')
|
# print(f'setting {item} with {(ix, y)}')
|
||||||
|
@ -451,11 +453,16 @@ class Cursor(pg.GraphicsObject):
|
||||||
self,
|
self,
|
||||||
hide_label: bool = False,
|
hide_label: bool = False,
|
||||||
y_label_level: float = None,
|
y_label_level: float = None,
|
||||||
|
just_vertical: bool = False,
|
||||||
fg_color: str = None,
|
fg_color: str = None,
|
||||||
# bg_color: str = 'papas_special',
|
# bg_color: str = 'papas_special',
|
||||||
) -> None:
|
) -> None:
|
||||||
g = self.graphics[self.active_plot]
|
g = self.graphics[self.active_plot]
|
||||||
g['hl'].hide()
|
|
||||||
|
hl = g['hl']
|
||||||
|
if not just_vertical:
|
||||||
|
hl.hide()
|
||||||
|
|
||||||
g['vl'].hide()
|
g['vl'].hide()
|
||||||
|
|
||||||
# only disable cursor y-label updates
|
# only disable cursor y-label updates
|
||||||
|
@ -467,6 +474,7 @@ class Cursor(pg.GraphicsObject):
|
||||||
|
|
||||||
elif y_label_level:
|
elif y_label_level:
|
||||||
yl.update_from_data(0, y_label_level, _save_last=False)
|
yl.update_from_data(0, y_label_level, _save_last=False)
|
||||||
|
hl.setY(y_label_level)
|
||||||
|
|
||||||
if fg_color is not None:
|
if fg_color is not None:
|
||||||
yl.fg_color = pg.mkColor(hcolor(fg_color))
|
yl.fg_color = pg.mkColor(hcolor(fg_color))
|
||||||
|
|
Loading…
Reference in New Issue