UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.62 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import o from"../../core/Accessor.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import{tsx as e}from"../../widgets/support/widget.js";let s=class extends o{constructor(t){super(t),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:t,backgroundHeight:o,boxWidth:r,boxHeight:i,padding:s}=this,l=s.left,d=s.top,h=this.x??l+t/2-r/2,p=this.y??d+o/2-i/2,a=h+r,n=p+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 ${t+l} ${d} L ${t+l} ${o+d} L ${l} ${o+d} Z M ${h} ${p} L ${h} ${n} L ${a} ${n} L ${a} ${p} 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:h,y:p})))}renderCanvas(){}};t([r()],s.prototype,"strokeDash",void 0),t([r()],s.prototype,"strokeWidth",void 0),t([r()],s.prototype,"strokeColor",void 0),t([r()],s.prototype,"strokeBackgroundColor",void 0),t([r()],s.prototype,"fillColor",void 0),t([r()],s.prototype,"backgroundFillColor",void 0),t([r()],s.prototype,"visible",void 0),t([r()],s.prototype,"isDecoration",void 0),t([r()],s.prototype,"boxWidth",void 0),t([r()],s.prototype,"boxHeight",void 0),t([r()],s.prototype,"backgroundWidth",void 0),t([r()],s.prototype,"backgroundHeight",void 0),t([r()],s.prototype,"x",void 0),t([r()],s.prototype,"y",void 0),t([r()],s.prototype,"padding",void 0),t([r({readOnly:!0})],s.prototype,"_strokeStyle",null),t([r({readOnly:!0})],s.prototype,"_strokeBackgroundStyle",null),t([r({readOnly:!0})],s.prototype,"_fillStyle",null),t([r({readOnly:!0})],s.prototype,"_backgroundFillStyle",null),s=t([i("esri.views.overlay.BoxOverlayItem")],s);const l=s;export{l as default};