@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 5.9 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{_ as o}from"../../../../chunks/tslib.es6.js";import t from"../../../../Color.js";import e from"../../../../core/Accessor.js";import{getContrast as l,desaturate as s,multiplyOpacity as i,unitRGBAFromColor as r}from"../../../../core/colorUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{ExtensionType as h}from"../visualElements/ExtendedLineVisualElement.js";import{RenderOccludedFlag as a}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as p}from"../../webgl-engine/materials/lineStippleUtils.js";const d=.3;function u(o,t){t&&Object.assign(o,t)}class g{constructor(o){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=a.Opaque,this.color=o.accent}}class f{constructor({colors:o,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=o.accent,this.outlineColor=o.outline,this.renderOccluded=a.Opaque,this.hoverOutlineColor=o.selectedOutline,u(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:r(o),renderOccluded:this.renderOccluded})}}class w{constructor({colors:o,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=a.Transparent,this.minSquaredEdgeLength=900,this.color=i(o.accent,.5),this.hoverColor=o.accent,u(this,t)}applyColor(o){this._apply(this.color,o)}applyHover(o){this._apply(this.hoverColor,o)}_apply(o,t){t.setParameters({color:r(o),renderOccluded:this.renderOccluded})}}class C{constructor(o){this.vertex=new f({colors:o,color:o.accent,outlineColor:o.outline}),this.edge=new f({colors:o,color:s(i(o.accent,2/3),.5),outlineColor:i(o.outline,.5),size:8,collisionPadding:8}),this.selected=new f({colors:o,color:o.selected,outlineColor:o.outline}),this.edgeOffset=new w({colors:o})}}class m{constructor({colors:o,...t}){this.width=1.5,this.stipplePattern=p(3.3),this.falloff=0,this.innerWidth=1.5,this.renderOccluded=a.OccludeAndTransparent,this.color=o.selected,this.stippleOffColor=o.outline,this.innerColor=o.selected,u(this,t)}apply(o){o.color=r(this.color),o.width=this.width,o.stipplePattern=this.stipplePattern,o.stippleOffColor=r(this.stippleOffColor),o.falloff=this.falloff,o.innerWidth=this.innerWidth,o.innerColor=r(this.innerColor),o.renderOccluded=this.renderOccluded}}class O{constructor({colors:o,...t}){this.size=4,this.outlineSize=1,this.shape="square",this.color=o.selected,this.outlineColor=o.outline,u(this,t)}apply(o){o.color=r(this.color),o.size=this.size,o.outlineSize=this.outlineSize,o.outlineColor=r(this.outlineColor),o.primitive=this.shape}}class y{constructor({colors:o,...t}){this.innerWidth=1,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=d,this.globalAlphaContrastBoost=1.5,this.radius=3,this.innerColor=o.selected,this.glowColor=o.accent,this.heightFillColor=o.accent,u(this,t)}apply(o,e=1){const l={glowColor:t.toUnitRGB(this.glowColor),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:t.toUnitRGB(this.innerColor),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*e*this.glowColor.a,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in o?o.style=l:o.laserlineStyle=l}}class A{constructor(o){this.outline=new m({colors:o,color:o.stippleOff,renderOccluded:a.OccludeAndTransparentStencil,stippleOffColor:o.stippleOn,innerWidth:0}),this.staged=new m({colors:o,color:o.stippleOn,renderOccluded:a.OccludeAndTransparentStencil,innerColor:o.stagedSolid,stippleOffColor:o.stippleOff}),this.shadowStyle=new y({colors:o,globalAlpha:d,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1})}}class W{constructor(o){this.outline=new O({colors:o,color:o.selected,outlineColor:o.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new y({colors:o,globalAlpha:d,glowColor:o.accent,glowFalloff:1.5,glowWidth:6,innerColor:o.selected,innerWidth:1,radius:2})}}class b extends m{constructor({colors:o,...t}){super({colors:o}),this.extensionType=h.GROUND_RAY,u(this,t)}}class S{constructor(o){this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20,this.lineObjects=new A(o),this.pointObjects=new W(o),this.heightPlane=new y({colors:o,globalAlpha:d,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1}),this.heightBox=new y({colors:o,globalAlpha:d,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:0,heightFillColor:o.accent}),this.zVerticalLine=new b({colors:o,color:i(o.accent,5*d/3),falloff:2,innerColor:i(o.selected,0),renderOccluded:a.OccludeAndTransparent,stipplePattern:null,width:5,extensionType:h.GROUND_RAY})}}let j=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 S(this.colors)}get manipulators(){return new C(this.colors)}get zManipulator(){return new g(this.colors)}};o([n()],j.prototype,"colors",null),o([n()],j.prototype,"visualElements",null),o([n()],j.prototype,"manipulators",null),o([n()],j.prototype,"zManipulator",null),o([n()],j.prototype,"getTheme",void 0),j=o([c("esri.views.3d.interactive.editingTools.settings")],j);export{j as Settings};