Skip to content

Commit d6c1af0

Browse files
committed
fix(webui): More fixes [copilot]
1 parent bffb157 commit d6c1af0

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

packages/webui/src/client/lib/viewPort.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,22 @@ export function maintainFocusOnPartInstance(
5050
noAnimation?: boolean
5151
): void {
5252
focusState.startTime = Date.now()
53+
viewPortScrollingState.isProgrammaticScrollInProgress = true
54+
viewPortScrollingState.lastProgrammaticScrollTime = Date.now()
5355

5456
const focus = async () => {
5557
// Only proceed if we're not already scrolling and within the time window
5658
if (!focusState.isScrolling && Date.now() - focusState.startTime < timeWindow) {
5759
focusState.isScrolling = true
60+
viewPortScrollingState.lastProgrammaticScrollTime = Date.now()
5861

5962
try {
6063
await scrollToPartInstance(partInstanceId, forceScroll, noAnimation)
6164
} catch (_error) {
6265
// Handle error if needed
6366
} finally {
6467
focusState.isScrolling = false
68+
viewPortScrollingState.lastProgrammaticScrollTime = Date.now()
6569
}
6670
} else if (Date.now() - focusState.startTime >= timeWindow) {
6771
quitFocusOnPart()
@@ -105,6 +109,11 @@ function quitFocusOnPart() {
105109
clearInterval(focusState.interval)
106110
focusState.interval = undefined
107111
}
112+
113+
if (!focusState.isScrolling) {
114+
viewPortScrollingState.isProgrammaticScrollInProgress = false
115+
viewPortScrollingState.lastProgrammaticScrollTime = Date.now()
116+
}
108117
}
109118

110119
export function resetViewportScrollState(): void {

packages/webui/src/client/ui/RundownView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ const RundownViewContent = translateWithTracker<IPropsWithReady & ITrackedProps,
669669

670670
// Check if segment is outside the comfortable viewing area
671671
const segmentComponentTooHigh = offsetPosition.top < topBuffer
672-
const segmentComponentTooLow = offsetPosition.bottom < bottomBuffer
672+
const segmentComponentTooLow = offsetPosition.top > bottomBuffer
673673

674674
if (segmentComponentTooHigh || segmentComponentTooLow) {
675675
// Only change state if we need to

0 commit comments

Comments
 (0)