@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.15 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{R as e,k as s,l as t,f as i,g as a,m as r}from"./Theme.js";class n extends e{_beforeChanged(){super._beforeChanged(),(this.isDirty("cornerRadiusTL")||this.isDirty("cornerRadiusTR")||this.isDirty("cornerRadiusBR")||this.isDirty("cornerRadiusBL"))&&(this._clear=!0)}_draw(){let e=this.width(),a=this.height(),r=e,n=a,o=r/Math.abs(e),h=n/Math.abs(a);if(s(r)&&s(n)){let e=Math.min(r,n)/2,s=t(this.get("cornerRadiusTL",8),e),a=t(this.get("cornerRadiusTR",8),e),l=t(this.get("cornerRadiusBR",8),e),c=t(this.get("cornerRadiusBL",8),e),d=Math.min(Math.abs(r/2),Math.abs(n/2));s=i(s,0,d),a=i(a,0,d),l=i(l,0,d),c=i(c,0,d);const u=this._display;u.moveTo(s*o,0),u.lineTo(r-a*o,0),a>0&&u.arcTo(r,0,r,a*h,a),u.lineTo(r,n-l*h),l>0&&u.arcTo(r,n,r-l*o,n,l),u.lineTo(c*o,n),c>0&&u.arcTo(0,n,0,n-c*h,c),u.lineTo(0,s*h),s>0&&u.arcTo(0,0,s*o,0,s),u.closePath()}}}Object.defineProperty(n,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RoundedRectangle"}),Object.defineProperty(n,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:e.classNames.concat([n.className])});class o extends a{_afterNew(){this._settings.themeTags=r(this._settings.themeTags,["button"]),super._afterNew(),this._settings.background||this.set("background",n.new(this._root,{themeTags:r(this._settings.themeTags,["background"])})),this.setPrivate("trustBounds",!0)}_prepareChildren(){if(super._prepareChildren(),this.isDirty("icon")){const e=this._prevSettings.icon,s=this.get("icon");s!==e&&(this._disposeProperty("icon"),e&&e.dispose(),s&&this.children.push(s),this._prevSettings.icon=s)}if(this.isDirty("label")){const e=this._prevSettings.label,s=this.get("label");s!==e&&(this._disposeProperty("label"),e&&e.dispose(),s&&this.children.push(s),this._prevSettings.label=s)}}}Object.defineProperty(o,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Button"}),Object.defineProperty(o,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:a.classNames.concat([o.className])});export{o as B,n as R};