mirror of
https://gitlab.aliens-lyon.fr/encartes/web-interface.git
synced 2026-03-17 22:51:04 +01:00
premier noms only et pas de tooltip si pas de nom
This commit is contained in:
parent
1ab7f7654e
commit
a3cf560714
20
src/Map.js
20
src/Map.js
@ -164,19 +164,6 @@ function floorList(connectedFloors, callbackChangeFloor) {
|
||||
return htmlFloorList;
|
||||
}
|
||||
|
||||
function roomNameList(nameList) {
|
||||
// Returns under html format a list of room names
|
||||
// (without bullet points) listed in nameList
|
||||
// Auxiliary function used when creating a Room component
|
||||
let htmlNameList = [];
|
||||
for (const ind in nameList) {
|
||||
htmlNameList = [...htmlNameList, <div key={ind}>
|
||||
{nameList[ind]}
|
||||
</div>];
|
||||
}
|
||||
return htmlNameList;
|
||||
}
|
||||
|
||||
function newPolygon(element, positions, selectedRoom, callbackRoomSelected, callbackChangeFloor) {
|
||||
// Auxiliary function to return the appropriate polygon depending
|
||||
// on wether it is a room (R), a lift (L), a staircase (S), toilets (T) or corridor (C)
|
||||
@ -210,14 +197,17 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call
|
||||
} else if (element['type'] === 'T') { // Toilets
|
||||
content = <Toilet position={polygonCenter(positions)} size={logoSize(positions)} />
|
||||
}
|
||||
|
||||
var tooltip = null;
|
||||
if (element["names"][0] != null) {
|
||||
tooltip = <Tooltip>{element["names"][0]}</Tooltip>;
|
||||
}
|
||||
return <Polygon
|
||||
positions={positions}
|
||||
key={element["id"] + color}
|
||||
color={color}
|
||||
eventHandlers={{ click: () => callbackRoomSelected(element["id"]) }}
|
||||
>
|
||||
<Tooltip>{roomNameList(element["names"])}</Tooltip>
|
||||
{tooltip}
|
||||
{content}
|
||||
</Polygon>
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user