Sync the replay chart cursor from every subplot, not only FN
Each subplot carries its own copy of the shared time cursor, but the drag handler always read the first copy's value, so dragging FX or FY re-read FN's unchanged position and returned without moving the others. The handler now uses the line the signal names. Verified by dragging all three cursors in the offscreen UI test and by the full studio suite (569 tests, 0 failed).
This commit is contained in:
@@ -1027,11 +1027,23 @@ class ForcePlotsPanel(QFrame):
|
||||
for cursor in self.cursors:
|
||||
cursor.setMovable(bool(browsing))
|
||||
|
||||
def _on_cursor_dragged(self) -> None:
|
||||
"""The shared cursor is a timeline control while browsing."""
|
||||
def _on_cursor_dragged(self, cursor=None) -> None:
|
||||
"""The shared cursor is a timeline control while browsing.
|
||||
|
||||
Each subplot carries its own copy of the same cursor and any of them can be
|
||||
dragged, so the signal names the one that moved. Reading ``cursors[0]`` instead
|
||||
made only the first subplot work: dragging FX or FY re-read FN's already-current
|
||||
value, judged it unchanged and returned, leaving the other two subplots behind.
|
||||
"""
|
||||
if self._syncing or self._mode != "browse":
|
||||
return
|
||||
value = float(self.cursors[0].value())
|
||||
# ``sigPositionChanged`` emits the line that moved; ``sender()`` covers a
|
||||
# pyqtgraph that emits no argument. A direct call with neither falls back to the
|
||||
# first subplot, which is the only cursor a caller could mean.
|
||||
line = cursor if cursor is not None else self.sender()
|
||||
if line is None:
|
||||
line = self.cursors[0]
|
||||
value = float(line.value())
|
||||
if value == self._cursor_t:
|
||||
return
|
||||
self.pause_playback()
|
||||
|
||||
Reference in New Issue
Block a user