deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] Pressing arrow keys with OrthographicView controller performs inverted pan

Open odfalik opened this issue 3 years ago • 4 comments

Description

Pressing the right arrow key pans the view left (and vice versa, as well as for up/down panning).

If this is actually a bug and not expected behavior, I'd be happy to look into it and submit a PR!

As a workaround, I've tried settings the moveSpeed in the OrthographicViewController's ControllerOptions to a negative number, but that seems to brick DeckGL.

Flavors

  • [X] React
  • [ ] Python/Jupyter notebook
  • [ ] MapboxLayer
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] DeckLayer/DeckRenderer for ArcGIS

Expected Behavior

Pressing the left arrow key should pan left, right should pan right, up should pan up, and down should pan down.

Steps to Reproduce

This issue manifests in the OrthographicView example in the documentation. Click to focus on the canvas, then press the right arrow key on your keyboard. The view will pan left!

I've reproduced the same behavior when using the default OrthographicView controller in React, as well.

Environment

  • Framework version:
  • Browser:
  • OS:

Logs

Nothing in console

odfalik avatar Aug 22 '22 22:08 odfalik

If it's useful to know, keyboard panning is also inverted for OrbitController.

odfalik avatar Aug 23 '22 04:08 odfalik

Hmm, the default indeed feels weird, and apparently it's always been working like this.

I am able to change the direction with negative moveSpeed though:

controller: {keyboard: {moveSpeed: -100}},

Pessimistress avatar Aug 23 '22 17:08 Pessimistress

That would be a good workaround, but when I specify a keyboard object while my ViewState is externally managed (in React), pressing an arrow key causes an infinite loop which repeatedly triggers onViewStateChange.

This behavior happens if keyboard is non-true. Browsing thru the source code, I don't see anything that should cause this.

Happy to open a separate issue for this, though!

odfalik avatar Aug 23 '22 18:08 odfalik

That does not sound relevant to this issue. I suggest you create a CodeSandbox and open another thread in issues or discussions.

Pessimistress avatar Aug 23 '22 18:08 Pessimistress