Skip to content

Commit 0923906

Browse files
authored
Merge pull request #1429 from bbc/upstream/fix-prompter-slow-after-bootstrap
2 parents 15f5aa2 + d35fa37 commit 0923906

File tree

7 files changed

+19
-13
lines changed

7 files changed

+19
-13
lines changed

packages/webui/src/client/ui/Prompter/PrompterView.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ export class PrompterViewContent extends React.Component<Translated<IProps & ITr
369369
this._lastAnimation = animate(window.scrollY, scrollToPosition, {
370370
duration: 0.4,
371371
ease: 'easeOut',
372-
onUpdate: (latest) => window.scrollTo({ left: 0, top: latest, behavior: 'instant' }),
372+
onUpdate: (latest: number) =>
373+
window.scrollTo({
374+
top: latest,
375+
behavior: 'instant',
376+
}),
373377
})
374378
}
375379
listAnchorPositions(startY: number, endY: number, sortDirection = 1): [number, Element][] {
@@ -810,6 +814,7 @@ const PrompterContent = withTranslation()(
810814

811815
window.scrollBy({
812816
top: top - scrollAnchor.offset,
817+
behavior: 'instant',
813818
})
814819
// We've scrolled, exit the function!
815820
return
@@ -821,6 +826,7 @@ const PrompterContent = withTranslation()(
821826
// the css margins magically does it for us.
822827
window.scrollBy({
823828
top: top - readPosition,
829+
behavior: 'instant',
824830
})
825831
// We've scrolled, exit the function!
826832
return

packages/webui/src/client/ui/Prompter/controller/joycon-device.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class JoyConController extends ControllerAbstract {
126126
break
127127
case '2':
128128
// go to top
129-
window.scrollTo(0, 0)
129+
window.scrollTo({ top: 0, behavior: 'instant' })
130130
break
131131
case '3':
132132
// go to following
@@ -152,7 +152,7 @@ export class JoyConController extends ControllerAbstract {
152152
break
153153
case '1':
154154
// go to top
155-
window.scrollTo(0, 0)
155+
window.scrollTo({ top: 0, behavior: 'instant' })
156156
break
157157
case '0':
158158
// go to following
@@ -183,7 +183,7 @@ export class JoyConController extends ControllerAbstract {
183183
case '12':
184184
case '3':
185185
// go to top
186-
window.scrollTo(0, 0)
186+
window.scrollTo({ top: 0, behavior: 'instant' })
187187
break
188188
case '15':
189189
case '1':
@@ -352,7 +352,7 @@ export class JoyConController extends ControllerAbstract {
352352
const speed = this.calculateSpeed(joycons)
353353

354354
// update scroll position
355-
window.scrollBy(0, speed)
355+
window.scrollBy({ top: speed, behavior: 'instant' })
356356

357357
const scrollPosition = window.scrollY
358358
// check for reached end-of-scroll:

packages/webui/src/client/ui/Prompter/controller/keyboard-device.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ export class KeyboardController extends ControllerAbstract {
194194
const speed = Math.round(this._currentSpeed)
195195
if (speed === 0 && Math.abs(dp) < 100) {
196196
// go directly to target position:
197-
window.scrollBy(0, dp)
197+
window.scrollBy({ top: dp, behavior: 'instant' })
198198
} else {
199-
window.scrollBy(0, speed)
199+
window.scrollBy({ top: speed, behavior: 'instant' })
200200
}
201201

202202
const scrollPosition = window.scrollY

packages/webui/src/client/ui/Prompter/controller/midi-pedal-device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class MidiPedalController extends ControllerAbstract {
189189
if (this.updateSpeedHandle !== null) return
190190

191191
// update scroll position
192-
window.scrollBy(0, this.lastSpeed)
192+
window.scrollBy({ top: this.lastSpeed, behavior: 'instant' })
193193

194194
const scrollPosition = window.scrollY
195195
// check for reached end-of-scroll:

packages/webui/src/client/ui/Prompter/controller/mouse-ish-device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class MouseIshController extends ControllerAbstract {
276276
this._scrollRest = 0
277277
}
278278

279-
window.scrollBy(0, speed)
279+
window.scrollBy({ top: speed, behavior: 'instant' })
280280

281281
scrollPosition = window.scrollY
282282

packages/webui/src/client/ui/Prompter/controller/shuttle-keyboard-device.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class ShuttleKeyboardController extends ControllerAbstract {
117117
// jump to top
118118
this.lastSpeed = 0
119119
this.lastSpeedMapPosition = ShuttleKeyboardController.SPEEDMAPNEUTRALPOSITION
120-
window.scrollTo(0, 0)
120+
window.scrollTo({ top: 0, behavior: 'instant' })
121121
return
122122
case 'F11':
123123
// jump to live
@@ -175,7 +175,7 @@ export class ShuttleKeyboardController extends ControllerAbstract {
175175
if (this.updateSpeedHandle !== null) return
176176

177177
// update scroll position
178-
window.scrollBy(0, this.lastSpeed)
178+
window.scrollBy({ top: this.lastSpeed, behavior: 'instant' })
179179

180180
const scrollPosition = window.scrollY
181181
// check for reached end-of-scroll:

packages/webui/src/client/ui/Prompter/controller/shuttle-webhid-device.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class ShuttleWebHidController extends ControllerAbstract {
146146
if (Math.abs(delta) > 1) return // this is a hack because sometimes, right after connecting to the device, the delta would be larger than 1 or -1
147147

148148
this.resetSpeed()
149-
window.scrollBy(0, this.JOG_BASE_MOVEMENT_PX * delta)
149+
window.scrollBy({ top: this.JOG_BASE_MOVEMENT_PX * delta, behavior: 'instant' })
150150
}
151151

152152
protected onShuttle(value: number): void {
@@ -162,7 +162,7 @@ export class ShuttleWebHidController extends ControllerAbstract {
162162
if (this.updateSpeedHandle !== null) return
163163

164164
if (this.lastSpeed !== 0) {
165-
window.scrollBy(0, this.lastSpeed)
165+
window.scrollBy({ top: this.lastSpeed, behavior: 'instant' })
166166

167167
const scrollPosition = window.scrollY
168168
// check for reached end-of-scroll:

0 commit comments

Comments
 (0)