From 5b66c6cad66db88b9484616b1324eda8cd999da5 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Sat, 2 Apr 2022 10:58:02 -0700 Subject: [PATCH] Fix timeline recentering after manual scroll --- src/components/thumbnail.ts | 1 + src/components/timeline.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/thumbnail.ts b/src/components/thumbnail.ts index b802d673..b2813089 100644 --- a/src/components/thumbnail.ts +++ b/src/components/thumbnail.ts @@ -91,6 +91,7 @@ export class FrigateCardThumbnail extends LitElement { view: 'timeline', target: this.target, childIndex: this.childIndex, + context: {}, }) .dispatchChangeEvent(this); }} diff --git a/src/components/timeline.ts b/src/components/timeline.ts index f13bfedb..db9971db 100644 --- a/src/components/timeline.ts +++ b/src/components/timeline.ts @@ -604,11 +604,13 @@ export class FrigateCardTimelineCore extends LitElement { ? (this.view.context as TimelineViewContext) : undefined; - if (context && !isEqual(context.window, timelineWindow)) { + if (context?.window) { console.info( `Setting window from context (${context.window.start} -> ${context.window.end}`, ); - this._timeline.setWindow(context.window.start, context.window.end); + if (!isEqual(context.window, timelineWindow)) { + this._timeline.setWindow(context.window.start, context.window.end); + } } else if ( eventStart < timelineWindow.start || eventStart > timelineWindow.end ||