@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.04 kB
JavaScript
import t from"../../../core/Handles.js";import{destroyMaybe as e}from"../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{ElevationProfileState as n}from"./constants.js";import{HoveredPoints as o}from"./HoveredPoints.js";import{InputRepresentation2D as r}from"./InputRepresentation2D.js";class h{constructor(e,n){this._handles=new t,this._inputRepresentation=new r({view:e}),this._hoveredPoints=new o({view:e}),this._handles.add([i((()=>n.viewModel.hoveredPoints),(t=>this._hoveredPoints.update(t)),s),i((()=>{const{state:t,highlightEnabled:e,viewModel:i}=n;return{input:i.input,state:t,highlightEnabled:e}}),(t=>this._updateInputRepresentation(t)),s)])}destroy(){this._handles=e(this._handles),this._inputRepresentation=e(this._inputRepresentation),this._hoveredPoints=e(this._hoveredPoints)}_updateInputRepresentation({input:t,state:e,highlightEnabled:i}){e===n.Selected&&i?this._inputRepresentation.update(t):this._inputRepresentation.remove()}}export{h as ElevationProfileView2D};