UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 1.12 kB
import{createLayerDef as r}from"../../../../renderer";import i from"../../../../store";import{isPathwayLayer as d}from"../../../../utils/is-pathway-layer";import{WF_CURRENT_POSITION_LAYER_NAME as u,WF_LINES_ANIMATED_LAYER_NAME as N,WF_LINES_LAYER_NAME as R,WF_POINTS_LAYER_NAME as h,WF_TRAIL_LAYER_NAME as M}from"../../../../wayfinding/layers";import{createTrafficLayers as w}from"../../traffic/trafficLayers";import{configBoothsBadges as I}from"./config-booth-badge";import P from"./config-load-layer";import{MARKER_LAYER_NAME as T}from"./config-markers";export default function S(n){const{defaultLayer:a}=i.layerStore;let{layers:o}=i.layerStore;if(a){const e=[...o],s=o.indexOf(a);e.splice(s,1),o=[a,...e]}const L=o.filter(e=>!e.rootParent).map(e=>P(e,n));return Promise.all(L).then(e=>{const s=r(h,[],{dim:!1,interactive:!0}),c=r(R,[],{dim:!1}),y=r(T,[]),p=r(M,[],{dim:!1}),_=r(N,[],{dim:!1}),A=r(u,[],{dim:!1}),f=[],l=[];for(const t of e.flat())d(t.name)?(t.dim=!1,l.push(t)):f.push(t);const{layer:m,cleanup:E}=I(n,"root",i.boothStore.booths);return{layers:[...f,...m?[m]:[],...l,...w(),y,p,c,_,s,A],cleanup:E}})}