mirror of
https://gitlab.aliens-lyon.fr/encartes/web-interface.git
synced 2026-03-17 22:51:04 +01:00
nom plutot qu'id des salles et limite d'OOB
This commit is contained in:
parent
7ba5b00f25
commit
0f97be0499
18
src/Map.js
18
src/Map.js
@ -178,7 +178,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
{
|
{
|
||||||
// In this case, the room is a staircase so we add a Stairs component
|
// In this case, the room is a staircase so we add a Stairs component
|
||||||
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["name"]}</Tooltip>
|
||||||
<Stairs position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
<Stairs position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
||||||
{floorList(element["connectedFloors"], callbackChangeFloor)}
|
{floorList(element["connectedFloors"], callbackChangeFloor)}
|
||||||
</Popup>
|
</Popup>
|
||||||
@ -190,7 +190,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
{
|
{
|
||||||
// In this case the room is a lift so we add a Lift component
|
// In this case the room is a lift so we add a Lift component
|
||||||
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["name"]}</Tooltip>
|
||||||
<Lift position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
<Lift position={polygonCenter(positions)} size={logoSize(positions)} body={<Popup>
|
||||||
{floorList(element["connectedFloors"], callbackChangeFloor)}
|
{floorList(element["connectedFloors"], callbackChangeFloor)}
|
||||||
</Popup>
|
</Popup>
|
||||||
@ -201,7 +201,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
else if (element["type"] === "T")
|
else if (element["type"] === "T")
|
||||||
{
|
{
|
||||||
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["name"]}</Tooltip>
|
||||||
<Toilet position={polygonCenter(positions)} size={logoSize(positions)}/>
|
<Toilet position={polygonCenter(positions)} size={logoSize(positions)}/>
|
||||||
</Polygon>
|
</Polygon>
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
|||||||
{
|
{
|
||||||
// In this case it is a regular room
|
// In this case it is a regular room
|
||||||
return <Polygon positions={positions} key={element["id"] + color} color={color} eventHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
return <Polygon positions={positions} key={element["id"] + color} color={color} eventHandlers={{click: () => callbackRoomSelected(element["id"])}}>
|
||||||
<Tooltip>{element["id"]}</Tooltip>
|
<Tooltip>{element["name"]}</Tooltip>
|
||||||
</Polygon>
|
</Polygon>
|
||||||
}
|
}
|
||||||
else if (element["type"] === "C")
|
else if (element["type"] === "C")
|
||||||
@ -277,15 +277,19 @@ function Map({callbackRoomSelected, selectedRoom, floorID, callbackChangeFloor})
|
|||||||
}, [floorID]);
|
}, [floorID]);
|
||||||
// We distinguish wether to print an error, a loading message
|
// We distinguish wether to print an error, a loading message
|
||||||
// or the map if we got the answer
|
// or the map if we got the answer
|
||||||
|
const corner1 = L.latLng(-50, -100);
|
||||||
|
const corner2 = L.latLng(50, 100);
|
||||||
|
const bounds = L.latLngBounds(corner1, corner2);
|
||||||
|
|
||||||
if (error != null)
|
if (error != null)
|
||||||
{
|
{
|
||||||
return <MapContainer center={[0, 0]} zoom={4} scrollWheelZoom={true} style={{ flexGrow: '1' }}>
|
return <MapContainer center={[0, 0]} zoom={4} scrollWheelZoom={true} style={{ flexGrow: '1' }} maxBounds={bounds} maxBoundsViscosity={1.0}>
|
||||||
<Popup position={[0,0]}>{error}</Popup>
|
<Popup position={[0,0]}>{error}</Popup>
|
||||||
</MapContainer>;
|
</MapContainer>;
|
||||||
}
|
}
|
||||||
else if (loading)
|
else if (loading)
|
||||||
{
|
{
|
||||||
return <MapContainer center={[0, 0]} zoom={4} scrollWheelZoom={true} style={{ flexGrow: '1' }}>
|
return <MapContainer center={[0, 0]} zoom={4} scrollWheelZoom={true} style={{ flexGrow: '1' }} maxBounds={bounds} maxBoundsViscosity={1.0}>
|
||||||
<Popup position={[0,0]}>Loading map</Popup>
|
<Popup position={[0,0]}>Loading map</Popup>
|
||||||
</MapContainer>;
|
</MapContainer>;
|
||||||
}
|
}
|
||||||
@ -298,7 +302,7 @@ function Map({callbackRoomSelected, selectedRoom, floorID, callbackChangeFloor})
|
|||||||
const polygons = createPolygons(request, callbackRoomSelected, selectedRoom);
|
const polygons = createPolygons(request, callbackRoomSelected, selectedRoom);
|
||||||
*/
|
*/
|
||||||
const polygons = buildPols(request, callbackRoomSelected, selectedRoom, callbackChangeFloor);
|
const polygons = buildPols(request, callbackRoomSelected, selectedRoom, callbackChangeFloor);
|
||||||
return <MapContainer center={[0, 0]} zoom={4} scrollWheelZoom={true} style={{ flexGrow: '1' }}>
|
return <MapContainer center={[0, 0]} zoom={4} scrollWheelZoom={true} style={{ flexGrow: '1' }} maxBounds={bounds} maxBoundsViscosity={1.0}>
|
||||||
{polygons}
|
{polygons}
|
||||||
</MapContainer>
|
</MapContainer>
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user