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

Add Leaflet maxZoom to configParameters #7294

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

glughi
Copy link
Contributor

@glughi glughi commented Oct 22, 2024

What this PR does

Related to #7280

Add "leafletMaxZoom" to configParameters so that the maxZoom of the Leaflet viewer can be changed.

Test me

How should reviewers test this? (Hint: If you want to provide a test catalog item, create a Gist of its catalog JSON, add its url and your branch name to this url: http://ci.terria.io/<branch name>/#clean&<raw url of your gist> , and then paste that in the body of this PR)

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@na9da na9da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change @glughi.

I have made a couple of comments.

lib/Models/Terria.ts Outdated Show resolved Hide resolved
@@ -103,6 +103,7 @@ export default class Leaflet extends GlobeOrMap {
clippingRectangle: Rectangle | undefined
) => GridLayer = computedFn((ip, clippingRectangle) => {
const layerOptions = {
maxZoom: this.terria.configParameters.leafletMaxZoom,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, because this is a map level config, it is better to pass it to the Map instance created here:

this.map = L.map(container, {
zoomControl: false,
attributionControl: false,
zoomSnap: 1, // Change to 0.2 for incremental zoom when Chrome fixes canvas scaling gaps
preferCanvas: true,
worldCopyJump: false
}).setView([-28.5, 135], 5);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, as you can read in the documentation of Leaflet (https://leafletjs.com/reference.html#map-maxzoom) the MapOptions.maxZoom property has no default limitations. The GridLayerOptions.maxZoom property is set to 18 by default, so it is the one to change so that zoom greater than 18 can be used.

@glughi glughi requested a review from na9da October 23, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants