UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.28 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{__decorate as i}from"tslib";import e from"../../../Graphic.js";import{isSome as t}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{when as a}from"../../../core/reactiveUtils.js";import{property as p,subclass as o}from"../../../core/accessorSupport/decorators.js";import{LayerView2D as c}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import l from"./graphics/GraphicsView2D.js";import n from"../../layers/GraphicsLayerView.js";import{getHighlightName as m}from"../../support/highlightOptionsUtils.js";let d=class extends(c(n)){attach(){this.graphicsView=new l({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this.layer.graphics,container:new g(this.view.featuresTilingScheme),layerId:this.layer.id}),this.container.addChild(this.graphicsView.container),this.addAttachHandles([this.layer.on("graphic-update",this.graphicsView.graphicUpdateHandler),a(()=>this.layer?.visible,()=>{this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate()})]),this._processHighlight()}detach(){this.container.removeAllChildren(),this.graphicsView=h(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map(e=>({type:"graphic",graphic:e,mapPoint:i,layer:this.layer})):null}queryGraphics(){return Promise.resolve(this.graphicsView.graphics)}update(i){this.graphicsView.processUpdate(i)}viewChange(){this.graphicsView.viewChange()}moveEnd(){}isUpdating(){return!this.graphicsView||this.graphicsView.updating}highlight(i,h){let a;"number"==typeof i?a=[i]:i instanceof e?a=[i.uid]:Array.isArray(i)&&i.length>0?a="number"==typeof i[0]?i:i.map(i=>i&&i.uid):r.isCollection(i)&&i.length>0&&(a=i.map(i=>i&&i.uid).toArray());const p=a?.filter(t);if(!p?.length)return s();const o=m(h);return this._addHighlights(p,o),s(()=>!this.destroyed&&this._removeHighlights(p,o))}_processHighlight(){const i=this._getHighlights();this.graphicsView?.setHighlight(i)}};i([p()],d.prototype,"graphicsView",void 0),d=i([o("esri.views.2d.layers.GraphicsLayerView2D")],d);const w=d;export{w as default};