@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 1.67 kB
JavaScript
import{jsx as d}from"react/jsx-runtime";import c from"classnames";import{observer as p,useLocalStore as u}from"mobx-react-lite";import r,{layersStore as i,uiState as o}from"../store";import{LayerMode as l,LayersMode as b}from"../store/LayerStore";import y from"../ui/MapControls";import{remsToPixels as s}from"../utils";import{t}from"../utils/i18n";const f=p(()=>{const a=u(()=>({get className(){return c({controls:!0,container:!0,"-ready":!0,[o.responsiveClass]:!0})},get style(){return{[o.rtl?"left":"right"]:o.overlayPosition==="left"?o.overlayCollapsed?s(.9):(o.kiosk?10:0)+s(.7)+"px":"10px",bottom:o.kiosk?s(4):s(9.6)}},get layers(){return i.layers.filter(e=>e.mode!==l.AlwaysHidden&&e.mode!==l.AlwaysVisible).map(e=>({id:e.name,name:e.description})).concat([]).reverse()},get visible(){return i.layers.filter(e=>e.visible).map(e=>e.name)}}));return d(y,{className:a.className,style:a.style,title:t("Map controls"),findLocationLabel:t("Find your location"),zoomInLabel:t("Zoom In"),zoomOutLabel:t("Zoom Out"),viewModeLabel:t("View switch"),fitToScreenLabel:t("Fit to screen"),layersLabel:t("Layers"),onFindLocation:()=>r.routeStore.findLocation(),onZoomIn:()=>o.zoomIn(),onZoomOut:()=>o.zoomOut(),onFitToScreen:()=>o.fitBounds(),onViewModeSwitch:()=>r.maplibreStore.activateMaplibre(),showModeSwitch:r.maplibreStore.maplibreEnabled&&!r.maplibreStore.hideModeSwitchButton,isMap3d:r.maplibreStore.isMap3d,showFindLocation:r.routeStore.canFindLocation&&!o.setKioskModeEnabled,layersActiveItems:a.visible,layersList:i.mode===b.CheckBox?a.layers:void 0,onChangeLayers:e=>{const n=i.layers.find(m=>m.name===e);n&&i.updateVisibility(e,!n.visible)}})});export default f;