UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.46 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{d as r,h as o,t as n,n as i}from"../../../chunks/vec32.js";import{sv3d as c,sm4d as l}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as a}from"../../../layers/graphics/hydratedFeatures.js";import{manipulatedObjectGeometry as s}from"./editingTools/manipulatedObjectUtils.js";import{computeCentroid as u}from"../layers/graphics/graphicUtils.js";import{CullFaceOptions as m}from"../webgl-engine/lib/basicInterfaces.js";import{RenderOccludedFlag as p}from"../webgl-engine/lib/Material.js";import{ColorMaterial as g}from"../webgl-engine/materials/ColorMaterial.js";import{ShadedColorMaterial as d}from"../webgl-engine/materials/ShadedColorMaterial.js";function f(t,r=p.OccludeAndTransparent,o=!0){const n=e(t),i=!(t[3]<1);return o?new d({color:n,writeDepth:i,cullFace:m.Back,renderOccluded:r,isDecoration:!0}):new g({color:n,writeDepth:i,cullFace:m.Back,renderOccluded:r,isDecoration:!0})}function h(t,r=p.OccludeAndTransparent){const o=e(t);return new g({color:o,writeDepth:!0,cullFace:m.Front,renderOccluded:r,isDecoration:!0})}const j=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1}),b=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function w(e,i,a,s){const u=r(c.get(),e,a),m=O(u,o(c.get(),s,u),a,l.get());t(m,m);const p=n(c.get(),i,m);return Math.atan2(p[1],p[0])}function O(e,t,r,n){const l=i(c.get(),e),a=i(c.get(),t),s=o(c.get(),l,a);return n[0]=l[0],n[1]=l[1],n[2]=l[2],n[3]=0,n[4]=a[0],n[5]=a[1],n[6]=a[2],n[7]=0,n[8]=s[0],n[9]=s[1],n[10]=s[2],n[11]=0,n[12]=r[0],n[13]=r[1],n[14]=r[2],n[15]=1,n}function D(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function F(e,t){const r=t.origin;null==r?y(e,s(t)):e.elevationAlignedLocation=r}function y(e,t){if(null==t)return;const r="mesh"===t.type?t.origin:u(t);null!=r&&(e.location=a(r))}export{w as calculateInputRotationTransform,O as calculateTranslateRotateFromBases,f as createManipulatorMaterial,h as createManipulatorOutlineMaterial,D as getGraphicAttachmentOrigin,F as placeAtObject,j as rotateManipulatorDefaults,b as worldScaledManipulatorSettings};