datastake-daf 0.6.283 β 0.6.284
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.
- package/dist/components/index.js +144 -129
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/CSSInJSGlobe.jsx +415 -0
- package/src/@daf/core/components/Dashboard/Globe/IsolatedGlobe.jsx +345 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +17 -111
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +14 -13
- package/src/index.js +1 -1
- package/src/styles/datastake/mapbox-gl.css +330 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeStraatosDebug.jsx +0 -322
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeStraatosDebug.standalone.jsx +0 -349
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.jsx +0 -150
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTestDebug.standalone.jsx +0 -183
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* IsolatedGlobe - Completely isolated Mapbox component
|
|
6
|
+
* Uses scoped CSS and shadow DOM to prevent any conflicts
|
|
7
|
+
*/
|
|
8
|
+
const IsolatedGlobe = ({
|
|
9
|
+
projects = [],
|
|
10
|
+
mapConfig = {},
|
|
11
|
+
onProjectClick = () => {},
|
|
12
|
+
type = "default",
|
|
13
|
+
color = "#00809E"
|
|
14
|
+
}) => {
|
|
15
|
+
const mapContainer = useRef(null);
|
|
16
|
+
const map = useRef(null);
|
|
17
|
+
const shadowRoot = useRef(null);
|
|
18
|
+
const boundsRef = useRef(null);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (map.current) return;
|
|
22
|
+
|
|
23
|
+
console.log('πΊοΈ [ISOLATED GLOBE] Creating isolated map...');
|
|
24
|
+
|
|
25
|
+
// Set Mapbox access token
|
|
26
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
27
|
+
|
|
28
|
+
// Create shadow DOM for complete isolation
|
|
29
|
+
const container = mapContainer.current;
|
|
30
|
+
shadowRoot.current = container.attachShadow({ mode: 'open' });
|
|
31
|
+
|
|
32
|
+
// Create isolated styles
|
|
33
|
+
const style = document.createElement('style');
|
|
34
|
+
style.textContent = `
|
|
35
|
+
:host {
|
|
36
|
+
display: block;
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
position: relative;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.mapboxgl-map {
|
|
44
|
+
font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
position: relative;
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
-webkit-tap-highlight-color: rgb(0 0 0/0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.mapboxgl-canvas {
|
|
53
|
+
left: 0;
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.mapboxgl-canvas-container {
|
|
59
|
+
position: relative;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.mapboxgl-marker {
|
|
65
|
+
position: absolute;
|
|
66
|
+
z-index: 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.mapboxgl-marker svg {
|
|
70
|
+
display: block;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.mapboxgl-popup {
|
|
74
|
+
position: absolute;
|
|
75
|
+
text-align: center;
|
|
76
|
+
margin-bottom: 20px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.mapboxgl-popup-content-wrapper {
|
|
80
|
+
padding: 1px;
|
|
81
|
+
text-align: left;
|
|
82
|
+
border-radius: 12px;
|
|
83
|
+
background: white;
|
|
84
|
+
color: #333;
|
|
85
|
+
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.mapboxgl-popup-content {
|
|
89
|
+
margin: 13px 24px 13px 20px;
|
|
90
|
+
line-height: 1.3;
|
|
91
|
+
font-size: 13px;
|
|
92
|
+
min-height: 1px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.mapboxgl-popup-tip-container {
|
|
96
|
+
width: 40px;
|
|
97
|
+
height: 20px;
|
|
98
|
+
position: absolute;
|
|
99
|
+
left: 50%;
|
|
100
|
+
margin-top: -1px;
|
|
101
|
+
margin-left: -20px;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
pointer-events: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.mapboxgl-popup-tip {
|
|
107
|
+
width: 17px;
|
|
108
|
+
height: 17px;
|
|
109
|
+
padding: 1px;
|
|
110
|
+
margin: -10px auto 0;
|
|
111
|
+
pointer-events: auto;
|
|
112
|
+
transform: rotate(45deg);
|
|
113
|
+
background: white;
|
|
114
|
+
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mapboxgl-popup-close-button {
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: 0;
|
|
120
|
+
right: 0;
|
|
121
|
+
border: none;
|
|
122
|
+
text-align: center;
|
|
123
|
+
width: 24px;
|
|
124
|
+
height: 24px;
|
|
125
|
+
font: 16px/24px Tahoma, Verdana, sans-serif;
|
|
126
|
+
color: #757575;
|
|
127
|
+
text-decoration: none;
|
|
128
|
+
background: transparent;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.mapboxgl-popup-close-button:hover {
|
|
133
|
+
color: #585858;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.mapboxgl-ctrl-attribution,
|
|
137
|
+
.mapboxgl-ctrl-logo {
|
|
138
|
+
display: none !important;
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
shadowRoot.current.appendChild(style);
|
|
142
|
+
|
|
143
|
+
// Create map container inside shadow DOM
|
|
144
|
+
const mapDiv = document.createElement('div');
|
|
145
|
+
mapDiv.style.width = '100%';
|
|
146
|
+
mapDiv.style.height = '100%';
|
|
147
|
+
shadowRoot.current.appendChild(mapDiv);
|
|
148
|
+
|
|
149
|
+
// Create map
|
|
150
|
+
map.current = new mapboxgl.Map({
|
|
151
|
+
container: mapDiv,
|
|
152
|
+
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
153
|
+
center: [0, 0],
|
|
154
|
+
zoom: mapConfig.maxZoom || 3,
|
|
155
|
+
projection: 'globe',
|
|
156
|
+
attributionControl: false
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Add markers when map loads
|
|
160
|
+
map.current.on('load', () => {
|
|
161
|
+
console.log('πΊοΈ [ISOLATED GLOBE] Map loaded, adding markers...');
|
|
162
|
+
|
|
163
|
+
// Calculate bounds to fit all markers
|
|
164
|
+
const bounds = new mapboxgl.LngLatBounds();
|
|
165
|
+
let hasValidCoordinates = false;
|
|
166
|
+
|
|
167
|
+
projects.forEach((project, index) => {
|
|
168
|
+
console.log(`π [ISOLATED GLOBE] Adding marker ${index}:`, project);
|
|
169
|
+
|
|
170
|
+
// Create marker element
|
|
171
|
+
const el = document.createElement('div');
|
|
172
|
+
el.style.cursor = 'pointer';
|
|
173
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
174
|
+
el.style.display = 'flex';
|
|
175
|
+
el.style.alignItems = 'center';
|
|
176
|
+
el.style.justifyContent = 'center';
|
|
177
|
+
el.style.position = 'relative';
|
|
178
|
+
el.style.left = 'auto';
|
|
179
|
+
el.style.top = 'auto';
|
|
180
|
+
el.style.transform = 'none';
|
|
181
|
+
el.style.zIndex = '1000';
|
|
182
|
+
|
|
183
|
+
if (type === "location") {
|
|
184
|
+
// Location marker - SVG map pin style
|
|
185
|
+
el.style.width = '28px';
|
|
186
|
+
el.style.height = '33px';
|
|
187
|
+
el.innerHTML = `
|
|
188
|
+
<svg
|
|
189
|
+
width="28"
|
|
190
|
+
height="33"
|
|
191
|
+
viewBox="0 0 28 33"
|
|
192
|
+
fill="none"
|
|
193
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
194
|
+
>
|
|
195
|
+
<path
|
|
196
|
+
d="M5.14346 4.87419C10.0688 -0.15896 18.0528 -0.162058 22.9757 4.86861C27.6563 9.65161 27.8841 17.2616 23.6622 22.3255H23.6608C23.427 22.6141 23.1808 22.894 22.9211 23.1623L14.0671 32.2101L5.44057 23.3948L5.13868 23.096C0.215857 18.0655 0.218422 9.90737 5.14346 4.87419Z"
|
|
197
|
+
fill="${color}"
|
|
198
|
+
stroke="white"
|
|
199
|
+
/>
|
|
200
|
+
</svg>
|
|
201
|
+
`;
|
|
202
|
+
} else {
|
|
203
|
+
// Default circular marker style
|
|
204
|
+
el.style.width = '30px';
|
|
205
|
+
el.style.height = '30px';
|
|
206
|
+
el.style.backgroundColor = color;
|
|
207
|
+
el.style.borderRadius = '50%';
|
|
208
|
+
el.style.border = '2px solid white';
|
|
209
|
+
el.style.color = 'white';
|
|
210
|
+
el.style.fontWeight = 'bold';
|
|
211
|
+
el.style.fontSize = '14px';
|
|
212
|
+
el.style.textAlign = 'center';
|
|
213
|
+
el.style.lineHeight = '1';
|
|
214
|
+
el.innerHTML = `<span style="display: block; line-height: 1;">${project.percentageCompletion || 0}</span>`;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Create popup content
|
|
218
|
+
const popupContent = `
|
|
219
|
+
<div style="padding: 12px; min-width: 200px;">
|
|
220
|
+
<h3 style="margin: 0 0 8px 0; font-size: 16px; color: #333;">${project.name}</h3>
|
|
221
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
222
|
+
<strong>Country:</strong> ${project.country || 'N/A'}
|
|
223
|
+
</p>
|
|
224
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
225
|
+
<strong>Sector:</strong> ${project.sectoralScope || 'Project'}
|
|
226
|
+
</p>
|
|
227
|
+
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
228
|
+
<strong>Completion:</strong> ${project.percentageCompletion || 0}%
|
|
229
|
+
</p>
|
|
230
|
+
<p style="margin: 4px 0 0 0; font-size: 12px; color: #666;">
|
|
231
|
+
<strong>Coordinates:</strong> ${Number(project.latitude).toFixed(4)}, ${Number(project.longitude).toFixed(4)}
|
|
232
|
+
</p>
|
|
233
|
+
</div>
|
|
234
|
+
`;
|
|
235
|
+
|
|
236
|
+
// Create popup
|
|
237
|
+
const popup = new mapboxgl.Popup({
|
|
238
|
+
offset: 25,
|
|
239
|
+
closeButton: true,
|
|
240
|
+
closeOnClick: false
|
|
241
|
+
}).setHTML(popupContent);
|
|
242
|
+
|
|
243
|
+
// Ensure coordinates are valid numbers
|
|
244
|
+
const lng = Number(project.longitude);
|
|
245
|
+
const lat = Number(project.latitude);
|
|
246
|
+
|
|
247
|
+
console.log(`π [ISOLATED GLOBE] Marker ${index} coordinates:`, {
|
|
248
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
249
|
+
processed: { lng, lat },
|
|
250
|
+
project: project.name
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// Validate coordinates
|
|
254
|
+
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
255
|
+
console.error(`β [ISOLATED GLOBE] Invalid coordinates for project ${index}:`, {
|
|
256
|
+
lng, lat,
|
|
257
|
+
original: { longitude: project.longitude, latitude: project.latitude },
|
|
258
|
+
project: project.name
|
|
259
|
+
});
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Add coordinates to bounds
|
|
264
|
+
bounds.extend([lng, lat]);
|
|
265
|
+
hasValidCoordinates = true;
|
|
266
|
+
|
|
267
|
+
// Create marker with explicit positioning
|
|
268
|
+
const marker = new mapboxgl.Marker({
|
|
269
|
+
element: el,
|
|
270
|
+
anchor: 'center'
|
|
271
|
+
})
|
|
272
|
+
.setLngLat([lng, lat])
|
|
273
|
+
.setPopup(popup)
|
|
274
|
+
.addTo(map.current);
|
|
275
|
+
|
|
276
|
+
// Add click handler
|
|
277
|
+
el.addEventListener('click', () => {
|
|
278
|
+
console.log('π [ISOLATED GLOBE] Marker clicked:', project);
|
|
279
|
+
onProjectClick(project);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Verify marker position after a short delay
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
const markerLngLat = marker.getLngLat();
|
|
285
|
+
console.log(`π [ISOLATED GLOBE] Marker ${index} position verification:`, {
|
|
286
|
+
expected: [lng, lat],
|
|
287
|
+
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
288
|
+
project: project.name,
|
|
289
|
+
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
290
|
+
});
|
|
291
|
+
}, 100);
|
|
292
|
+
|
|
293
|
+
console.log(`β
[ISOLATED GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// Fit map to show all markers if we have valid coordinates
|
|
297
|
+
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
298
|
+
console.log('πΊοΈ [ISOLATED GLOBE] Fitting map to bounds:', bounds);
|
|
299
|
+
map.current.fitBounds(bounds, {
|
|
300
|
+
padding: { top: 20, bottom: 20, left: 20, right: 20 },
|
|
301
|
+
maxZoom: 6,
|
|
302
|
+
duration: 1000
|
|
303
|
+
});
|
|
304
|
+
boundsRef.current = bounds;
|
|
305
|
+
} else {
|
|
306
|
+
boundsRef.current = null;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
return () => {
|
|
311
|
+
if (map.current) {
|
|
312
|
+
map.current.remove();
|
|
313
|
+
map.current = null;
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
317
|
+
|
|
318
|
+
const zoomIn = () => map.current && map.current.zoomIn();
|
|
319
|
+
const zoomOut = () => map.current && map.current.zoomOut();
|
|
320
|
+
const recenter = () => {
|
|
321
|
+
if (!map.current) return;
|
|
322
|
+
if (boundsRef.current && !boundsRef.current.isEmpty()) {
|
|
323
|
+
map.current.fitBounds(boundsRef.current, {
|
|
324
|
+
padding: { top: 20, bottom: 20, left: 20, right: 20 },
|
|
325
|
+
maxZoom: 6,
|
|
326
|
+
duration: 800,
|
|
327
|
+
});
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
map.current.easeTo({ center: [0, 0], zoom: 3, duration: 800 });
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<div
|
|
335
|
+
ref={mapContainer}
|
|
336
|
+
style={{
|
|
337
|
+
width: '100%',
|
|
338
|
+
height: '100%',
|
|
339
|
+
position: 'relative'
|
|
340
|
+
}}
|
|
341
|
+
/>
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export default IsolatedGlobe;
|
|
@@ -47,29 +47,15 @@ const SimpleGlobe = ({
|
|
|
47
47
|
// Set Mapbox access token
|
|
48
48
|
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
49
49
|
|
|
50
|
-
// Create map with custom Straatos style
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
console.log('πΊοΈ [SIMPLE GLOBE] Custom style loaded successfully');
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.warn('β οΈ [SIMPLE GLOBE] Custom style failed, using fallback:', error);
|
|
63
|
-
// Fallback to standard style
|
|
64
|
-
map.current = new mapboxgl.Map({
|
|
65
|
-
container: mapContainer.current,
|
|
66
|
-
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
67
|
-
center: [0, 0],
|
|
68
|
-
zoom: mapConfig.maxZoom || 3,
|
|
69
|
-
projection: 'globe',
|
|
70
|
-
attributionControl: false
|
|
71
|
-
});
|
|
72
|
-
}
|
|
50
|
+
// Create map with custom Straatos style
|
|
51
|
+
map.current = new mapboxgl.Map({
|
|
52
|
+
container: mapContainer.current,
|
|
53
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
54
|
+
center: [0, 0],
|
|
55
|
+
zoom: mapConfig.maxZoom || 3,
|
|
56
|
+
projection: 'globe',
|
|
57
|
+
attributionControl: false
|
|
58
|
+
});
|
|
73
59
|
|
|
74
60
|
// Add markers when map loads
|
|
75
61
|
map.current.on('load', () => {
|
|
@@ -91,13 +77,11 @@ const SimpleGlobe = ({
|
|
|
91
77
|
.mapboxgl-canvas {
|
|
92
78
|
overflow: hidden !important;
|
|
93
79
|
}
|
|
94
|
-
|
|
95
|
-
/* AGGRESSIVE CSS ISOLATION: Override ALL Leaflet CSS interference */
|
|
80
|
+
/* CRITICAL: Override Leaflet CSS interference with Mapbox */
|
|
96
81
|
.daf-simple-globe-container .mapboxgl-canvas-container {
|
|
97
82
|
position: relative !important;
|
|
98
83
|
left: auto !important;
|
|
99
84
|
top: auto !important;
|
|
100
|
-
transform: none !important;
|
|
101
85
|
}
|
|
102
86
|
.daf-simple-globe-container .mapboxgl-canvas-container canvas {
|
|
103
87
|
position: relative !important;
|
|
@@ -105,61 +89,11 @@ const SimpleGlobe = ({
|
|
|
105
89
|
top: auto !important;
|
|
106
90
|
transform: none !important;
|
|
107
91
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.daf-simple-globe-container .mapboxgl-marker {
|
|
111
|
-
position: absolute !important;
|
|
112
|
-
left: auto !important;
|
|
113
|
-
top: auto !important;
|
|
114
|
-
transform: none !important;
|
|
115
|
-
pointer-events: auto !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* Override Leaflet div icon styles */
|
|
119
|
-
.daf-simple-globe-container .mapboxgl-marker .daf-globe-marker {
|
|
92
|
+
/* Prevent Leaflet styles from affecting Mapbox markers */
|
|
93
|
+
.daf-simple-globe-container .daf-globe-marker {
|
|
120
94
|
position: relative !important;
|
|
121
95
|
left: auto !important;
|
|
122
96
|
top: auto !important;
|
|
123
|
-
transform: none !important;
|
|
124
|
-
width: auto !important;
|
|
125
|
-
height: auto !important;
|
|
126
|
-
background: none !important;
|
|
127
|
-
border: none !important;
|
|
128
|
-
pointer-events: auto !important;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* Override any Leaflet pane positioning */
|
|
132
|
-
.daf-simple-globe-container .mapboxgl-marker-pane {
|
|
133
|
-
position: absolute !important;
|
|
134
|
-
left: 0 !important;
|
|
135
|
-
top: 0 !important;
|
|
136
|
-
transform: none !important;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* Override Leaflet tile container interference */
|
|
140
|
-
.daf-simple-globe-container .mapboxgl-tile-container {
|
|
141
|
-
position: absolute !important;
|
|
142
|
-
left: 0 !important;
|
|
143
|
-
top: 0 !important;
|
|
144
|
-
transform: none !important;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/* Override any Leaflet zoom animations */
|
|
148
|
-
.daf-simple-globe-container .mapboxgl-zoom-animated {
|
|
149
|
-
transform-origin: 0 0 !important;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/* Override Leaflet interactive cursor styles */
|
|
153
|
-
.daf-simple-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
154
|
-
cursor: pointer !important;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/* Override Leaflet popup positioning */
|
|
158
|
-
.daf-simple-globe-container .mapboxgl-popup {
|
|
159
|
-
position: absolute !important;
|
|
160
|
-
left: auto !important;
|
|
161
|
-
top: auto !important;
|
|
162
|
-
transform: none !important;
|
|
163
97
|
}
|
|
164
98
|
`;
|
|
165
99
|
document.head.appendChild(style);
|
|
@@ -205,12 +139,6 @@ const SimpleGlobe = ({
|
|
|
205
139
|
el.style.display = 'flex';
|
|
206
140
|
el.style.alignItems = 'center';
|
|
207
141
|
el.style.justifyContent = 'center';
|
|
208
|
-
// Ensure proper positioning and prevent CSS interference
|
|
209
|
-
el.style.position = 'relative';
|
|
210
|
-
el.style.left = 'auto';
|
|
211
|
-
el.style.top = 'auto';
|
|
212
|
-
el.style.transform = 'none';
|
|
213
|
-
el.style.zIndex = '1000';
|
|
214
142
|
|
|
215
143
|
if (type === "location") {
|
|
216
144
|
// Location marker - SVG map pin style
|
|
@@ -289,23 +217,15 @@ const SimpleGlobe = ({
|
|
|
289
217
|
closeOnClick: false
|
|
290
218
|
}).setHTML(popupContent);
|
|
291
219
|
|
|
292
|
-
// Ensure coordinates are valid numbers
|
|
220
|
+
// Ensure coordinates are valid numbers
|
|
293
221
|
const lng = Number(project.longitude);
|
|
294
222
|
const lat = Number(project.latitude);
|
|
295
223
|
|
|
296
|
-
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, {
|
|
297
|
-
original: { longitude: project.longitude, latitude: project.latitude },
|
|
298
|
-
processed: { lng, lat },
|
|
299
|
-
project: project.name
|
|
300
|
-
});
|
|
224
|
+
console.log(`π [SIMPLE GLOBE] Marker ${index} coordinates:`, { lng, lat });
|
|
301
225
|
|
|
302
226
|
// Validate coordinates
|
|
303
227
|
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
304
|
-
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
|
|
305
|
-
lng, lat,
|
|
306
|
-
original: { longitude: project.longitude, latitude: project.latitude },
|
|
307
|
-
project: project.name
|
|
308
|
-
});
|
|
228
|
+
console.error(`β [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, { lng, lat });
|
|
309
229
|
return;
|
|
310
230
|
}
|
|
311
231
|
|
|
@@ -313,11 +233,8 @@ const SimpleGlobe = ({
|
|
|
313
233
|
bounds.extend([lng, lat]);
|
|
314
234
|
hasValidCoordinates = true;
|
|
315
235
|
|
|
316
|
-
//
|
|
317
|
-
const marker = new mapboxgl.Marker(
|
|
318
|
-
element: el,
|
|
319
|
-
anchor: 'center'
|
|
320
|
-
})
|
|
236
|
+
// Add marker to map with proper coordinate order [lng, lat]
|
|
237
|
+
const marker = new mapboxgl.Marker(el)
|
|
321
238
|
.setLngLat([lng, lat])
|
|
322
239
|
.setPopup(popup)
|
|
323
240
|
.addTo(map.current);
|
|
@@ -327,17 +244,6 @@ const SimpleGlobe = ({
|
|
|
327
244
|
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
328
245
|
onProjectClick(project);
|
|
329
246
|
});
|
|
330
|
-
|
|
331
|
-
// Verify marker position after a short delay
|
|
332
|
-
setTimeout(() => {
|
|
333
|
-
const markerLngLat = marker.getLngLat();
|
|
334
|
-
console.log(`π [SIMPLE GLOBE] Marker ${index} position verification:`, {
|
|
335
|
-
expected: [lng, lat],
|
|
336
|
-
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
337
|
-
project: project.name,
|
|
338
|
-
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
339
|
-
});
|
|
340
|
-
}, 100);
|
|
341
247
|
|
|
342
248
|
console.log(`β
[SIMPLE GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
343
249
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import SimpleGlobe from "./SimpleGlobe";
|
|
2
2
|
import SimpleGlobeDebug from "./SimpleGlobeDebug";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import IsolatedGlobe from "./IsolatedGlobe";
|
|
4
|
+
import CSSInJSGlobe from "./CSSInJSGlobe";
|
|
5
5
|
import ThemeLayout from "../../ThemeLayout";
|
|
6
6
|
import Widget from "../Widget";
|
|
7
7
|
|
|
@@ -285,31 +285,32 @@ export const DebugVersion = {
|
|
|
285
285
|
)
|
|
286
286
|
};
|
|
287
287
|
|
|
288
|
-
export const
|
|
289
|
-
name: "
|
|
288
|
+
export const IsolatedVersion = {
|
|
289
|
+
name: "Isolated Version (Shadow DOM)",
|
|
290
290
|
render: () => (
|
|
291
291
|
<div style={{ margin: "3em" }}>
|
|
292
292
|
<ThemeLayout>
|
|
293
|
-
<Widget title="
|
|
294
|
-
<
|
|
293
|
+
<Widget title="Isolated Globe (Shadow DOM)" className="no-px no-pb-body">
|
|
294
|
+
<div style={{ width: '100%', height: '600px' }}>
|
|
295
|
+
<IsolatedGlobe projects={SAMPLE_PROJECTS} type="location" color="#4ECDC4" />
|
|
296
|
+
</div>
|
|
295
297
|
</Widget>
|
|
296
298
|
</ThemeLayout>
|
|
297
299
|
</div>
|
|
298
300
|
)
|
|
299
301
|
};
|
|
300
302
|
|
|
301
|
-
export const
|
|
302
|
-
name: "
|
|
303
|
+
export const CSSInJSVersion = {
|
|
304
|
+
name: "CSS-in-JS Version (No External CSS)",
|
|
303
305
|
render: () => (
|
|
304
306
|
<div style={{ margin: "3em" }}>
|
|
305
307
|
<ThemeLayout>
|
|
306
|
-
<Widget title="
|
|
307
|
-
<
|
|
308
|
+
<Widget title="CSS-in-JS Globe (No External CSS)" className="no-px no-pb-body">
|
|
309
|
+
<div style={{ width: '100%', height: '600px' }}>
|
|
310
|
+
<CSSInJSGlobe projects={SAMPLE_PROJECTS} type="location" color="#4ECDC4" />
|
|
311
|
+
</div>
|
|
308
312
|
</Widget>
|
|
309
313
|
</ThemeLayout>
|
|
310
314
|
</div>
|
|
311
315
|
)
|
|
312
316
|
};
|
|
313
|
-
|
|
314
|
-
// Export the components for reuse in other projects
|
|
315
|
-
export { SimpleGlobeTestDebug, SimpleGlobeStraatosDebug };
|
package/src/index.js
CHANGED
|
@@ -63,7 +63,7 @@ export { default as MineSiteMap } from "./@daf/core/components/Dashboard/Map/ind
|
|
|
63
63
|
export { default as InExpandableWidgetMap } from "./@daf/core/components/Dashboard/Map/InExpandableWidgetMap/index.jsx";
|
|
64
64
|
export { default as Globe } from "./@daf/core/components/Dashboard/Globe/index.jsx";
|
|
65
65
|
export { default as SimpleGlobe } from "./@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx";
|
|
66
|
-
export { default as
|
|
66
|
+
export { default as IsolatedGlobe } from "./@daf/core/components/Dashboard/Globe/IsolatedGlobe.jsx";
|
|
67
67
|
export { default as WidgetPlaceholder } from "./@daf/core/components/Dashboard/Widget/WidgetPlaceholder/index.jsx";
|
|
68
68
|
export { default as Steps } from "./@daf/core/components/Dashboard/Steps/index.jsx";
|
|
69
69
|
export { default as DashboardLayout } from "./@daf/core/components/Dashboard/DashboardLayout/index.jsx";
|