Skip to content

Commit

Permalink
callback timer for KeyboardDragListener does not start if the Pointer…
Browse files Browse the repository at this point in the history
… is already attached to a different listener, see #1634
  • Loading branch information
jessegreenberg committed May 28, 2024
1 parent 8ee9de6 commit 31c96b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/listeners/KeyboardDragListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class KeyboardDragListener extends KeyboardListener<KeyboardDragListenerKeyStrok
// doesn't play a 'bonk' sound every arrow key press.
domEvent.preventDefault();

// Cannot attach a listener to a Pointer that is already attached.
// Cannot attach a listener to a Pointer that is already attached
if ( this.startNextKeyboardEvent && !event.pointer.isAttached() ) {

// If there are no movement keys down, attach a listener to the Pointer that will tell the AnimatedPanZoomListener
Expand All @@ -613,7 +613,10 @@ class KeyboardDragListener extends KeyboardListener<KeyboardDragListenerKeyStrok
this.startNextKeyboardEvent = false;
}

if ( this.restartTimerNextKeyboardEvent ) {
// If the drag is already started, restart the callback timer on the next keydown event. The Pointer must
// be attached to this._pointerListener (already dragging) and not another listener (keyboard is interacting
// with another target).
if ( this.restartTimerNextKeyboardEvent && event.pointer.attachedListener === this._pointerListener ) {

// restart the callback timer
this.callbackTimer.stop( false );
Expand Down

0 comments on commit 31c96b4

Please sign in to comment.