@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 1.19 kB
JavaScript
import{__decorate as r}from"tslib";import{action as l,computed as s,observable as n}from"mobx";import{computeOutdoorPoiFilterState as d}from"./outdoor-poi-filter";export default class t{constructor(e){this.markersBox=n.box([],{deep:!1}),this.generation=0,this.rootStore=e}get markers(){return this.markersBox.get()}addMany(e){e.length&&this.markersBox.set([...this.markers,...e])}clear(){this.generation+=1,this.markersBox.set([])}get selectedMarkerId(){const e=[...this.rootStore.uiState.selectedBooths],o=e.length===1?e[0]:void 0;return o&&this.markers.some(i=>i.boothId===o.id)?o.id:null}get selectionActive(){return this.selectedMarkerId!==null}get outdoorFilter(){const{uiState:e,boothStore:o}=this.rootStore;return d(e.selectedPoiTypeFilters.map(i=>i.id),e.selectedCategoryFilters.length>0,o.booths,this.markers)}get dimSuppressed(){return this.outdoorFilter.active||this.selectionActive}}r([l],t.prototype,"addMany",null),r([l],t.prototype,"clear",null),r([s({keepAlive:!0})],t.prototype,"selectedMarkerId",null),r([s({keepAlive:!0})],t.prototype,"selectionActive",null),r([s({keepAlive:!0})],t.prototype,"outdoorFilter",null),r([s({keepAlive:!0})],t.prototype,"dimSuppressed",null);