UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.92 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as r}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"../../widgets/support/widgetUtils.js";import{tsx as e}from"../../widgets/support/jsxFactory.js";let s=class extends t{constructor(o){super(o),this.strokeDash=[],this.strokeWidth=2,this.strokeColor=[0,0,0,1],this.strokeBackgroundColor=[0,0,0,0],this.fillColor=[0,0,0,0],this.backgroundFillColor=[0,0,0,.5],this.visible=!0,this.isDecoration=!1,this.boxWidth=0,this.boxHeight=0,this.backgroundWidth=0,this.backgroundHeight=0,this.padding={left:0,top:0,right:0,bottom:0}}get _strokeStyle(){return`rgba(${this.strokeColor.join()})`}get _strokeBackgroundStyle(){return`rgba(${this.strokeBackgroundColor.join()})`}get _fillStyle(){return`rgba(${this.fillColor.join()})`}get _backgroundFillStyle(){return`rgba(${this.backgroundFillColor.join()})`}render(){const{backgroundWidth:o,backgroundHeight:t,boxWidth:r,boxHeight:i,padding:s}=this,l=s.left,d=s.top,p=this.x??l+o/2-r/2,h=this.y??d+t/2-i/2,a=p+r,n=h+i;return e("div",{classes:{"esri-box-overlay-item":!0},styles:{left:"0px",top:"0px",width:"100%",height:"100%",visibility:this.visible?"visible":"hidden"}},e("svg",{styles:{width:"100%",height:"100%"}},e("path",{d:`M ${l} ${d} L ${o+l} ${d} L ${o+l} ${t+d} L ${l} ${t+d} Z M ${p} ${h} L ${p} ${n} L ${a} ${n} L ${a} ${h} Z`,fill:this._backgroundFillStyle,stroke:this._strokeBackgroundStyle,"stroke-width":this.strokeWidth}),e("rect",{fill:this._fillStyle,height:i,stroke:this._strokeStyle,"stroke-dasharray":this.strokeDash.join(" ")||void 0,"stroke-width":this.strokeWidth,width:r,x:p,y:h})))}renderCanvas(){}};o([r()],s.prototype,"strokeDash",void 0),o([r()],s.prototype,"strokeWidth",void 0),o([r()],s.prototype,"strokeColor",void 0),o([r()],s.prototype,"strokeBackgroundColor",void 0),o([r()],s.prototype,"fillColor",void 0),o([r()],s.prototype,"backgroundFillColor",void 0),o([r()],s.prototype,"visible",void 0),o([r()],s.prototype,"isDecoration",void 0),o([r()],s.prototype,"boxWidth",void 0),o([r()],s.prototype,"boxHeight",void 0),o([r()],s.prototype,"backgroundWidth",void 0),o([r()],s.prototype,"backgroundHeight",void 0),o([r()],s.prototype,"x",void 0),o([r()],s.prototype,"y",void 0),o([r()],s.prototype,"padding",void 0),o([r({readOnly:!0})],s.prototype,"_strokeStyle",null),o([r({readOnly:!0})],s.prototype,"_strokeBackgroundStyle",null),o([r({readOnly:!0})],s.prototype,"_fillStyle",null),o([r({readOnly:!0})],s.prototype,"_backgroundFillStyle",null),s=o([i("esri.views.overlay.BoxOverlayItem")],s);const l=s;export{l as default};