@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.43 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Evented.js";import{when as t,watch as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as n}from"../../geometry/projectionUtils.js";let c=class extends o.EventedAccessor{constructor(e){super(e),this.location=null,this.screenLocationEnabled=!1,this.view=null,this.addHandles([t((()=>{const e=this.screenLocationEnabled?this.view:null;return e?[e.size,"3d"===e.type?e.camera:e.viewpoint]:null}),(()=>this.notifyChange("screenLocation"))),r((()=>this.screenLocation),((e,o)=>{null!=e&&null!=o&&this.emit("view-change")}))])}destroy(){this.view=null}get screenLocation(){const{location:e,view:o,screenLocationEnabled:t}=this,r=o?.spatialReference,s=r?n(e,r).geometry:null;return t&&s&&o?.ready?o.toScreen(s):null}};e([s()],c.prototype,"location",void 0),e([s()],c.prototype,"screenLocation",null),e([s()],c.prototype,"screenLocationEnabled",void 0),e([s()],c.prototype,"view",void 0),c=e([i("esri.widgets.support.AnchorElementViewModel")],c);export{c as default};