@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.45 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import e from"../../../core/Handles.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{HoveredPoints as o}from"./HoveredPoints.js";import{InputRepresentation3D as n}from"./InputRepresentation3D.js";import{ProfileLines3D as r}from"./ProfileLines3D.js";class h{constructor(t,h){this._handles=new e,this._inputRepresentation=new n({view:t}),this._hoveredPoints=new o({view:t}),this._profileLines=new r({view:t}),this._handles.add([i(()=>h.viewModel.hoveredPoints,e=>this._hoveredPoints.update(e),s),i(()=>{const{state:e,editable:t,highlightEnabled:i,viewModel:s}=h,o=s.input;return o&&(o.commitProperty("geometry"),o.commitProperty("layer")),{input:o,state:e,editable:t,highlightEnabled:i}},e=>this._updateInputRepresentation(e),s),i(()=>h.viewModel.chartData,e=>this._profileLines.update(e),s),i(()=>h.viewModel.input?.geometry,()=>{this._profileLines.remove()},s)])}destroy(){this._handles=t(this._handles),this._inputRepresentation=t(this._inputRepresentation),this._hoveredPoints=t(this._hoveredPoints),this._profileLines=t(this._profileLines)}_updateInputRepresentation({input:e,state:t,editable:i,highlightEnabled:s}){const o=this._inputRepresentation;if(!s)return o.remove();"selected"===t?o.showHighlight(e):"created"!==t||i?o.remove():o.showReshaping(e)}}export{h as ElevationProfileView3D};