-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix: Restrict Map Zoom Levels to Supported Range #331
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ const NetJSONGraphDefaultConfig = { | |
svgRender: false, | ||
switchMode: false, | ||
maxPointsFetched: 10000, | ||
maxZoom : 18, | ||
minZoom : 3, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These options are defined 3 times. |
||
loadMoreAtZoomLevel: 9, | ||
clustering: false, | ||
clusteringThreshold: 100, | ||
|
@@ -161,6 +163,7 @@ const NetJSONGraphDefaultConfig = { | |
mapOptions: { | ||
roam: true, | ||
zoomAnimation: false, | ||
maxZoom: 18, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can move the |
||
nodeConfig: { | ||
type: "scatter", | ||
label: { | ||
|
@@ -238,7 +241,7 @@ const NetJSONGraphDefaultConfig = { | |
"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", | ||
options: { | ||
minZoom: 3, | ||
maxZoom: 32, | ||
maxZoom: 18, | ||
attribution: `© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, | ||
tiles offered by <a href="https://www.mapbox.com">Mapbox</a>`, | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,7 +270,7 @@ class NetJSONGraphRender { | |
return { | ||
leaflet: { | ||
tiles: configs.mapTileConfig, | ||
mapOptions: configs.mapOptions, | ||
mapOptions: {...configs.mapOptions , maxZoom : configs.maxZoom }, | ||
}, | ||
series, | ||
...configs.mapOptions.baseOptions, | ||
|
@@ -597,6 +597,19 @@ class NetJSONGraphRender { | |
} | ||
}); | ||
|
||
|
||
self.leaflet = self.echarts._api.getCoordinateSystems()[0].getLeaflet(); | ||
self.leaflet._zoomAnimated = false; | ||
|
||
self.leaflet.options.maxZoom = self.config.maxZoomLevel; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where on hearth is |
||
|
||
self.leaflet.on("zoomend", () => { | ||
if (self.leaflet.getZoom() > self.config.maxZoomLevel) { | ||
self.leaflet.setZoom(self.config.maxZoomLevel); | ||
} | ||
}); | ||
|
||
|
||
self.leaflet.on("zoomend", () => { | ||
if (self.leaflet.getZoom() < self.config.disableClusteringAtLevel) { | ||
const nodeData = self.utils.makeCluster(self); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessary?