Skip to content

Commit 1f239ae

Browse files
committed
Merge branch 'master' into issues/454-fix-redundant-labels
2 parents 465e1e7 + e503883 commit 1f239ae

6 files changed

Lines changed: 224 additions & 188 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v5
17+
- uses: actions/checkout@v6
1818
with:
1919
ref: ${{ github.event.pull_request.head.sha }}
2020

@@ -48,7 +48,7 @@ jobs:
4848
runs-on: ubuntu-latest
4949

5050
steps:
51-
- uses: actions/checkout@v5
51+
- uses: actions/checkout@v6
5252

5353
- name: Get yarn cache directory path
5454
id: yarn-cache-dir-path
@@ -106,7 +106,7 @@ jobs:
106106

107107
steps:
108108
- name: Checkout
109-
uses: actions/checkout@v5
109+
uses: actions/checkout@v6
110110

111111
- name: Installing dependencies
112112
run: |

public/example_templates/netjsonmap-indoormap.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
crs: L.CRS.Simple,
4949
// set map initial state.
5050
mapOptions: {
51+
// disable leaflet worldCopyJump on the indoor map
52+
// because it's incompatible (raises a JS error) and not needed
53+
worldCopyJump: false,
5154
center: [48.577, 18.539],
5255
zoom: 0,
5356
zoomSnap: 0.3,

src/js/netjsongraph.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const NetJSONGraphDefaultConfig = {
165165
mapOptions: {
166166
roam: true,
167167
zoomAnimation: false,
168+
worldCopyJump: true,
168169
minZoom: 3,
169170
maxZoom: 18,
170171
nodeConfig: {

src/js/netjsongraph.render.js

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import * as echarts from "echarts/core";
2-
import {
3-
GraphChart,
4-
EffectScatterChart,
5-
LinesChart,
6-
ScatterChart,
7-
} from "echarts/charts";
2+
import {GraphChart, EffectScatterChart, LinesChart, ScatterChart} from "echarts/charts";
83
import {
94
TooltipComponent,
105
TitleComponent,
@@ -205,8 +200,7 @@ class NetJSONGraphRender {
205200
{
206201
...baseGraphSeries,
207202
id: "network-graph",
208-
type:
209-
configs.graphConfig.series.type === "graphGL" ? "graphGL" : "graph",
203+
type: configs.graphConfig.series.type === "graphGL" ? "graphGL" : "graph",
210204
layout:
211205
configs.graphConfig.series.type === "graphGL"
212206
? "forceAtlas2"
@@ -273,11 +267,7 @@ class NetJSONGraphRender {
273267
if (!location || !location.lng || !location.lat) {
274268
console.error(`Node ${node.id} position is undefined!`);
275269
} else {
276-
const {nodeEmphasisConfig} = self.utils.getNodeStyle(
277-
node,
278-
configs,
279-
"map",
280-
);
270+
const {nodeEmphasisConfig} = self.utils.getNodeStyle(node, configs, "map");
281271

282272
let nodeName = "";
283273
if (typeof node.label === "string") {
@@ -394,8 +384,7 @@ class NetJSONGraphRender {
394384
: nodeSizeConfig;
395385
}
396386
return (
397-
(configs.mapOptions.nodeConfig &&
398-
configs.mapOptions.nodeConfig.nodeSize) ||
387+
(configs.mapOptions.nodeConfig && configs.mapOptions.nodeConfig.nodeSize) ||
399388
17
400389
);
401390
},
@@ -429,10 +418,7 @@ class NetJSONGraphRender {
429418
*
430419
*/
431420
graphRender(JSONData, self) {
432-
self.utils.echartsSetOption(
433-
self.utils.generateGraphOption(JSONData, self),
434-
self,
435-
);
421+
self.utils.echartsSetOption(self.utils.generateGraphOption(JSONData, self), self);
436422

437423
window.onresize = () => {
438424
self.echarts.resize();
@@ -644,29 +630,22 @@ class NetJSONGraphRender {
644630
self.leaflet.getZoom() >= self.config.loadMoreAtZoomLevel &&
645631
self.hasMoreData
646632
) {
647-
const data = await self.utils.getBBoxData.call(
648-
self,
649-
self.JSONParam,
650-
bounds,
651-
);
633+
const data = await self.utils.getBBoxData.call(self, self.JSONParam, bounds);
652634
self.config.prepareData.call(self, data);
653635
const dataNodeSet = new Set(self.data.nodes.map((n) => n.id));
654636
const sourceLinkSet = new Set(self.data.links.map((l) => l.source));
655637
const targetLinkSet = new Set(self.data.links.map((l) => l.target));
656638
const nodes = data.nodes.filter((node) => !dataNodeSet.has(node.id));
657639
const links = data.links.filter(
658-
(link) =>
659-
!sourceLinkSet.has(link.source) && !targetLinkSet.has(link.target),
640+
(link) => !sourceLinkSet.has(link.source) && !targetLinkSet.has(link.target),
660641
);
661642
const boundsDataSet = new Set(data.nodes.map((n) => n.id));
662643
const nonCommonNodes = self.bboxData.nodes.filter(
663644
(node) => !boundsDataSet.has(node.id),
664645
);
665646
const removableNodes = new Set(nonCommonNodes.map((n) => n.id));
666647

667-
JSONData.nodes = JSONData.nodes.filter(
668-
(node) => !removableNodes.has(node.id),
669-
);
648+
JSONData.nodes = JSONData.nodes.filter((node) => !removableNodes.has(node.id));
670649
self.bboxData.nodes = self.bboxData.nodes.concat(nodes);
671650
self.bboxData.links = self.bboxData.links.concat(links);
672651
JSONData = {
@@ -684,8 +663,7 @@ class NetJSONGraphRender {
684663
self.config.clustering &&
685664
self.config.clusteringThreshold < JSONData.nodes.length
686665
) {
687-
let {clusters, nonClusterNodes, nonClusterLinks} =
688-
self.utils.makeCluster(self);
666+
let {clusters, nonClusterNodes, nonClusterLinks} = self.utils.makeCluster(self);
689667

690668
// Only show clusters if we're below the disableClusteringAtLevel
691669
if (self.leaflet.getZoom() > self.config.disableClusteringAtLevel) {
@@ -829,9 +807,7 @@ class NetJSONGraphRender {
829807
return true;
830808
}
831809
if (existingNodeIds.has(node.id)) {
832-
console.warn(
833-
`Duplicate node ID ${node.id} detected during merge and skipped.`,
834-
);
810+
console.warn(`Duplicate node ID ${node.id} detected during merge and skipped.`);
835811
return false;
836812
}
837813
return true;

test/netjsongraph.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ describe("NetJSONGraph Specification", () => {
120120
const NetJSONGraphMapOptions = {
121121
roam: true,
122122
zoomAnimation: false,
123+
worldCopyJump: true,
123124
minZoom: 3,
124125
maxZoom: 18,
125126
nodeConfig: {

0 commit comments

Comments
 (0)