Skip to content

Commit

Permalink
[change] Graph mode respects showLabelsAtZoomLevel setting #148
Browse files Browse the repository at this point in the history
Closes #148
  • Loading branch information
pandafy committed Apr 12, 2023
1 parent 4e9c72b commit f217864
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/js/netjsongraph.render.js
Expand Up @@ -296,6 +296,38 @@ class NetJSONGraphRender {
self.echarts.resize();
};

if (
self.echarts.getOption().series[0].zoom <
self.config.showLabelsAtZoomLevel
) {
self.echarts.setOption({
series: [
{
label: {
show: false,
},
},
],
});
}

self.echarts.on("graphRoam", (e) => {
if (
self.echarts.getOption().series[0].zoom >=
self.config.showLabelsAtZoomLevel
) {
self.echarts.setOption({
series: [
{
label: {
show: true,
},
},
],
});
}
});

self.event.emit("onLoad");
self.event.emit("onReady");
self.event.emit("renderArray");
Expand Down Expand Up @@ -421,7 +453,6 @@ class NetJSONGraphRender {
self.leaflet.geoJSON.addTo(self.leaflet);
}
}

if (self.leaflet.getZoom() < self.config.showLabelsAtZoomLevel) {
self.echarts.setOption({
series: [
Expand Down

0 comments on commit f217864

Please sign in to comment.