@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.45 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import e from"../../../core/Handles.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{ElevationProfileState as o}from"./constants.js";import{HoveredPoints as s}from"./HoveredPoints.js";import{InputRepresentation2D as r}from"./InputRepresentation2D.js";import{ProfileLine2D as h}from"./ProfileLine2D.js";class p{constructor(t,o){this._handles=new e,this._inputRepresentation=new r({view:t}),this._hoveredPoints=new s({view:t}),this._profileLine=new h({view:t}),this._handles.add([i((()=>o.viewModel.hoveredPoints),(e=>this._hoveredPoints.update(e)),n),i((()=>{const{state:e,highlightEnabled:t,viewModel:i}=o;return{input:i.input,state:e,highlightEnabled:t}}),(e=>this._updateInputRepresentation(e)),n),i((()=>o.viewModel.chartData),(e=>this._profileLine.update(e)),n),i((()=>o.viewModel.input?.geometry),(()=>{this._profileLine.remove()}),n)])}destroy(){this._handles=t(this._handles),this._inputRepresentation=t(this._inputRepresentation),this._hoveredPoints=t(this._hoveredPoints),this._profileLine=t(this._profileLine)}_updateInputRepresentation({input:e,state:t,highlightEnabled:i}){t===o.Selected&&i?this._inputRepresentation.update(e):this._inputRepresentation.remove()}}export{p as ElevationProfileView2D};