Skip to content

Commit 43e25f0

Browse files
olzzonPeterC89
authored andcommitted
fix: after bootstrap was added the scrollBy(x, y) was using smooth scroll. using scrollBy(top: y, behaviour: instant) solves that problem
1 parent 21dcefb commit 43e25f0

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ const PrompterContent = withTranslation()(
810810

811811
window.scrollBy({
812812
top: top - scrollAnchor.offset,
813+
behavior: 'instant',
813814
})
814815
// We've scrolled, exit the function!
815816
return
@@ -821,6 +822,7 @@ const PrompterContent = withTranslation()(
821822
// the css margins magically does it for us.
822823
window.scrollBy({
823824
top: top - readPosition,
825+
behavior: 'instant',
824826
})
825827
// We've scrolled, exit the function!
826828
return

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)