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