mirror of
https://gitlab.aliens-lyon.fr/encartes/web-interface.git
synced 2026-03-18 15:11:04 +01:00
ajout de gestion des connexions (pas testé)
This commit is contained in:
parent
6622c1c496
commit
2f0645708b
31
src/Map.js
31
src/Map.js
@ -37,16 +37,14 @@ function Lift({position, size, body})
|
|||||||
</Marker>
|
</Marker>
|
||||||
}
|
}
|
||||||
|
|
||||||
function Toilet({position, size, body})
|
function Toilet({position, size})
|
||||||
{
|
{
|
||||||
// React class (in function form) to represent lifts, takes the position where to put the lift logo
|
// React class (in function form) to represent lifts, takes the position where to put the lift logo
|
||||||
// and the body of the popup of the lift (list of floors accessible from that lift)
|
// and the body of the popup of the lift (list of floors accessible from that lift)
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
const [markerIcon, setMarkerIcon] = useState(new L.Icon({ iconUrl: toilet, iconSize: size }));
|
const [markerIcon, setMarkerIcon] = useState(new L.Icon({ iconUrl: toilet, iconSize: size }));
|
||||||
const mmap = useMapEvent('zoomend', () => {setMarkerIcon(new L.Icon({ iconUrl: toilet, iconSize: [20*Math.pow(2, map.getZoom() - 4), 20*Math.pow(2, map.getZoom() - 4)]}))});
|
const mmap = useMapEvent('zoomend', () => {setMarkerIcon(new L.Icon({ iconUrl: toilet, iconSize: [20*Math.pow(2, map.getZoom() - 4), 20*Math.pow(2, map.getZoom() - 4)]}))});
|
||||||
return <Marker position={position} icon={markerIcon}>
|
return <Marker position={position} icon={markerIcon}/>
|
||||||
{body}
|
|
||||||
</Marker>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function polygonCenter(polygon)
|
function polygonCenter(polygon)
|
||||||
@ -161,12 +159,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
||||||
<Tooltip>{element["id"]}</Tooltip>
|
<Tooltip>{element["id"]}</Tooltip>
|
||||||
<Stairs position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
<Stairs position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
||||||
<li onClick={() => { console.log("escalier"); }}>
|
{floorList(element["connexions"], callbackChangeFloor)}
|
||||||
YAY
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
uéuéué
|
|
||||||
</li>
|
|
||||||
</Popup>
|
</Popup>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -178,12 +171,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
||||||
<Tooltip>{element["id"]}</Tooltip>
|
<Tooltip>{element["id"]}</Tooltip>
|
||||||
<Lift position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
<Lift position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
||||||
<li onClick={() => { console.log("ascenseur"); }}>
|
{floorList(element["connexions"], callbackChangeFloor)}
|
||||||
YAY
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
uéuéué
|
|
||||||
</li>
|
|
||||||
</Popup>
|
</Popup>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -193,16 +181,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
{
|
{
|
||||||
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
||||||
<Tooltip>{element["id"]}</Tooltip>
|
<Tooltip>{element["id"]}</Tooltip>
|
||||||
<Toilet position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
<Toilet position={polygonCenter(positions)} size={logoSize(positions)}/>
|
||||||
<li onClick={() => { console.log("toilettes"); }}>
|
|
||||||
YAY
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
uéuéué
|
|
||||||
</li>
|
|
||||||
</Popup>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Polygon>
|
</Polygon>
|
||||||
}
|
}
|
||||||
else if (element["type"] === "R")
|
else if (element["type"] === "R")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user