@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.29 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{multiplyOpacity as e,getContrast as t}from"../../../../core/colorUtils.js";import{releaseMaybe as r}from"../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as a}from"./sliceToolUtils.js";import{Manipulator3D as s}from"../../interactive/Manipulator3D.js";import{rotateManipulatorDefaults as n}from"../../interactive/manipulatorUtils.js";import{RenderObject as l}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 d}from"../../webgl-engine/lib/GeometryUtil.js";import{ImageMaterial as u}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as p}from"../../webgl-engine/materials/RibbonLineMaterial.js";class f extends s{constructor(r,a){const s=e(r.effectiveTheme.accentColor,.5),l=t(r.effectiveTheme.accentColor),c=a(s,l),m=new u({draped:!1,managedTexture:c.managedTexture,writeDepth:!1,renderOccluded:16,isDecoration:!0}),d=n.calloutWidth,f=new p({width:d,renderOccluded:4,isDecoration:!0},r.state.isGlobal);super({view:r,...h({imageMaterial:m,calloutMaterial:f})}),this._material=m,this._textureHandle=c,this._themeHandle=i(()=>r.effectiveTheme.accentColor,r=>{const i=e(r,.5),o=t(r),s=this._textureHandle;this._textureHandle=a(i,o),m.setParameters({managedTexture:this._textureHandle.managedTexture}),s?.release(),f.setParameters({color:r.toUnitRGBA()})},o)}destroy(){this._textureHandle=r(this._textureHandle),this._themeHandle.remove(),this._material.dispose(),super.destroy()}}function h({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:r,calloutLength:i,discRadius:o}=n,s=o*r,u=(e,t)=>{const r=[0,1,2,2,3,0];return new m(t,[["position",new c([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],r,3,!0)],["uv0",new c([0,0,1,0,1,1,0,1],r,2,!0)]])},p=d(t,[[0,0,0],[i-o,0,0]]),f=d(t,[[0,0,0],[i-s,0,0]]),h=a;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[i,0,0]},focusMultiplier:r,radius:o,renderObjects:[new l(u(o,e),1|h),new l(p,1|h),new l(u(s,e),2|h),new l(f,2|h)],state:h}}export{f as RotateManipulator};