UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 950 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{createTask as i}from"../../../core/asyncUtils.js";import{abortMaybe as t,removeMaybe as h}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{highlightsSupported as e}from"../../../views/support/layerViewUtils.js";class l{constructor(i){this._params=i,this._highlightTask=null,this._highlightHandle=null}destroy(){this.remove()}remove(){this._highlightTask=t(this._highlightTask),this._highlightHandle=h(this._highlightHandle)}update(t){if(this.remove(),null==t||!r(t))return;const h=t.layer;this._highlightTask=i((async i=>{const l=await this._params.view.whenLayerView(h);s(i);const r=e(l)?l:null;r&&(this._highlightHandle=r.highlight(t))}))}}function r(i){return null!=i.geometry&&"polyline"===i.geometry.type}export{l as InputRepresentation2D};