Skip to content

Commit 0a3765a

Browse files
committed
fixed time cursor offset bug after running a simulation
1 parent e721372 commit 0a3765a

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

frontend/src/charts/modifiers/SharedTimeCursorModifier.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class SharedTimeCursorModifier extends ChartModifierBase2D {
5050
super.modifierMouseMove(args)
5151
const time = this._timeFromMouse()
5252
if (time !== undefined) {
53+
this._userDriven = true
5354
this._showCursorAt(time)
5455
this.onTimeChanged?.(time)
5556
}
@@ -61,6 +62,7 @@ export class SharedTimeCursorModifier extends ChartModifierBase2D {
6162

6263
/** Programmatically move the cursor to a given time value. */
6364
setCursorTime(time: number): void {
65+
this._userDriven = false
6466
this._showCursorAt(time)
6567
}
6668

@@ -79,11 +81,14 @@ export class SharedTimeCursorModifier extends ChartModifierBase2D {
7981

8082
/** Called when subchart visibility changes, to move the label to the new bottom chart. */
8183
onSubChartVisibilityChanged(): void {
82-
this._showCursorAt(this._lastTime)
84+
if (this._userDriven) {
85+
this._showCursorAt(this._lastTime)
86+
}
8387
}
8488

8589
/** Hide all cursor lines and labels. */
8690
hideCursor(): void {
91+
this._userDriven = false
8792
for (const line of this.xLines.values()) line.isHidden = true
8893
this._deleteLabel()
8994
}
@@ -105,12 +110,14 @@ export class SharedTimeCursorModifier extends ChartModifierBase2D {
105110
// ---- internals ----
106111

107112
private _lastTime = 0
113+
/** True once the user has moved the mouse over the chart, driving the cursor position. */
114+
private _userDriven = false
108115

109116
/** Resolve the data-space time from the current mouse position. */
110117
private _timeFromMouse(): number | undefined {
111118
if (!this.mousePoint) return undefined
112119

113-
for (const sc of this.group.allSurfaces) {
120+
for (const sc of this.group.visibleSurfaces) {
114121
const pt = translateFromCanvasToSeriesViewRect(this.mousePoint, sc.seriesViewRect)
115122
if (pt) {
116123
const calc = sc.xAxes.get(0).getCurrentCoordinateCalculator()

tauri-app/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"app": {
1919
"windows": [
2020
{
21-
"title": "Gene Regulatory Systems",
21+
"title": "",
2222
"width": 1920,
2323
"height": 1080,
2424
"minWidth": 800,

0 commit comments

Comments
 (0)