UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 5.36 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as o}from"tslib";import t from"../../../../Color.js";import e from"../../../../core/Accessor.js";import{getContrast as l,multiplyOpacity as i,desaturate as s}from"../../../../core/colorUtils.js";import{property as r,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{createStipplePatternSimple as c}from"../../webgl-engine/materials/lineStippleUtils.js";const h=.3;function a(o,t){t&&Object.assign(o,t)}class d{constructor(o){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=16,this.color=o.accent}}class p{constructor({colors:o,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=o.accent,this.outlineColor=o.outline,this.renderOccluded=16,this.hoverOutlineColor=o.selectedOutline,a(this,t)}applyColor(o){this._apply(this.color,o)}applyOutline(o){this._apply(this.outlineColor,o)}applyHoverOutline(o){this._apply(this.hoverOutlineColor,o)}_apply(o,t){t.setParameters({color:o.toUnitRGBA(),renderOccluded:this.renderOccluded})}}class u{constructor({colors:o,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=2,this.minSquaredEdgeLength=900,this.color=i(o.accent,.5),this.hoverColor=o.accent,a(this,t)}applyColor(o){this._apply(this.color,o)}applyHover(o){this._apply(this.hoverColor,o)}_apply(o,t){t.setParameters({color:o.toUnitRGBA(),renderOccluded:this.renderOccluded})}}class g{constructor(o){this.vertex=new p({colors:o,color:o.accent,outlineColor:o.outline}),this.edge=new p({colors:o,color:s(i(o.accent,2/3),.5),outlineColor:i(o.outline,.5),size:8,collisionPadding:8}),this.selected=new p({colors:o,color:o.selected,outlineColor:o.outline}),this.edgeOffset=new u({colors:o})}}class f{constructor({colors:o,...t}){this.width=1.5,this.stipplePattern=c(3.3),this.falloff=0,this.innerWidth=1.5,this.renderOccluded=4,this.color=o.selected,this.stippleOffColor=o.outline,this.innerColor=o.selected,a(this,t)}apply(o){o.color=this.color.toUnitRGBA(),o.width=this.width,o.stipplePattern=this.stipplePattern,o.stippleOffColor=this.stippleOffColor.toUnitRGBA(),o.falloff=this.falloff,o.innerWidth=this.innerWidth,o.innerColor=this.innerColor.toUnitRGBA(),o.renderOccluded=this.renderOccluded}}class w{constructor({colors:o,...t}){this.size=4,this.outlineSize=1,this.shape="square",this.color=o.selected,this.outlineColor=o.outline,a(this,t)}apply(o){o.color=this.color.toUnitRGBA(),o.size=this.size,o.outlineSize=this.outlineSize,o.outlineColor=this.outlineColor.toUnitRGBA(),o.primitive=this.shape}}class C{constructor({colors:o,...t}){this.innerWidth=1,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=h,this.globalAlphaContrastBoost=1.5,this.radius=3,this.innerColor=o.selected,this.glowColor=o.accent,this.heightFillColor=o.accent,a(this,t)}apply(o,t=1){const e={glowColor:this.glowColor.toUnitRGB(),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:this.innerColor.toUnitRGB(),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*t*this.glowColor.a,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in o?o.style=e:o.laserlineStyle=e}}class y{constructor(o){this.outline=new f({colors:o,color:o.stippleOff,renderOccluded:8,stippleOffColor:o.stippleOn,innerWidth:0}),this.staged=new f({colors:o,color:o.stippleOn,renderOccluded:8,innerColor:o.stagedSolid,stippleOffColor:o.stippleOff}),this.shadowStyle=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1})}}class O{constructor(o){this.outline=new w({colors:o,color:o.selected,outlineColor:o.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:1.5,glowWidth:6,innerColor:o.selected,innerWidth:1,radius:2})}}class m extends f{constructor({colors:o,...t}){super({colors:o}),this.extensionType=2,a(this,t)}}class A{constructor(o){this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20,this.lineObjects=new y(o),this.pointObjects=new O(o),this.heightPlane=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1}),this.heightBox=new C({colors:o,globalAlpha:h,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:0,heightFillColor:o.accent}),this.zVerticalLine=new m({colors:o,color:i(o.accent,5*h/3),falloff:2,innerColor:i(o.selected,0),renderOccluded:4,stipplePattern:null,width:5,extensionType:2})}}let W=class extends e{constructor(o){super(o)}get colors(){const o=this.getTheme().accentColor,e=o.a;return{accent:o,contrast:l(o),selected:t.fromArray([255,255,255,e]),selectedOutline:t.fromArray([255,255,255,e]),staged:t.fromArray([12,207,255,e]),stagedSolid:t.fromArray([12,207,255,1]),outline:t.fromArray([0,0,0,.5*e]),stippleOn:t.fromArray([255,255,255,1]),stippleOff:t.fromArray([0,0,0,.5])}}get visualElements(){return new A(this.colors)}get manipulators(){return new g(this.colors)}get zManipulator(){return new d(this.colors)}};o([r()],W.prototype,"colors",null),o([r()],W.prototype,"visualElements",null),o([r()],W.prototype,"manipulators",null),o([r()],W.prototype,"zManipulator",null),o([r()],W.prototype,"getTheme",void 0),W=o([n("esri.views.3d.interactive.editingTools.settings")],W);export{W as Settings};