UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.94 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 e}from"../../core/accessorSupport/decorators/subclass.js";import{negativeInfinity as s,pad as i,expandWithNestedArray as l,create as a,width as n,height as p}from"../../geometry/support/aaBoundingRect.js";import"../../widgets/support/widgetUtils.js";import{tsx as d}from"../../widgets/support/jsxFactory.js";let h=class extends t{constructor(o){super(o),this.coordinates=void 0,this.strokeDash=[],this.strokeWidth=1,this.strokeColor=[0,0,0,1],this.strokeDashColor=[255,255,255,1],this.fillColor=[0,0,0,0],this.visible=!0,this.isDecoration=!0}get _strokeStyle(){const o=this.strokeColor;return`rgba(${o[0]}, ${o[1]}, ${o[2]}, ${o[3]})`}get _strokeBackgroundStyle(){const o=this.strokeDashColor;return`rgba(${o[0]}, ${o[1]}, ${o[2]}, ${o[3]})`}get _fillStyle(){const o=this.fillColor;return`rgba(${o[0]}, ${o[1]}, ${o[2]}, ${o[3]})`}get _renderCoordinates(){const o=[];if(!this.coordinates)return{coordinates:o,rect:s};const t=i(l(a(s),this.coordinates),2*this.strokeWidth);t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]+.5),t[3]=Math.ceil(t[3]+.5);for(const r of this.coordinates)o.push([Math.floor(r[0]-t[0])+.5,Math.floor(r[1]-t[1])+.5]);return o.reverse(),{coordinates:o,rect:t}}render(){const{coordinates:o,rect:t}=this._renderCoordinates,r=n(t),e=p(t);return d("div",{classes:{"esri-outline-overlay-item":!0},styles:{left:t[0]+"px",top:t[1]+"px",width:r+"px",height:e+"px",visibility:this.visible?"visible":"hidden"}},d("svg",{height:e,styles:{display:"block"},width:r},d("polygon",{fill:this._fillStyle,points:o.map((([o,t])=>`${o},${t}`)).join(" "),stroke:this._strokeBackgroundStyle,"stroke-width":this.strokeWidth}),d("polygon",{fill:"transparent",points:o.map((([o,t])=>`${o},${t}`)).join(" "),stroke:this._strokeStyle,"stroke-dasharray":this.strokeDash.length?this.strokeDash.join(" "):void 0,"stroke-width":this.strokeWidth})))}renderCanvas(){}};o([r()],h.prototype,"coordinates",void 0),o([r()],h.prototype,"strokeDash",void 0),o([r()],h.prototype,"strokeWidth",void 0),o([r()],h.prototype,"strokeColor",void 0),o([r()],h.prototype,"strokeDashColor",void 0),o([r()],h.prototype,"fillColor",void 0),o([r()],h.prototype,"visible",void 0),o([r()],h.prototype,"isDecoration",void 0),o([r({readOnly:!0})],h.prototype,"_strokeStyle",null),o([r({readOnly:!0})],h.prototype,"_strokeBackgroundStyle",null),o([r({readOnly:!0})],h.prototype,"_fillStyle",null),o([r({readOnly:!0})],h.prototype,"_renderCoordinates",null),h=o([e("esri.views.overlay.OutlineOverlayItem")],h);const c=h;export{c as default};