UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.53 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as i}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{when as h}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView2DMixin as c}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import l from"./graphics/GraphicsView2D.js";import n from"../../layers/LayerView.js";import{defaultHighlightName as m}from"../../support/HighlightDefaults.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),h((()=>this.layer?.visible),(()=>{this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate()}))]),this._processHighlight()}detach(){this.container.removeAllChildren(),this.graphicsView=a(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map((r=>({type:"graphic",graphic:r,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,a){let h;"number"==typeof i?h=[i]:i instanceof r?h=[i.uid]:Array.isArray(i)&&i.length>0?h="number"==typeof i[0]?i:i.map((i=>i&&i.uid)):s.isCollection(i)&&i.length>0&&(h=i.map((i=>i&&i.uid)).toArray());const o=h?.filter(e);if(!o?.length)return t();const p=a?.name??m;return this._addHighlights(o,p),t((()=>!this.destroyed&&this._removeHighlights(o,p)))}_processHighlight(){const i=this._getHighlights();this.graphicsView?.setHighlight(i)}};i([o()],d.prototype,"graphicsView",void 0),d=i([p("esri.views.2d.layers.GraphicsLayerView2D")],d);const w=d;export{w as default};