ajout de gestion des connexions (pas testé)

This commit is contained in:
Gabriel Dehame 2023-02-22 14:56:29 +01:00
parent 6622c1c496
commit 2f0645708b

View File

@ -37,16 +37,14 @@ function Lift({position, size, body})
</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
// and the body of the popup of the lift (list of floors accessible from that lift)
const map = useMap();
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)]}))});
return <Marker position={position} icon={markerIcon}>
{body}
</Marker>
return <Marker position={position} icon={markerIcon}/>
}
function polygonCenter(polygon)
@ -161,14 +159,9 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
<Tooltip>{element["id"]}</Tooltip>
<Stairs position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
<li onClick={() => { console.log("escalier"); }}>
YAY
</li>
<li>
uéuéué
</li>
</Popup>
}
{floorList(element["connexions"], callbackChangeFloor)}
</Popup>
}
/>
</Polygon>
}
@ -178,14 +171,9 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
return <Polygon positions={positions} key={element["id"] + color} color={color} evenHandlers={{click: () => callbackRoomSelected(element["id"])}}>
<Tooltip>{element["id"]}</Tooltip>
<Lift position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
<li onClick={() => { console.log("ascenseur"); }}>
YAY
</li>
<li>
uéuéué
</li>
</Popup>
}
{floorList(element["connexions"], callbackChangeFloor)}
</Popup>
}
/>
</Polygon>
}
@ -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"])}}>
<Tooltip>{element["id"]}</Tooltip>
<Toilet position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
<li onClick={() => { console.log("toilettes"); }}>
YAY
</li>
<li>
uéuéué
</li>
</Popup>
}
/>
<Toilet position={polygonCenter(positions)} size={logoSize(positions)}/>
</Polygon>
}
else if (element["type"] === "R")