UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 822 B
import{createTask as i}from"../../../core/asyncUtils.js";import{abortMaybe as t,removeMaybe as h,isNone as s,isSome as e}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{highlightsSupported as l}from"../../../views/support/layerViewUtils.js";class o{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(),s(t)||!a(t))return;const h=t.layer;this._highlightTask=i((async i=>{const s=await this._params.view.whenLayerView(h);r(i);const e=l(s)?s:null;e&&(this._highlightHandle=e.highlight(t))}))}}function a(i){return e(i.geometry)&&"polyline"===i.geometry.type}export{o as InputRepresentation2D};