@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.65 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import e from"../../../../Color.js";import{multiplyOpacity as t,getContrast as r}from"../../../../core/colorUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{watch as o,initial as s}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as n}from"./sliceToolUtils.js";import{Manipulator3D as a}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as l}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{Attribute as m}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as f}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as p}from"../../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as b}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as j}from"../../../interactive/interfaces.js";class w extends a{constructor(i,n){const a=t(i.effectiveTheme.accentColor,.5),c=r(i.effectiveTheme.accentColor),m=n(a,c),u=new b({draped:!1,texture:m.texture,writeDepth:!1,renderOccluded:f.Opaque,isDecoration:!0}),d=l.calloutWidth,p=new h({width:d,renderOccluded:f.OccludeAndTransparent,isDecoration:!0});super({view:i,...g({imageMaterial:u,calloutMaterial:p})}),this._material=u,this._textureHandle=m,this._themeHandle=o((()=>i.effectiveTheme.accentColor),(i=>{const o=t(i,.5),s=r(i),a=this._textureHandle;this._textureHandle=n(o,s),u.setParameters({texture:this._textureHandle.texture}),a?.release(),p.setParameters({color:e.toUnitRGBA(i)})}),s)}destroy(){this._textureHandle=i(this._textureHandle),this._themeHandle.remove(),this._material.dispose(),super.destroy()}}function g({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=l,s=o*r,a=(e,t)=>{const r=[0,1,2,2,3,0];return new u(t,[[p.POSITION,new m([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],[p.UV0,new m([0,0,1,0,1,1,0,1],r,2,!0)]])},f=d(t,[[0,0,0],[i-o,0,0]]),b=d(t,[[0,0,0],[i-s,0,0]]),h=n;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new c(a(o,e),j.Unfocused|h),new c(f,j.Unfocused|h),new c(a(s,e),j.Focused|h),new c(b,j.Focused|h)],state:h}}export{w as RotateManipulator};