Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draggable Init Error w/ Infinite CRS and worldCopyJump true #7393

Open
mlptownsend opened this issue Dec 30, 2020 · 0 comments
Open

Draggable Init Error w/ Infinite CRS and worldCopyJump true #7393

mlptownsend opened this issue Dec 30, 2020 · 0 comments
Labels
bug needs triage Triage pending

Comments

@mlptownsend
Copy link

I was using Proj4Leaflet to create custom CRS's and accidentally discovered that the Draggable's onZoomEnd handler doesn't account for the fact that map.getPixelWorldBounds() can return null when the crs.getProjectedBounds() returns null. That happens if it has the infinite flag returning true. This cascades to a null reference error during loading when this._map.getPixelWorldBounds().getSize().x blows up.

Note that you have to set worldCopyJump to true in order to actually have the onZoomEnd handler get wired up! In the fiddle, if you turn it off you don't get the error.

I'll let someone who knows more about how Draggable works think about how to handle the infinite case....

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a CRS object that sets infinite to true.
  2. Apply it to the map options on initialization and set worldCopyJump to true so that the onZoomEnd handler is attached.
  3. Run it.

Expected behavior
No errors.

Current behavior
Null reference error.

Environment

  • Leaflet version: 1.7.1
  • Browser (with version): Chrome 87.0.4280.88 | Firefox 78.4.1esr
  • OS/Platform (with version): Windows 10 | Amazon Linux 2

Minimal example reproducing the issue
I've created a contrived case to demonstrate the issue here. It's not how I stumbled on it originally, but it demonstrates the error.
https://jsfiddle.net/fv0k9o1w/

@Malvoz Malvoz added the needs triage Triage pending label May 17, 2022
@Malvoz Malvoz added the bug label Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Triage pending
Projects
None yet
Development

No branches or pull requests

2 participants