Skip to content

Commit 12dfb2c

Browse files
committed
update details
1 parent 3d50640 commit 12dfb2c

File tree

1 file changed

+36
-21
lines changed

1 file changed

+36
-21
lines changed

src/App.jsx

+36-21
Original file line numberDiff line numberDiff line change
@@ -262,29 +262,42 @@ export default function App({
262262
const { object, x, y, layer } = hoverInfo;
263263

264264
let tooltipContent;
265-
266265
if (layer && layer.id === 'MapNetwork' && object) {
267-
// GeoJsonLayer tooltip content
268-
tooltipContent = (
269-
<div>
270-
<b>NETWORK</b><br />
271-
<b>id: {object.properties.id}</b><br />
272-
<b>from: {object.properties.from}</b><br />
273-
<b>to: {object.properties.to}</b><br />
274-
<b>length: {object.properties.length}</b><br />
275-
<b>freespeed: {object.properties.freespeed}</b><br />
276-
<b>capacity: {object.properties.capacity}</b><br />
277-
<b>oneway: {object.properties.from}</b><br />
278-
<b>modes: {object.properties.from}</b>
279-
{/* más información */}
280-
</div>
281-
);
282-
} else if (layer && layer.id === 'trips' && object) {
266+
// Verificar si el objeto es un punto (nodo) o una línea (enlace)
267+
if (object.geometry.type === 'Point') {
268+
// GeoJsonLayer tooltip content para nodos
269+
tooltipContent = (
270+
<div>
271+
<b>NODE NETWORK</b><br />
272+
<b>node id: {object.properties.id}</b><br />
273+
<b>position: {object.geometry.coordinates[0]}, {object.geometry.coordinates[1]}</b><br />
274+
</div>
275+
);
276+
} else if (object.geometry.type === 'LineString') {
277+
// GeoJsonLayer tooltip content para enlaces
278+
tooltipContent = (
279+
<div>
280+
<b>LINK NETWORK</b><br />
281+
<b>link id: {object.properties.id}</b><br />
282+
<b>from: {object.properties.from}</b><br />
283+
<b>to: {object.properties.to}</b><br />
284+
<b>length: {object.properties.length}</b><br />
285+
<b>freespeed: {object.properties.freespeed}</b><br />
286+
<b>capacity: {object.properties.capacity}</b><br />
287+
<b>oneway: {object.properties.oneway}</b><br />
288+
<b>modes: {object.properties.modes}</b>
289+
{/* más información */}
290+
</div>
291+
);
292+
}
293+
}
294+
295+
else if (layer && layer.id === 'trips' && object) {
283296
// TripsLayer tooltip content
284297
tooltipContent = (
285298
<div>
286299
<b>EVENTS</b><br />
287-
<b>Vehicle id: {object.vehicle}</b>
300+
<b>vehicle id: {object.vehicle}</b>
288301

289302
</div>
290303
);
@@ -294,23 +307,23 @@ export default function App({
294307
<div>
295308
<b>CUSTOM LAYER 1</b><br />
296309
<b>id: {object.properties.id}</b><br />
297-
<b>position: {object.geometry.coordinates}</b><br />
310+
<b>position: {object.geometry.coordinates[0]}, {object.geometry.coordinates[1]}</b><br />
298311
</div>
299312
);
300313
} else if (layer && layer.id === 'CustomLayer2' && object){
301314
tooltipContent = (
302315
<div>
303316
<b>CUSTOM LAYER 2</b><br />
304317
<b>id: {object.properties.id}</b><br />
305-
<b>position: {object.geometry.coordinates}</b><br />
318+
<b>position: {object.geometry.coordinates[0]}, {object.geometry.coordinates[1]}</b><br />
306319
</div>
307320
);
308321
} else if (layer && layer.id === 'CustomLayer3' && object){
309322
tooltipContent = (
310323
<div>
311324
<b>CUSTOM LAYER 3</b><br />
312325
<b>id: {object.properties.id}</b><br />
313-
<b>position: {object.geometry.coordinates}</b><br />
326+
<b>position: {object.geometry.coordinates[0]}, {object.geometry.coordinates[1]}</b><br />
314327
</div>
315328
);
316329

@@ -375,6 +388,7 @@ export default function App({
375388
pickable: true,
376389
onHover: (info) => setHoverInfo(info),
377390
autoHighlight: true,
391+
highlightColor: [255, 141, 0, 225],
378392
initialViewState: calculateInitialViewState(customLayer4) // Aquí se establece initialViewState
379393

380394
}),
@@ -391,6 +405,7 @@ export default function App({
391405
widthMinPixels: widthMinPixels,
392406
pickable: true,
393407
autoHighlight: true,
408+
highlightColor: [25, 100, 255, 225],
394409
trailLength:trailLength ,
395410
currentTime: time,
396411
shadowEnabled: false,

0 commit comments

Comments
 (0)