datastake-daf 0.6.780 → 0.6.782

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,330 @@
1
+ /* Isolated Mapbox GL CSS - Scoped to prevent Leaflet conflicts */
2
+
3
+ /* Mapbox GL Core Styles - Scoped with .mapbox-gl-scope */
4
+ .mapbox-gl-scope .mapboxgl-map {
5
+ font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif;
6
+ overflow: hidden;
7
+ position: relative;
8
+ -webkit-tap-highlight-color: rgb(0 0 0/0);
9
+ }
10
+
11
+ .mapbox-gl-scope .mapboxgl-canvas {
12
+ left: 0;
13
+ position: absolute;
14
+ top: 0;
15
+ }
16
+
17
+ .mapbox-gl-scope .mapboxgl-map:-webkit-full-screen {
18
+ height: 100%;
19
+ width: 100%;
20
+ }
21
+
22
+ .mapbox-gl-scope .mapboxgl-canary {
23
+ background-color: salmon;
24
+ }
25
+
26
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-interactive,
27
+ .mapbox-gl-scope .mapboxgl-ctrl-group button.mapboxgl-ctrl-compass {
28
+ cursor: grab;
29
+ -webkit-user-select: none;
30
+ user-select: none;
31
+ }
32
+
33
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer {
34
+ cursor: pointer;
35
+ }
36
+
37
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-interactive:active,
38
+ .mapbox-gl-scope .mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active {
39
+ cursor: grabbing;
40
+ }
41
+
42
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,
43
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas {
44
+ touch-action: pan-x pan-y;
45
+ }
46
+
47
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-drag-pan,
48
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas {
49
+ touch-action: pinch-zoom;
50
+ }
51
+
52
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,
53
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas {
54
+ touch-action: none;
55
+ }
56
+
57
+ /* Control positioning */
58
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom,
59
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-left,
60
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-right,
61
+ .mapbox-gl-scope .mapboxgl-ctrl-left,
62
+ .mapbox-gl-scope .mapboxgl-ctrl-right,
63
+ .mapbox-gl-scope .mapboxgl-ctrl-top,
64
+ .mapbox-gl-scope .mapboxgl-ctrl-top-left,
65
+ .mapbox-gl-scope .mapboxgl-ctrl-top-right {
66
+ pointer-events: none;
67
+ position: absolute;
68
+ z-index: 2;
69
+ }
70
+
71
+ .mapbox-gl-scope .mapboxgl-ctrl-top-left {
72
+ left: 0;
73
+ top: 0;
74
+ }
75
+
76
+ .mapbox-gl-scope .mapboxgl-ctrl-top {
77
+ left: 50%;
78
+ top: 0;
79
+ transform: translateX(-50%);
80
+ }
81
+
82
+ .mapbox-gl-scope .mapboxgl-ctrl-top-right {
83
+ right: 0;
84
+ top: 0;
85
+ }
86
+
87
+ .mapbox-gl-scope .mapboxgl-ctrl-right {
88
+ right: 0;
89
+ top: 50%;
90
+ transform: translateY(-50%);
91
+ }
92
+
93
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-right {
94
+ bottom: 0;
95
+ right: 0;
96
+ }
97
+
98
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom {
99
+ bottom: 0;
100
+ left: 50%;
101
+ transform: translateX(-50%);
102
+ }
103
+
104
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-left {
105
+ bottom: 0;
106
+ left: 0;
107
+ }
108
+
109
+ .mapbox-gl-scope .mapboxgl-ctrl-left {
110
+ left: 0;
111
+ top: 50%;
112
+ transform: translateY(-50%);
113
+ }
114
+
115
+ .mapbox-gl-scope .mapboxgl-ctrl {
116
+ clear: both;
117
+ pointer-events: auto;
118
+ transform: translate(0);
119
+ }
120
+
121
+ .mapbox-gl-scope .mapboxgl-ctrl-top-left .mapboxgl-ctrl {
122
+ float: left;
123
+ margin: 10px 0 0 10px;
124
+ }
125
+
126
+ .mapbox-gl-scope .mapboxgl-ctrl-top .mapboxgl-ctrl {
127
+ float: left;
128
+ margin: 10px 0;
129
+ }
130
+
131
+ .mapbox-gl-scope .mapboxgl-ctrl-top-right .mapboxgl-ctrl {
132
+ float: right;
133
+ margin: 10px 10px 0 0;
134
+ }
135
+
136
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,
137
+ .mapbox-gl-scope .mapboxgl-ctrl-right .mapboxgl-ctrl {
138
+ float: right;
139
+ margin: 0 10px 10px 0;
140
+ }
141
+
142
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom .mapboxgl-ctrl {
143
+ float: left;
144
+ margin: 10px 0;
145
+ }
146
+
147
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,
148
+ .mapbox-gl-scope .mapboxgl-ctrl-left .mapboxgl-ctrl {
149
+ float: left;
150
+ margin: 0 0 10px 10px;
151
+ }
152
+
153
+ /* Control group styling */
154
+ .mapbox-gl-scope .mapboxgl-ctrl-group {
155
+ background: #fff;
156
+ border-radius: 4px;
157
+ }
158
+
159
+ .mapbox-gl-scope .mapboxgl-ctrl-group:not(:empty) {
160
+ box-shadow: 0 0 0 2px #0000001a;
161
+ }
162
+
163
+ .mapbox-gl-scope .mapboxgl-ctrl-group button {
164
+ background-color: initial;
165
+ border: 0;
166
+ box-sizing: border-box;
167
+ cursor: pointer;
168
+ display: block;
169
+ height: 29px;
170
+ outline: none;
171
+ overflow: hidden;
172
+ padding: 0;
173
+ width: 29px;
174
+ }
175
+
176
+ .mapbox-gl-scope .mapboxgl-ctrl-group button+button {
177
+ border-top: 1px solid #ddd;
178
+ }
179
+
180
+ .mapbox-gl-scope .mapboxgl-ctrl button .mapboxgl-ctrl-icon {
181
+ background-position: 50%;
182
+ background-repeat: no-repeat;
183
+ display: block;
184
+ height: 100%;
185
+ width: 100%;
186
+ }
187
+
188
+ .mapbox-gl-scope .mapboxgl-ctrl-attrib-button:focus,
189
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:focus {
190
+ box-shadow: 0 0 2px 2px #0096ff;
191
+ }
192
+
193
+ .mapbox-gl-scope .mapboxgl-ctrl button:disabled {
194
+ cursor: not-allowed;
195
+ }
196
+
197
+ .mapbox-gl-scope .mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon {
198
+ opacity: .25;
199
+ }
200
+
201
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:first-child {
202
+ border-radius: 4px 4px 0 0;
203
+ }
204
+
205
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:last-child {
206
+ border-radius: 0 0 4px 4px;
207
+ }
208
+
209
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:only-child {
210
+ border-radius: inherit;
211
+ }
212
+
213
+ .mapbox-gl-scope .mapboxgl-ctrl button:not(:disabled):hover {
214
+ background-color: #0000000d;
215
+ }
216
+
217
+ /* Marker styles */
218
+ .mapbox-gl-scope .mapboxgl-marker {
219
+ position: absolute;
220
+ z-index: 1;
221
+ }
222
+
223
+ .mapbox-gl-scope .mapboxgl-marker svg {
224
+ display: block;
225
+ }
226
+
227
+ /* Popup styles */
228
+ .mapbox-gl-scope .mapboxgl-popup {
229
+ position: absolute;
230
+ text-align: center;
231
+ margin-bottom: 20px;
232
+ }
233
+
234
+ .mapbox-gl-scope .mapboxgl-popup-content-wrapper {
235
+ padding: 1px;
236
+ text-align: left;
237
+ border-radius: 12px;
238
+ }
239
+
240
+ .mapbox-gl-scope .mapboxgl-popup-content {
241
+ margin: 13px 24px 13px 20px;
242
+ line-height: 1.3;
243
+ font-size: 13px;
244
+ min-height: 1px;
245
+ }
246
+
247
+ .mapbox-gl-scope .mapboxgl-popup-content p {
248
+ margin: 17px 0;
249
+ }
250
+
251
+ .mapbox-gl-scope .mapboxgl-popup-tip-container {
252
+ width: 40px;
253
+ height: 20px;
254
+ position: absolute;
255
+ left: 50%;
256
+ margin-top: -1px;
257
+ margin-left: -20px;
258
+ overflow: hidden;
259
+ pointer-events: none;
260
+ }
261
+
262
+ .mapbox-gl-scope .mapboxgl-popup-tip {
263
+ width: 17px;
264
+ height: 17px;
265
+ padding: 1px;
266
+ margin: -10px auto 0;
267
+ pointer-events: auto;
268
+ -webkit-transform: rotate(45deg);
269
+ -moz-transform: rotate(45deg);
270
+ -ms-transform: rotate(45deg);
271
+ transform: rotate(45deg);
272
+ }
273
+
274
+ .mapbox-gl-scope .mapboxgl-popup-content-wrapper,
275
+ .mapbox-gl-scope .mapboxgl-popup-tip {
276
+ background: white;
277
+ color: #333;
278
+ box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
279
+ }
280
+
281
+ .mapbox-gl-scope .mapboxgl-popup-close-button {
282
+ position: absolute;
283
+ top: 0;
284
+ right: 0;
285
+ border: none;
286
+ text-align: center;
287
+ width: 24px;
288
+ height: 24px;
289
+ font: 16px/24px Tahoma, Verdana, sans-serif;
290
+ color: #757575;
291
+ text-decoration: none;
292
+ background: transparent;
293
+ }
294
+
295
+ .mapbox-gl-scope .mapboxgl-popup-close-button:hover,
296
+ .mapbox-gl-scope .mapboxgl-popup-close-button:focus {
297
+ color: #585858;
298
+ }
299
+
300
+ /* Attribution */
301
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution {
302
+ background: #fff;
303
+ background: rgba(255, 255, 255, 0.8);
304
+ margin: 0;
305
+ }
306
+
307
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution,
308
+ .mapbox-gl-scope .mapboxgl-ctrl-scale-line {
309
+ padding: 0 5px;
310
+ color: #333;
311
+ line-height: 1.4;
312
+ }
313
+
314
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution a {
315
+ text-decoration: none;
316
+ }
317
+
318
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution a:hover,
319
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution a:focus {
320
+ text-decoration: underline;
321
+ }
322
+
323
+ /* Hide attribution by default */
324
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution {
325
+ display: none !important;
326
+ }
327
+
328
+ .mapbox-gl-scope .mapboxgl-ctrl-logo {
329
+ display: none !important;
330
+ }
@@ -7211,17 +7211,6 @@ function convertUndefinedToNull(obj) {
7211
7211
  }
7212
7212
  return obj;
7213
7213
  }
7214
- const removeKeysFromObject = (obj = {}, keys = []) => {
7215
- if (typeof obj !== 'object' || obj === null) return obj;
7216
- const result = {};
7217
- for (const key of Object.keys(obj)) {
7218
- if (!keys.includes(key)) {
7219
- result[key] = obj[key];
7220
- }
7221
- }
7222
- return result;
7223
- };
7224
- const hasKeyInObject = (obj, key) => Object.keys(obj || {}).includes(key);
7225
7214
 
7226
7215
  ({
7227
7216
  t: PropTypes__default["default"].func,
@@ -14946,7 +14935,6 @@ exports.handleError = handleError;
14946
14935
  exports.handleInfo = handleInfo;
14947
14936
  exports.handleSuccess = handleSuccess;
14948
14937
  exports.handleWarning = handleWarning;
14949
- exports.hasKeyInObject = hasKeyInObject;
14950
14938
  exports.hasNotChanged = hasNotChanged;
14951
14939
  exports.isEmptyOrSpaces = isEmptyOrSpaces;
14952
14940
  exports.isModuleApproved = isModuleApproved;
@@ -14962,7 +14950,6 @@ exports.modules = modules;
14962
14950
  exports.nowToIso = nowToIso;
14963
14951
  exports.processConfig = processConfig;
14964
14952
  exports.propHasValue = propHasValue;
14965
- exports.removeKeysFromObject = removeKeysFromObject;
14966
14953
  exports.renderBreadCrumbs = renderBreadCrumbs;
14967
14954
  exports.renderDateFormatted = renderDateFormatted;
14968
14955
  exports.renderNumber = renderNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.780",
3
+ "version": "0.6.782",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -88,10 +88,6 @@ export default function StakeholderIcon({
88
88
  }, [parentId, allData]);
89
89
 
90
90
  useEffect(() => {
91
- if (selectedMarkersId.length === 0 || !isSelected) {
92
- return;
93
- }
94
-
95
91
  linkNodesData.map((node) => {
96
92
  const isConnectingToStakeholder = node.isStakeholder;
97
93
  const id = `${data.datastakeId}-${node.stakeholderId || node.datastakeId}`;
@@ -105,6 +101,13 @@ export default function StakeholderIcon({
105
101
  const stakeholderLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
106
102
  let endLatLng = L.latLng(node.gps.latitude, node.gps.longitude);
107
103
 
104
+ const areNextToEachOther =
105
+ targetMarkerIndex === index + 1 ||
106
+ targetMarkerIndex === index - 1 ||
107
+ (index === 0 && targetMarkerIndex === node.totalStakeholders - 1) ||
108
+ (targetMarkerIndex === 0 && index === node.totalStakeholders - 1);
109
+ const areOnlyTwoSiblings = node.totalStakeholders === 2;
110
+
108
111
  if (isExtraSmallMarker(zoom) && !isForceOpen) {
109
112
  createPolyline({
110
113
  L,
@@ -115,7 +118,6 @@ export default function StakeholderIcon({
115
118
  isSelected,
116
119
  id,
117
120
  listOfPolylines: polylinesRef.current,
118
- animated: true,
119
121
  });
120
122
  return;
121
123
  }
@@ -135,8 +137,75 @@ export default function StakeholderIcon({
135
137
  y + nodePoint.y + center.top,
136
138
  );
137
139
  endLatLng = mapRef.layerPointToLatLng(endPoint);
140
+
141
+ if (isSibling && (!areNextToEachOther || areOnlyTwoSiblings)) {
142
+ if (areOnlyTwoSiblings) {
143
+ buildCurveWIthTwoSiblings({
144
+ mapRef,
145
+ startLatLng: stakeholderLatLng,
146
+ endLatLng,
147
+ zoom,
148
+ isSelected,
149
+ id,
150
+ });
151
+ return;
152
+ }
153
+
154
+ const total = node.totalStakeholders;
155
+ let from = index;
156
+ let to = targetMarkerIndex;
157
+ let flip = false;
158
+
159
+ const forwardDistance = (to - from + total) % total;
160
+ const backwardDistance = (from - to + total) % total;
161
+
162
+ if (backwardDistance < forwardDistance) {
163
+ [from, to] = [to, from];
164
+ flip = true;
165
+ }
166
+
167
+ const intermediateIndices = [];
168
+ for (let i = 1; i < (to - from + total) % total; i++) {
169
+ intermediateIndices.push((from + i) % total);
170
+ }
171
+
172
+ const indices = [from, ...intermediateIndices, to];
173
+
174
+ const intermediatePoints = [];
175
+
176
+ for (const i of indices) {
177
+ const { x, y } = createCurvePath({
178
+ zoom,
179
+ totalMarkers: node.totalStakeholders,
180
+ markerIndex: i,
181
+ });
182
+
183
+ const point = centerPoint.add(L.point(x, y));
184
+ const latlng = mapRef.layerPointToLatLng(point);
185
+ intermediatePoints.push(latlng);
186
+ }
187
+
188
+ const latlngs = flip
189
+ ? [endLatLng, ...intermediatePoints, stakeholderLatLng]
190
+ : [stakeholderLatLng, ...intermediatePoints, endLatLng];
191
+
192
+ const layerPoints = latlngs.map((latlng) => mapRef.latLngToLayerPoint(latlng));
193
+
194
+ const path = buildSmoothCurve(layerPoints, mapRef, flip);
195
+
196
+ const curve = L?.curve?.(path, {
197
+ color: "var(--base-gray-70)",
198
+ weight: isExtraSmallMarker(zoom) ? 0 : 1,
199
+ opacity: isSelected ? 1 : 0.5,
200
+ smoothFactor: 1,
201
+ id,
202
+ });
203
+
204
+ mapRef.addLayer(curve);
205
+ return;
206
+ }
138
207
  }
139
- // Always use straight lines
208
+
140
209
  createPolyline({
141
210
  L,
142
211
  mapRef,
@@ -147,10 +216,9 @@ export default function StakeholderIcon({
147
216
  isSelected,
148
217
  id,
149
218
  listOfPolylines: polylinesRef.current,
150
- animated: true,
151
219
  });
152
220
  });
153
- }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen, selectedMarkersId]);
221
+ }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen]);
154
222
 
155
223
  return (
156
224
  <>
@@ -165,7 +233,6 @@ export default function StakeholderIcon({
165
233
  onClickLink: () => {
166
234
  onClickLink(data);
167
235
  },
168
- isNewTab: true,
169
236
  })}
170
237
  getPopupContainer={(triggerNode) => {
171
238
  const mapElement = document.getElementById("map");
@@ -48,7 +48,6 @@ export default function LocationIcon({
48
48
  const nodes = [];
49
49
  const links = data.links || [];
50
50
 
51
- // Add links from the location itself
52
51
  links.forEach((link) => {
53
52
  allData.forEach((d) => {
54
53
  if (d.datastakeId === link) {
@@ -69,49 +68,8 @@ export default function LocationIcon({
69
68
  });
70
69
  });
71
70
 
72
- // ADD: Also include links from this location's stakeholders
73
- const stakeholders = data.stakeholders || [];
74
- stakeholders.forEach((stakeholder) => {
75
- const stakeholderLinks = stakeholder.links || [];
76
- stakeholderLinks.forEach((link) => {
77
- allData.forEach((d) => {
78
- // Check if it's a direct location link
79
- if (d.datastakeId === link) {
80
- // Avoid duplicates
81
- if (!nodes.find(n => n.datastakeId === link && !n.isStakeholder)) {
82
- nodes.push({
83
- ...d,
84
- fromStakeholderId: stakeholder.datastakeId,
85
- });
86
- }
87
- }
88
- // Check if it's a stakeholder link
89
- if (d.stakeholders && d.stakeholders.length > 0) {
90
- d.stakeholders.forEach((targetStakeholder) => {
91
- if (targetStakeholder.datastakeId === link) {
92
- // Avoid duplicates
93
- if (!nodes.find(n =>
94
- n.isStakeholder &&
95
- n.datastakeId === d.datastakeId &&
96
- n.stakeholdersIndex === d.stakeholders.indexOf(targetStakeholder)
97
- )) {
98
- nodes.push({
99
- ...d,
100
- isStakeholder: true,
101
- totalStakeholders: d.stakeholders.length,
102
- stakeholdersIndex: d.stakeholders.indexOf(targetStakeholder),
103
- fromStakeholderId: stakeholder.datastakeId,
104
- });
105
- }
106
- }
107
- });
108
- }
109
- });
110
- });
111
- });
112
-
113
71
  return nodes;
114
- }, [JSON.stringify(allData), JSON.stringify(data.links), JSON.stringify(data.stakeholders), zoom]);
72
+ }, [JSON.stringify(allData), JSON.stringify(data.links), zoom]);
115
73
 
116
74
  const stakeholdersOfLocation = useMemo(() => {
117
75
  return data?.stakeholders || [];
@@ -132,16 +90,7 @@ export default function LocationIcon({
132
90
  currentRoots.clear();
133
91
  markersRef.current = [];
134
92
 
135
- // Only create stakeholder markers if this location or any of its stakeholders are selected
136
- const shouldShowStakeholders = isSelected || stakeholdersOfLocation.some(stk =>
137
- selectedMarkersId.includes(stk.datastakeId)
138
- );
139
-
140
- if (!shouldShowStakeholders || selectedMarkersId.length === 0) {
141
- return;
142
- }
143
-
144
- // Create new markers only when selected
93
+ // Create new markers
145
94
  stakeholdersOfLocation.forEach((stakeholder, index) => {
146
95
  const markerId = `${stakeholder.datastakeId}`;
147
96
  const { x, y, radius, center } = getStakeholderPosition({
@@ -235,8 +184,6 @@ export default function LocationIcon({
235
184
  isFromStakeholder: true,
236
185
  isForceOpen,
237
186
  listOfPolylines: polylinesRef.current,
238
- stakeholderType: stakeholder.type,
239
- animated: true,
240
187
  });
241
188
  });
242
189
 
@@ -252,67 +199,12 @@ export default function LocationIcon({
252
199
  rootsMapRef.current.clear();
253
200
  markersRef.current = [];
254
201
  };
255
- }, [stakeholdersOfLocation, selectedMarkersId, activeMarker, zoom]);
202
+ }, [stakeholdersOfLocation, selectedMarkersId, activeMarker]);
256
203
 
257
- // Only create polylines for linked nodes when something is selected
258
- useEffect(() => {
259
- if (selectedMarkersId.length === 0) {
260
- return;
261
- }
262
-
263
- // IMPORTANT: Only draw links if this location is actually selected
264
- // Not just highlighted as part of the chain
265
- if (!isSelected) {
266
- return;
267
- }
268
-
269
- // Filter linkedNodesData to only include nodes that are in the selected chain
270
- const relevantLinks = linkedNodesData.filter(node => {
271
- // Check if the target node (location) is in the selected markers
272
- const targetLocationInSelection = selectedMarkersId.includes(node.datastakeId);
273
-
274
- // If connecting to a stakeholder, check if that stakeholder is selected
275
- if (node.isStakeholder) {
276
- const stakeholderInSelection = node.stakeholdersIndex !== undefined &&
277
- selectedMarkersId.includes(node.datastakeId);
278
- return stakeholderInSelection;
279
- }
280
-
281
- return targetLocationInSelection;
282
- });
283
-
284
- relevantLinks.forEach((node) => {
285
- const id = node.fromStakeholderId
286
- ? `${node.fromStakeholderId}-${node.datastakeId}`
287
- : `${data.datastakeId}-${node.datastakeId}`;
204
+ linkedNodesData.map((node) => {
205
+ const id = `${data.datastakeId}-${node.datastakeId}`;
288
206
  const isConnectingToStakeholder = node.isStakeholder;
289
-
290
- // If the link is from a stakeholder, start from the stakeholder position
291
- let startLatLng;
292
- if (node.fromStakeholderId) {
293
- // Find the stakeholder index in this location's stakeholders
294
- const stakeholderIndex = stakeholdersOfLocation.findIndex(
295
- s => s.datastakeId === node.fromStakeholderId
296
- );
297
-
298
- if (stakeholderIndex !== -1) {
299
- const { x, y } = getStakeholderPosition({
300
- zoom,
301
- totalMarkers: stakeholdersOfLocation.length,
302
- markerIndex: stakeholderIndex,
303
- });
304
-
305
- const centerLatLng = L.latLng(data.gps.latitude, data.gps.longitude);
306
- const centerPoint = mapRef.latLngToLayerPoint(centerLatLng);
307
- const stakeholderPoint = centerPoint.add(L.point(x, y));
308
- startLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
309
- } else {
310
- startLatLng = L.latLng(data.gps.latitude, data.gps.longitude);
311
- }
312
- } else {
313
- startLatLng = L.latLng(data.gps.latitude, data.gps.longitude);
314
- }
315
-
207
+ const centerLatLng = L.latLng(data.gps.latitude, data.gps.longitude);
316
208
  let endLatLng = L.latLng(node.gps.latitude, node.gps.longitude);
317
209
  const isConnectingToStakeholderSelected = selectedMarkersId.includes(node.datastakeId);
318
210
 
@@ -333,15 +225,15 @@ useEffect(() => {
333
225
  createPolyline({
334
226
  L,
335
227
  mapRef,
336
- startLatLng,
228
+ startLatLng: centerLatLng,
337
229
  endLatLng,
230
+
338
231
  isSelected: isConnectingToStakeholderSelected,
339
232
  id,
340
233
  zoom,
341
234
  listOfPolylines: polylinesRef.current,
342
235
  });
343
236
  });
344
- }, [linkedNodesData, selectedMarkersId, zoom, stakeholdersOfLocation, isSelected]);
345
237
 
346
238
  return (
347
239
  <Popover