@arcgis/core 4.27.0-next.20230320 → 4.27.0-next.20230321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
- package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
- package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
- package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
- package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
- package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
- package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
- package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
- package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
- package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
- package/chunks/ColorMaterial.glsl.js +16 -14
- package/interfaces.d.ts +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/CloudsData.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/interfaces.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/buffer/workerHelper.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Upload.js +5 -0
- package/widgets/Editor/UploadState.js +4 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
- package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
- package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
- package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
- package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
- package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import e from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as i}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{q as r,b as s,k as a,m as c,r as l,i as u,w as d,F as m}from"../../../../chunks/mat4.js";import{c as g}from"../../../../chunks/mat4f64.js";import{r as p}from"../../../../chunks/quat.js";import{g as f,c as b,e as h,f as T,n as w,a as O,l as E,b as I,s as R,p as j,w as A}from"../../../../chunks/vec3.js";import{a as L,c as _,f as C}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as N}from"../../../../geometry/projection.js";import{Axis as P}from"../../../../geometry/support/Axis.js";import{r as M,f as v,i as U,a as V,n as y,u as S}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as k,fromPositionAndNormal as H}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{angleAroundAxis as F}from"../../../../geometry/support/vector.js";import{sv3d as G,sm4d as D,sq4d as X}from"../../../../geometry/support/vectorStacks.js";import{VERTICAL_DOT_THRESHOLD as Y,SMALL_ANGLE_DOT_THRESHOLD as Z,PLANE_MIN_BASIS_SCREEN_LEN2 as W,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as q,SHIFT_RESTART_OFFSET_DISTANCE as B,RESIZE_HANDLE_EDGE_PADDING_FRAC as z,SHIFT_RESTART_CALLOUT_COLOR as $,SHIFT_RESTART_TIP_RADIUS as J,PLANE_OUTLINE_COLOR as K,PLANE_OUTLINE_WIDTH as Q,PLANE_BACKGROUND_COLOR as ee,GRID_COLOR as te,RESIZE_HANDLE_CORNER_INPUT_RADIUS as ne,RESIZE_HANDLE_EDGE_INPUT_RADIUS as ie,SHIFT_RESTART_ARROW_TIP_COLOR as oe,SHIFT_RESTART_ARROW_CAP_COLOR as re,SHIFT_RESTART_TUBE_COLOR as se,SHIFT_RESTART_OUTLINE_COLOR as ae,SHIFT_RESTART_TIP_LENGTH as ce,SHIFT_RESTART_ARROW_LENGTH as le,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as ue,RESIZE_HANDLE_CORNER_WIDTH as de,RESIZE_HANDLE_EDGE_WIDTH as me,DISPLAY_FOCUS_MULTIPLIER as ge,SHIFT_RESTART_TUBE_RADIUS as pe,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as fe,RESIZE_HANDLE_COLOR as be,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as he}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as Te}from"../support/projectionUtils.js";import{Manipulator3D as we}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as Oe,createRotateManipulator as Ee,worldScaledManipulatorSettings as Ie}from"../../interactive/manipulatorUtils.js";import{RenderObject as Re}from"../../interactive/RenderObject.js";import{LineVisualElement as je}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as Ae}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Le}from"../../support/RenderCoordsHelper.js";import{fromRender as _e}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as Ce}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as Ne,createConeGeometry as Pe,createPathExtrusionGeometry as Me}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ve}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Ue}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Ve}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as ye}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as Se,ManipulatorStateFlags as ke}from"../../../interactive/interfaces.js";import He from"../../../../geometry/Extent.js";function xe(e,t,n,i,o,r,s,a){return Fe(t,s.worldUpAtPosition(e,G.get()),o,r,a.basis1,a.basis2),f(a.basis1,a.basis1,n),f(a.basis2,a.basis2,i),b(a.origin,e),k(a.basis2,a.basis1,a.origin,a.plane),a}function Fe(e,t,n,i,o,r){const s=h(e,t),a=G.get(),c=G.get();switch(i===Et.HORIZONTAL_OR_VERTICAL?Math.abs(s)>Y?Et.HORIZONTAL:Et.VERTICAL:i){case Et.VERTICAL:{const i=Math.abs(s)<=Z?e:n.viewUp;T(a,i,t),b(c,t);break}case Et.HORIZONTAL:T(a,n.viewUp,t),T(c,t,a);break;case Et.TILTED:{const i=Math.abs(s)<=Z?t:n.viewUp;T(a,i,e),T(c,e,a);break}}const l=T(G.get(),a,c);h(l,n.viewForward)>0&&f(c,c,-1),w(o,a),w(r,c)}function Ge(e,t,n){const i=t.worldUpAtPosition(e.origin,G.get()),o=e.basis1,r=pt(e,i),s=Math.round(r/jt)*jt;return M(e,s-r,o,n)}function De(e,t,n,i,o,r){const s=b(G.get(),o.origin);O(s,s,f(G.get(),o.basis1,e.direction[0]<0?1:-1)),O(s,s,f(G.get(),o.basis2,e.direction[1]<0?1:-1));const a=E(o.basis1),c=E(o.basis2),l=I(G.get(),n,s),u=I(G.get(),t,s);let d=0,m=0;if(it(e)){const t=nt(o),n=nt(r);d=a-.5*e.direction[0]*h(o.basis1,u)/a,m=c-.5*e.direction[1]*h(o.basis2,u)/c;const i=n/t;d*=i,m*=i}const g=d+.5*e.direction[0]*h(o.basis1,l)/a,p=m+.5*e.direction[1]*h(o.basis2,l)/c,T=f(G.get(),o.basis1,g/a),w=f(G.get(),o.basis2,p/c);(g<=0||et(r.origin,T,i)<=W)&&b(T,r.basis1),(p<=0||et(r.origin,w,i)<=W)&&b(w,r.basis2);const R=b(G.get(),s);return O(R,R,f(G.get(),T,e.direction[0]<0?-1:1)),O(R,R,f(G.get(),w,e.direction[1]<0?-1:1)),v(R,T,w,r)}function Xe(e,t){return q*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function Ye(e,t,n,i){const o=T(G.get(),t,n);return T(o,o,t),H(e,o,i)}function Ze(e,t){return Oe(e.basis1,e.basis2,e.origin,t)}function We(e,t,n,i){const o=t.worldUpAtPosition(e.origin,G.get()),r=G.get();switch(n){case Ot.HEADING:b(r,o);break;case Ot.TILT:b(r,e.basis1)}return H(e.origin,r,i)}function qe(e,t,n,i){const s=Qe(n,Ke.NEGATIVE_X),a=D.get();r(a,t,s.edge*Math.PI/2);const c=w(G.get(),s.basis);let l=f(G.get(),c,s.direction*i.computeScreenPixelSizeAt(s.position)*B);O(l,l,s.position);const u=i.projectToRenderScreen(l,o(G.get())),d=Be(i,u);_e(i,u,Rt),w(Rt.direction,Rt.direction);const m=G.get();!d&&U(n,Rt,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=L(l),d?e.state|=It:e.state&=~It}function Be(e,t){const[n,i,o,r]=e.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<n+s?(t[0]=n+s,a=!1):t[0]>n+o-s&&(t[0]=n+o-s,a=!1),t[1]<i+s?(t[1]=i+s,a=!1):t[1]>i+r-s&&(t[1]=i+r-s,a=!1),a}function ze(e,t,n,i){const o=E(i.basis1),r=E(i.basis2),l=tt(i),u=nt(i),d=R(G.get(),0,0,0);O(d,f(G.get(),i.basis1,t.direction[0]),f(G.get(),i.basis2,t.direction[1])),O(d,i.origin,d);let m=0,g=1;if(it(t))1===t.direction[0]&&-1===t.direction[1]?m=jt:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),g=u;else{const e=0!==t.direction[0]?1:2;m=1===e?jt:0,g=(1===e?r:o)-l}const p=s(D.get(),m);a(p,p,R(G.get(),g,g,g)),c(p,n,p),p[12]=0,p[13]=0,p[14]=0,e.modelTransform=p,e.renderLocation=d}function $e(e,t,n,i){const o=i.worldUpAtPosition(n.origin,G.get()),r=Qe(n,Ke.POSITIVE_X),a=s(D.get(),r.edge*Math.PI/2);l(a,a,-pt(n,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=r.position}function Je(e,t,n){const i=Qe(n,Ke.POSITIVE_Y),o=s(D.get(),i.edge*Math.PI/2);l(o,o,jt),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,e.modelTransform=o,e.renderLocation=i.position}var Ke;function Qe(e,t){switch(t){case Ke.POSITIVE_X:return{basis:e.basis1,direction:1,position:O(G.get(),e.origin,e.basis1),edge:t};case Ke.POSITIVE_Y:return{basis:e.basis2,direction:1,position:O(G.get(),e.origin,e.basis2),edge:t};case Ke.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:I(G.get(),e.origin,e.basis1),edge:t};case Ke.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:I(G.get(),e.origin,e.basis2),edge:t}}}function et(e,t,n){const i=n.projectToRenderScreen(O(G.get(),e,t),o(G.get())),r=n.projectToRenderScreen(I(G.get(),e,t),o(G.get()));return j(I(i,i,r))}function tt(e){const t=E(e.basis1),n=E(e.basis2);return z*Math.min(t,n)}function nt(e){return tt(e)}function it(e){return 0!==e.direction[0]&&0!==e.direction[1]}function ot(e,t=_t.CENTER_ON_ARROW){const n=t===_t.CENTER_ON_CALLOUT?B:0,i=[C(n,0,-le/2),C(n,0,le/2)],o=dt(i,!0),r=(e,t)=>lt(i,e,t),s=r(0,!1),a=r(ue,!0),c=new Ve({color:$,renderOccluded:ve.OccludeAndTransparent}),l=Ne(c,[[n,0,0],[n-B,0,0]]),u=Ne(c,[[n,0,0],[n-B,0,0]]);return new we({view:e,renderObjects:[...s.normal.map((e=>new Re(e,ke.Unfocused|wt))),...a.normal.map((e=>new Re(e,ke.Unfocused|wt))),new Re(l,ke.Unfocused|wt|It),...s.focused.map((e=>new Re(e,ke.Focused|wt))),...a.focused.map((e=>new Re(e,ke.Focused|wt))),new Re(u,ke.Focused|wt|It)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[o]},collisionPriority:1,radius:J,state:wt})}function rt(e,t){const n=Ee(e,{customStateMask:wt,texture:t});return n.state=wt,n}function st(e){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new je({view:e,attached:!1,color:K,width:Q,writeDepthEnabled:!1,renderOccluded:ve.OccludeAndTransparent,geometry:[t]})}function at(e){return new Ae({view:e,attached:!1,backgroundColor:[...ee],gridColor:te,gridWidth:4,renderOccluded:ve.OccludeAndTransparent})}function ct(e,t){const n=it(t),i=n?[C(1,0,0),C(0,0,0),C(0,1,0)]:[C(1,0,0),C(-1,0,0)],o=be,r=e=>new ye({color:o,width:e,renderOccluded:ve.OccludeAndTransparent}),s=()=>new Ve({color:o,renderOccluded:ve.OccludeAndTransparent}),a=n?de:me,c=a*ge,l=me,u=e=>e>1?r(e):s(),d=[new Re(Ne(u(a),i),ke.Unfocused|At),new Re(Ne(u(c),i),ke.Focused|At),new Re(Ne(u(l),i),Lt)],m=new we({view:e,renderObjects:d,collisionType:{type:"line",paths:[i]},radius:n?ne:ie,...Ie});return m.state=At,m}function lt(e,t,n){const i=new Ue({color:oe,cullFace:Ce.Back,renderOccluded:ve.Opaque}),o=new Ue({color:re,cullFace:Ce.Back,renderOccluded:ve.Opaque}),r=new Ue({color:se,cullFace:Ce.Back,renderOccluded:ve.Opaque}),s=new Ue({color:ae,transparent:!0,writeDepth:!1,cullFace:Ce.Front,renderOccluded:ve.Transparent}),l=l=>{e=e.slice(0);const b=I(G.get(),e[0],e[1]);w(b,b);const h=I(G.get(),e[e.length-1],e[e.length-2]);if(w(h,h),t>0){const n=f(_(),h,-t);e[e.length-1]=O(n,n,e[e.length-1]);const i=f(_(),b,-t);e[0]=O(i,i,e[0])}const T=l?he:1,E=ce*T,j=J*T,A=u(D.get());if(t>0){const e=E/4,n=R(G.get(),0,e,0),i=1+t/e;d(A,A,n),a(A,A,R(G.get(),i,i,i)),d(A,A,f(n,n,-1/i))}const L=u(g()),N=C(0,1,0),P=m(g(),p(X.get(),N,h));P[12]=e[e.length-1][0],P[13]=e[e.length-1][1],P[14]=e[e.length-1][2],c(P,P,A);const M=ut(pe*(l?fe:1)+t,e,n?s:r);M.transformation=L;const v=[M],U=Pe(n?s:i,E,j,24,!1,!1,!0);U.transformation=P,v.push(U);const V=Pe(n?s:o,E,j,24,!1,!0,!1);V.transformation=P,v.push(V);const y=m(g(),p(X.get(),N,b));return y[12]=e[0][0],y[13]=e[0][1],y[14]=e[0][2],c(y,y,A),v.push(U.instantiate({transformation:y})),v.push(V.instantiate({transformation:y})),v};return{normal:l(!1),focused:l(!0)}}function ut(e,t,n){const i=[],o=12;for(let r=0;r<o;r++){const t=r/o*2*Math.PI;i.push([Math.cos(t)*e,Math.sin(t)*e])}return Me(n,i,t,[],[],!1)}function dt(e,t){const n=I(_(),e[e.length-1],e[e.length-2]);if(w(n,n),f(n,n,ce),O(n,n,e[e.length-1]),t){const t=I(_(),e[0],e[1]);return w(t,t),f(t,t,ce),O(t,t,e[0]),[t,...e,n]}return[...e,n]}function mt(t,i,o,r=new e){if(null==t)return null;const{renderCoordsHelper:s}=i,a=s.fromRenderCoords(t.origin,i.spatialReference);if(null==a)return null;const c=N(a,o);if(null==c)return null;r.position=c;const l=2*E(t.basis1),u=2*E(t.basis2),d=Le.renderUnitScaleFactor(i.spatialReference,o);r.width=l*d,r.height=u*d;const m=s.worldUpAtPosition(t.origin,G.get());return r.tilt=n(pt(t,m)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function gt(e,t,n){if(null==e)return null;const i=e.origin,o=G.get(),r=G.get(),s=G.get(),a=G.get();let c,l,u,d,m,g;O(o,i,e.basis1),O(o,o,e.basis2),O(r,i,e.basis1),A(r,r,e.basis2),A(s,i,e.basis1),A(s,s,e.basis2),A(a,i,e.basis1),O(a,a,e.basis2);for(const p of[o,r,s,a]){const e=t.fromRenderCoords(p,p,n);if(null==e)return null;c=null==c?e[0]:Math.min(c,e[0]),l=null==l?e[0]:Math.max(l,e[0]),u=null==u?e[1]:Math.min(u,e[1]),d=null==d?e[1]:Math.max(d,e[1]),m=null==m?e[2]:Math.min(m,e[2]),g=null==g?e[2]:Math.max(g,e[2])}return new He({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:g,spatialReference:n})}function pt(e,t){return F(t,e.basis2,e.basis1)+jt}function ft(e,n,o,r,s,a,c=V()){return a.toRenderCoords(e,c.origin)?(a.worldBasisAtPosition(c.origin,P.X,c.basis1),a.worldBasisAtPosition(c.origin,P.Y,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),M(c,-i(n),y(c),c),M(c,i(o),c.basis1,c),f(c.basis1,c.basis1,r/2),f(c.basis2,c.basis2,s/2),S(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function bt(e,t){if(null==e||null==e.position)return null;const n=Te(e.position,t.spatialReference,t.elevationProvider);if(null==n)return null;const i=Le.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),o=e.width*i,r=e.height*i;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:o,renderHeight:r}}function ht(e,t,n,i=V()){const o=bt(e,t);return null==o?null:Tt(o,t,n,i)}function Tt(e,t,n,i=V()){if(null==e)return null;const o=ft(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,i);return n.tiltEnabled||null==o||Ge(o,t.renderCoordsHelper,o),o}!function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"}(Ke||(Ke={}));const wt=Se.Custom1;var Ot,Et;!function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"}(Ot||(Ot={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(Et||(Et={}));const It=Se.Custom2,Rt=x(),jt=Math.PI/2,At=Se.Custom1,Lt=Se.Custom2;var _t;function Ct(e){return null!=("building-scene-3d"===e.type?e:null)}!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(_t||(_t={}));export{wt as DidPointerMoveRecentlyFlag,It as IsShiftEdgeOnScreenFlag,_t as OffsetMode,Ot as RotationAxis,Et as SliceOrientation,dt as addArrowTips,Ze as calculateBoundedPlaneTranslateRotate,nt as calculateDiagonalResizeHandleScale,Xe as calculatePlaneHalfSize,tt as calculateResizeHandlePadding,et as calculateScreenSpaceBasisLength2,lt as createArrowGeometry,at as createGridVisualElement,st as createOutlineVisualElement,xe as createPlane,ct as createResizeManipulator,rt as createRotateManipulator,We as createRotatePlane,ot as createShiftManipulator,Ye as createShiftPlane,Ge as forceHorizontalOrVertical,it as isDiagonalResizeHandle,Ct as isIBuildingSceneLayerView3D,Fe as normalToBases,gt as planeToExtent,mt as planeToShape,bt as projectAndElevationAlignShape,Tt as projectedShapeToPlane,At as resizeNormal,Lt as resizeOutlineOnly,De as resizePlane,ht as shapeToPlane,ze as updateResizeHandle,$e as updateRotateHeadingHandle,Je as updateRotateTiltHandle,qe as updateShiftRestartHandle};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as i}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{q as r,b as s,k as a,m as c,r as l,i as u,w as d,F as m}from"../../../../chunks/mat4.js";import{c as g}from"../../../../chunks/mat4f64.js";import{r as p}from"../../../../chunks/quat.js";import{g as f,c as b,e as h,f as T,n as w,a as O,l as E,b as I,s as R,p as j,w as A}from"../../../../chunks/vec3.js";import{a as L,c as _,f as C}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as N}from"../../../../geometry/projection.js";import{Axis as P}from"../../../../geometry/support/Axis.js";import{r as M,f as v,i as U,a as V,n as y,u as S}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as k,fromPositionAndNormal as H}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{angleAroundAxis as F}from"../../../../geometry/support/vector.js";import{sv3d as G,sm4d as D,sq4d as X}from"../../../../geometry/support/vectorStacks.js";import{VERTICAL_DOT_THRESHOLD as Y,SMALL_ANGLE_DOT_THRESHOLD as Z,PLANE_MIN_BASIS_SCREEN_LEN2 as W,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as q,SHIFT_RESTART_OFFSET_DISTANCE as B,RESIZE_HANDLE_EDGE_PADDING_FRAC as z,SHIFT_RESTART_CALLOUT_COLOR as $,SHIFT_RESTART_TIP_RADIUS as J,PLANE_OUTLINE_COLOR as K,PLANE_OUTLINE_WIDTH as Q,PLANE_BACKGROUND_COLOR as ee,GRID_COLOR as te,RESIZE_HANDLE_CORNER_INPUT_RADIUS as ne,RESIZE_HANDLE_EDGE_INPUT_RADIUS as ie,SHIFT_RESTART_ARROW_TIP_COLOR as oe,SHIFT_RESTART_ARROW_CAP_COLOR as re,SHIFT_RESTART_TUBE_COLOR as se,SHIFT_RESTART_OUTLINE_COLOR as ae,SHIFT_RESTART_TIP_LENGTH as ce,SHIFT_RESTART_ARROW_LENGTH as le,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as ue,RESIZE_HANDLE_CORNER_WIDTH as de,RESIZE_HANDLE_EDGE_WIDTH as me,DISPLAY_FOCUS_MULTIPLIER as ge,SHIFT_RESTART_TUBE_RADIUS as pe,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as fe,RESIZE_HANDLE_COLOR as be,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as he}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as Te}from"../support/projectionUtils.js";import{Manipulator3D as we}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as Oe,createRotateManipulator as Ee,worldScaledManipulatorSettings as Ie}from"../../interactive/manipulatorUtils.js";import{RenderObject as Re}from"../../interactive/RenderObject.js";import{LineVisualElement as je}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as Ae}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Le}from"../../support/RenderCoordsHelper.js";import{fromRender as _e}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as Ce}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as Ne,createConeGeometry as Pe,createPathExtrusionGeometry as Me}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ve}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Ue}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Ve}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as ye}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as Se,ManipulatorStateFlags as ke}from"../../../interactive/interfaces.js";import He from"../../../../geometry/Extent.js";function xe(e,t,n,i,o,r,s,a){return Fe(t,s.worldUpAtPosition(e,G.get()),o,r,a.basis1,a.basis2),f(a.basis1,a.basis1,n),f(a.basis2,a.basis2,i),b(a.origin,e),k(a.basis2,a.basis1,a.origin,a.plane),a}function Fe(e,t,n,i,o,r){const s=h(e,t),a=G.get(),c=G.get();switch(i===Et.HORIZONTAL_OR_VERTICAL?Math.abs(s)>Y?Et.HORIZONTAL:Et.VERTICAL:i){case Et.VERTICAL:{const i=Math.abs(s)<=Z?e:n.viewUp;T(a,i,t),b(c,t);break}case Et.HORIZONTAL:T(a,n.viewUp,t),T(c,t,a);break;case Et.TILTED:{const i=Math.abs(s)<=Z?t:n.viewUp;T(a,i,e),T(c,e,a);break}}const l=T(G.get(),a,c);h(l,n.viewForward)>0&&f(c,c,-1),w(o,a),w(r,c)}function Ge(e,t,n){const i=t.worldUpAtPosition(e.origin,G.get()),o=e.basis1,r=pt(e,i),s=Math.round(r/jt)*jt;return M(e,s-r,o,n)}function De(e,t,n,i,o,r){const s=b(G.get(),o.origin);O(s,s,f(G.get(),o.basis1,e.direction[0]<0?1:-1)),O(s,s,f(G.get(),o.basis2,e.direction[1]<0?1:-1));const a=E(o.basis1),c=E(o.basis2),l=I(G.get(),n,s),u=I(G.get(),t,s);let d=0,m=0;if(it(e)){const t=nt(o),n=nt(r);d=a-.5*e.direction[0]*h(o.basis1,u)/a,m=c-.5*e.direction[1]*h(o.basis2,u)/c;const i=n/t;d*=i,m*=i}const g=d+.5*e.direction[0]*h(o.basis1,l)/a,p=m+.5*e.direction[1]*h(o.basis2,l)/c,T=f(G.get(),o.basis1,g/a),w=f(G.get(),o.basis2,p/c);(g<=0||et(r.origin,T,i)<=W)&&b(T,r.basis1),(p<=0||et(r.origin,w,i)<=W)&&b(w,r.basis2);const R=b(G.get(),s);return O(R,R,f(G.get(),T,e.direction[0]<0?-1:1)),O(R,R,f(G.get(),w,e.direction[1]<0?-1:1)),v(R,T,w,r)}function Xe(e,t){return q*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function Ye(e,t,n,i){const o=T(G.get(),t,n);return T(o,o,t),H(e,o,i)}function Ze(e,t){return Oe(e.basis1,e.basis2,e.origin,t)}function We(e,t,n,i){const o=t.worldUpAtPosition(e.origin,G.get()),r=G.get();switch(n){case Ot.HEADING:b(r,o);break;case Ot.TILT:b(r,e.basis1)}return H(e.origin,r,i)}function qe(e,t,n,i){const s=Qe(n,Ke.NEGATIVE_X),a=D.get();r(a,t,s.edge*Math.PI/2);const c=w(G.get(),s.basis);let l=f(G.get(),c,s.direction*i.computeScreenPixelSizeAt(s.position)*B);O(l,l,s.position);const u=i.projectToRenderScreen(l,o(G.get())),d=Be(i,u);_e(i,u,Rt),w(Rt.direction,Rt.direction);const m=G.get();!d&&U(n,Rt,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=L(l),d?e.state|=It:e.state&=~It}function Be(e,t){const[n,i,o,r]=e.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<n+s?(t[0]=n+s,a=!1):t[0]>n+o-s&&(t[0]=n+o-s,a=!1),t[1]<i+s?(t[1]=i+s,a=!1):t[1]>i+r-s&&(t[1]=i+r-s,a=!1),a}function ze(e,t,n,i){const o=E(i.basis1),r=E(i.basis2),l=tt(i),u=nt(i),d=R(G.get(),0,0,0);O(d,f(G.get(),i.basis1,t.direction[0]),f(G.get(),i.basis2,t.direction[1])),O(d,i.origin,d);let m=0,g=1;if(it(t))1===t.direction[0]&&-1===t.direction[1]?m=jt:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),g=u;else{const e=0!==t.direction[0]?1:2;m=1===e?jt:0,g=(1===e?r:o)-l}const p=s(D.get(),m);a(p,p,R(G.get(),g,g,g)),c(p,n,p),p[12]=0,p[13]=0,p[14]=0,e.modelTransform=p,e.renderLocation=d}function $e(e,t,n,i){const o=i.worldUpAtPosition(n.origin,G.get()),r=Qe(n,Ke.POSITIVE_X),a=s(D.get(),r.edge*Math.PI/2);l(a,a,-pt(n,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=r.position}function Je(e,t,n){const i=Qe(n,Ke.POSITIVE_Y),o=s(D.get(),i.edge*Math.PI/2);l(o,o,jt),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,e.modelTransform=o,e.renderLocation=i.position}var Ke;function Qe(e,t){switch(t){case Ke.POSITIVE_X:return{basis:e.basis1,direction:1,position:O(G.get(),e.origin,e.basis1),edge:t};case Ke.POSITIVE_Y:return{basis:e.basis2,direction:1,position:O(G.get(),e.origin,e.basis2),edge:t};case Ke.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:I(G.get(),e.origin,e.basis1),edge:t};case Ke.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:I(G.get(),e.origin,e.basis2),edge:t}}}function et(e,t,n){const i=n.projectToRenderScreen(O(G.get(),e,t),o(G.get())),r=n.projectToRenderScreen(I(G.get(),e,t),o(G.get()));return j(I(i,i,r))}function tt(e){const t=E(e.basis1),n=E(e.basis2);return z*Math.min(t,n)}function nt(e){return tt(e)}function it(e){return 0!==e.direction[0]&&0!==e.direction[1]}function ot(e,t=_t.CENTER_ON_ARROW){const n=t===_t.CENTER_ON_CALLOUT?B:0,i=[C(n,0,-le/2),C(n,0,le/2)],o=dt(i,!0),r=(e,t)=>lt(i,e,t),s=r(0,!1),a=r(ue,!0),c=new Ve({color:$,renderOccluded:ve.OccludeAndTransparent}),l=Ne(c,[[n,0,0],[n-B,0,0]]),u=Ne(c,[[n,0,0],[n-B,0,0]]);return new we({view:e,renderObjects:[...s.normal.map((e=>new Re(e,ke.Unfocused|wt))),...a.normal.map((e=>new Re(e,ke.Unfocused|wt))),new Re(l,ke.Unfocused|wt|It),...s.focused.map((e=>new Re(e,ke.Focused|wt))),...a.focused.map((e=>new Re(e,ke.Focused|wt))),new Re(u,ke.Focused|wt|It)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[o]},collisionPriority:1,radius:J,state:wt})}function rt(e,t){const n=Ee(e,{customStateMask:wt,texture:t});return n.state=wt,n}function st(e){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new je({view:e,attached:!1,color:K,width:Q,writeDepthEnabled:!1,renderOccluded:ve.OccludeAndTransparent,geometry:[t]})}function at(e){return new Ae({view:e,attached:!1,backgroundColor:[...ee],gridColor:te,gridWidth:4,renderOccluded:ve.OccludeAndTransparent})}function ct(e,t){const n=it(t),i=n?[C(1,0,0),C(0,0,0),C(0,1,0)]:[C(1,0,0),C(-1,0,0)],o=be,r=e=>new ye({color:o,width:e,renderOccluded:ve.OccludeAndTransparent}),s=()=>new Ve({color:o,renderOccluded:ve.OccludeAndTransparent}),a=n?de:me,c=a*ge,l=me,u=e=>e>1?r(e):s(),d=[new Re(Ne(u(a),i),ke.Unfocused|At),new Re(Ne(u(c),i),ke.Focused|At),new Re(Ne(u(l),i),Lt)],m=new we({view:e,renderObjects:d,collisionType:{type:"line",paths:[i]},radius:n?ne:ie,...Ie});return m.state=At,m}function lt(e,t,n){const i=new Ue({color:oe,cullFace:Ce.Back,renderOccluded:ve.Opaque}),o=new Ue({color:re,cullFace:Ce.Back,renderOccluded:ve.Opaque}),r=new Ue({color:se,cullFace:Ce.Back,renderOccluded:ve.Opaque}),s=new Ue({color:ae,transparent:!0,writeDepth:!1,cullFace:Ce.Front,renderOccluded:ve.Transparent}),l=l=>{const b=e.slice(0),h=I(G.get(),b[0],b[1]);w(h,h);const T=I(G.get(),b[b.length-1],b[b.length-2]);if(w(T,T),t>0){const e=f(_(),T,-t);b[b.length-1]=O(e,e,b[b.length-1]);const n=f(_(),h,-t);b[0]=O(n,n,b[0])}const E=l?he:1,j=ce*E,A=J*E,L=u(D.get());if(t>0){const e=j/4,n=R(G.get(),0,e,0),i=1+t/e;d(L,L,n),a(L,L,R(G.get(),i,i,i)),d(L,L,f(n,n,-1/i))}const N=u(g()),P=C(0,1,0),M=m(g(),p(X.get(),P,T));M[12]=b[b.length-1][0],M[13]=b[b.length-1][1],M[14]=b[b.length-1][2],c(M,M,L);const v=ut(pe*(l?fe:1)+t,b,n?s:r);v.transformation=N;const U=[v],V=Pe(n?s:i,j,A,24,!1,!1,!0);V.transformation=M,U.push(V);const y=Pe(n?s:o,j,A,24,!1,!0,!1);y.transformation=M,U.push(y);const S=m(g(),p(X.get(),P,h));return S[12]=b[0][0],S[13]=b[0][1],S[14]=b[0][2],c(S,S,L),U.push(V.instantiate({transformation:S})),U.push(y.instantiate({transformation:S})),U};return{normal:l(!1),focused:l(!0)}}function ut(e,t,n){const i=[],o=12;for(let r=0;r<o;r++){const t=r/o*2*Math.PI;i.push([Math.cos(t)*e,Math.sin(t)*e])}return Me(n,i,t,[],[],!1)}function dt(e,t){const n=I(_(),e[e.length-1],e[e.length-2]);if(w(n,n),f(n,n,ce),O(n,n,e[e.length-1]),t){const t=I(_(),e[0],e[1]);return w(t,t),f(t,t,ce),O(t,t,e[0]),[t,...e,n]}return[...e,n]}function mt(t,i,o,r=new e){if(null==t)return null;const{renderCoordsHelper:s}=i,a=s.fromRenderCoords(t.origin,i.spatialReference);if(null==a)return null;const c=N(a,o);if(null==c)return null;r.position=c;const l=2*E(t.basis1),u=2*E(t.basis2),d=Le.renderUnitScaleFactor(i.spatialReference,o);r.width=l*d,r.height=u*d;const m=s.worldUpAtPosition(t.origin,G.get());return r.tilt=n(pt(t,m)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function gt(e,t,n){if(null==e)return null;const i=e.origin,o=G.get(),r=G.get(),s=G.get(),a=G.get();let c,l,u,d,m,g;O(o,i,e.basis1),O(o,o,e.basis2),O(r,i,e.basis1),A(r,r,e.basis2),A(s,i,e.basis1),A(s,s,e.basis2),A(a,i,e.basis1),O(a,a,e.basis2);for(const p of[o,r,s,a]){const e=t.fromRenderCoords(p,p,n);if(null==e)return null;c=null==c?e[0]:Math.min(c,e[0]),l=null==l?e[0]:Math.max(l,e[0]),u=null==u?e[1]:Math.min(u,e[1]),d=null==d?e[1]:Math.max(d,e[1]),m=null==m?e[2]:Math.min(m,e[2]),g=null==g?e[2]:Math.max(g,e[2])}return new He({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:g,spatialReference:n})}function pt(e,t){return F(t,e.basis2,e.basis1)+jt}function ft(e,n,o,r,s,a,c=V()){return a.toRenderCoords(e,c.origin)?(a.worldBasisAtPosition(c.origin,P.X,c.basis1),a.worldBasisAtPosition(c.origin,P.Y,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),M(c,-i(n),y(c),c),M(c,i(o),c.basis1,c),f(c.basis1,c.basis1,r/2),f(c.basis2,c.basis2,s/2),S(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function bt(e,t){if(null==e||null==e.position)return null;const n=Te(e.position,t.spatialReference,t.elevationProvider);if(null==n)return null;const i=Le.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),o=e.width*i,r=e.height*i;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:o,renderHeight:r}}function ht(e,t,n,i=V()){const o=bt(e,t);return null==o?null:Tt(o,t,n,i)}function Tt(e,t,n,i=V()){if(null==e)return null;const o=ft(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,i);return n.tiltEnabled||null==o||Ge(o,t.renderCoordsHelper,o),o}!function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"}(Ke||(Ke={}));const wt=Se.Custom1;var Ot,Et;!function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"}(Ot||(Ot={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(Et||(Et={}));const It=Se.Custom2,Rt=x(),jt=Math.PI/2,At=Se.Custom1,Lt=Se.Custom2;var _t;function Ct(e){return null!=("building-scene-3d"===e.type?e:null)}!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(_t||(_t={}));export{wt as DidPointerMoveRecentlyFlag,It as IsShiftEdgeOnScreenFlag,_t as OffsetMode,Ot as RotationAxis,Et as SliceOrientation,dt as addArrowTips,Ze as calculateBoundedPlaneTranslateRotate,nt as calculateDiagonalResizeHandleScale,Xe as calculatePlaneHalfSize,tt as calculateResizeHandlePadding,et as calculateScreenSpaceBasisLength2,lt as createArrowGeometry,at as createGridVisualElement,st as createOutlineVisualElement,xe as createPlane,ct as createResizeManipulator,rt as createRotateManipulator,We as createRotatePlane,ot as createShiftManipulator,Ye as createShiftPlane,Ge as forceHorizontalOrVertical,it as isDiagonalResizeHandle,Ct as isIBuildingSceneLayerView3D,Fe as normalToBases,gt as planeToExtent,mt as planeToShape,bt as projectAndElevationAlignShape,Tt as projectedShapeToPlane,At as resizeNormal,Lt as resizeOutlineOnly,De as resizePlane,ht as shapeToPlane,ze as updateResizeHandle,$e as updateRotateHeadingHandle,Je as updateRotateTiltHandle,qe as updateShiftRestartHandle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var N,E;function
|
|
5
|
+
var N,E;function I(N){return null!=N?.cubeMap}function n(N){return null!=N&&!N.running}!function(N){N[N.RENDERING=0]="RENDERING",N[N.FINISHED_RENDERING=1]="FINISHED_RENDERING",N[N.FADING_TEXTURE_CHANNELS=2]="FADING_TEXTURE_CHANNELS",N[N.SWITCH_CHANNELS=3]="SWITCH_CHANNELS",N[N.FINISHED=4]="FINISHED"}(N||(N={})),function(N){N[N.RG=0]="RG",N[N.BA=1]="BA"}(E||(E={}));export{N as CloudsRenderingStages,E as CloudsTextureChannels,n as ensureClouds,I as isReadyCloudsData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{f as d}from"../../../chunks/mat3.js";import{v as c}from"../../../chunks/mat4.js";import{c as m}from"../../../chunks/mat4f64.js";import{s as p,o as _,c as f}from"../../../chunks/vec2.js";import{a as g}from"../../../chunks/vec2f64.js";import{f as w,z as T}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{C as v,a as C}from"../../../chunks/Clouds.glsl.js";import{CloudsTextureChannels as y,CloudsRenderingStages as P}from"./CloudsData.js";import{cloudPresets as b}from"./CloudsPresets.js";import{CloudsTechnique as S}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as I,RayMarchingSteps as j}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as E}from"./NoiseTextureAtlas.js";import{BindParameters as D}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as M}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as z,Task as U}from"../../support/Scheduler.js";import{TextureType as F,PixelFormat as R,PixelType as q,TextureWrapMode as B,TextureSamplingMode as N,TargetType as A}from"../../webgl/enums.js";import{FramebufferObject as H}from"../../webgl/FramebufferObject.js";let O=class extends t{constructor(e){super(e),this._handles=new s,this._techniques=new Array,this._techniqueConfiguration=new I,this._bindParameters=new D(null,null,null),this._passParameters=new v,this._drawParameters=new C,this._weatherTile=g(),this._weatherTileCount=128,this._faceIndex=0,this._tileIndex=0,this.coverage=i(b.default.coverage[0],b.default.coverage[1],.5),this.density=i(b.default.density[0],b.default.density[1],.5),this.absorption=i(b.default.absorption[0],b.default.absorption[1],.5),this.cloudSize=i(b.default.cloudSize[0],b.default.cloudSize[1],.5),this.detailSize=i(b.default.detailSize[0],b.default.detailSize[1],.5),this.smoothness=i(b.default.smoothness[0],b.default.smoothness[1],.5),this.cloudHeight=i(b.default.cloudHeight[0],b.default.cloudHeight[1],.5),this.raymarchingSteps=b.default.raymarchingSteps,this._viewMatrix=m(),this._dirty=!1,this.running=!1,this._vao=M(e.context.renderContext.rctx)}_getTechnique(e){const t=1-this.context.renderContext.bindParameters.cloudsFade.readChannels,s=t===y.RG?2*e:2*e+1,i=this._techniques[s];return i||(this._techniqueConfiguration.writeTextureChannels=t,this._techniqueConfiguration.steps=e,this._techniques[s]=new S({rctx:this.context.renderContext.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[s])}updateWeatherTile(){const e=this.view.camera.position.latitude,t=this.view.camera.position.longitude;if(null==e||null==t)return;p(this._weatherTile,(e+90)/180,(t+180)/360);const s=Math.floor(this._weatherTileCount*Math.abs(2*this._weatherTile[0]-1));this._weatherTile[0]=Math.floor(2*this._weatherTileCount*this._weatherTile[0]),this._weatherTile[1]=Math.floor(4*(this._weatherTileCount-s)*this._weatherTile[1]);let i=0,r=0;if(null!=this.view.environment&&"virtual"!==this.view.environment.lighting.type&&null!=this.view.environment.lighting.date){const e=new Date(this.view.environment.lighting.date);e.setUTCHours(this.view.environment.lighting.date.getUTCHours()+(this.view.environment.lighting.displayUTCOffset??0)),i=31*e.getUTCMonth()+e.getUTCDate(),r=e.getUTCFullYear()}this._weatherTile[0]=(this._weatherTile[0]+i)%(2*this._weatherTileCount),this._weatherTile[1]=(this._weatherTile[1]+r%100)%(4*this._weatherTileCount),_(this._passParameters.weatherTile,this._weatherTile)||this.setDirty()}initialize(){const e=x(this.view.spatialReference);this._passParameters.cloudRadius=.5*e.radius,this.setDirty(),this.updateWeatherTile(),this._handles.add([this.view.resourceController.scheduler.registerTask(z.CLOUDS_GENERATOR,this),n((()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingSteps]),(()=>this.setDirty()),h)])}destroy(){this._handles.destroy(),this._techniques.forEach((e=>r(e))),this._frameBufferCube=a(this._frameBufferCube),this._techniques.length=0,this._vao.dispose(),this._passParameters.noiseTexture=o(this._passParameters.noiseTexture)}get _tilesPerFace(){switch(this._techniqueConfiguration.steps){case j.SIXTEEN:return 1;case j.HUNDRED:return 4;case j.COUNT:case j.TWOHUNDRED:return 8}}_ensureNoiseTexture(){if(null!=this._passParameters.noiseTexture)this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile);else{const e=this.context;this._passParameters.noiseTexture=new E({context:e}),this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile)}return null!=this._passParameters.noiseTexture.textureAtlas}_ensureFrameBufferCube(e){if(null==this._frameBufferCube){const t={target:F.TEXTURE_CUBE_MAP,pixelFormat:R.RGBA,dataType:q.UNSIGNED_BYTE,wrapMode:B.CLAMP_TO_EDGE,samplingMode:N.LINEAR,hasMipmap:!1,width:e,height:e};this._frameBufferCube=new H(this.context.renderContext.rctx,{colorTarget:A.CUBEMAP,width:e,height:e},t)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}destroyFrameBufferCube(){this._frameBufferCube=a(this._frameBufferCube)}applyPreset(e,t){const s=e.median,r=e=>{const r=i(e[0],e[1],s);return t<.5?i(e[0],r,2*t):i(r,e[1],2*(t-.5))};this.coverage=r(e.coverage),this.density=r(e.density),this.absorption=r(e.absorption),this.cloudSize=r(e.cloudSize),this.detailSize=r(e.detailSize),this.smoothness=r(e.smoothness),this.cloudHeight=r(e.cloudHeight),this.raymarchingSteps=e.raymarchingSteps}setDirty(){this._dirty=this.running=!0}runTask(e){0===this._faceIndex&&0===this._tileIndex&&(this._passParameters.raymarchingSteps=this.raymarchingSteps,this.updateWeatherTile(),f(this._passParameters.weatherTile,this._weatherTile));const t=this._getTechnique(this._passParameters.raymarchingSteps);if(!t.compiled)return U.YIELD;if(!this.context.renderContext.bindParameters.cloudsFade.isCameraPositionFinal||this.context.renderContext.bindParameters.cloudsFade.isFading||!this._ensureNoiseTexture())return U.YIELD;0===this._faceIndex&&0===this._tileIndex&&(this.context.renderContext.bindParameters.cloudsFade.renderingStage=P.RENDERING,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._dirty=!1);const s=this.context.renderContext.rctx,i=s.bindTechnique(t,this._passParameters,this._bindParameters);s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao);const r=s.getViewport(),a=t.configuration.cubeMapSize,o=a/this._tilesPerFace,n=this._tileIndex*o;s.setViewport(0,n,a,o);const h=this._ensureFrameBufferCube(a);s.bindFramebuffer(h);const u=k[this._faceIndex],l=G[this._faceIndex];c(this._viewMatrix,L,u,l),d(this._drawParameters.viewMatrix,this._viewMatrix);const m=F.TEXTURE_CUBE_MAP_POSITIVE_X+this._faceIndex;return h.setColorTextureTarget(m),i.bindDraw(this._drawParameters,this._bindParameters,this._passParameters),s.gl.drawArrays(s.gl.TRIANGLE_STRIP,0,4),s.gl.flush(),s.setViewport(r.x,r.y,r.width,r.height),this.requestRender(),++this._tileIndex,4===this._faceIndex&&this._tileIndex===this._tilesPerFace?(this.running=this._dirty,this._faceIndex=0,this._tileIndex=0,this.context.renderContext.bindParameters.cloudsFade.renderingStage=P.FINISHED_RENDERING):this._tileIndex===this._tilesPerFace&&(++this._faceIndex,this._tileIndex=0),e.madeProgress(),U.YIELD}};e([u({constructOnly:!0})],O.prototype,"context",void 0),e([u({constructOnly:!0})],O.prototype,"view",void 0),e([u({constructOnly:!0})],O.prototype,"requestRender",void 0),e([u()],O.prototype,"coverage",void 0),e([u()],O.prototype,"density",void 0),e([u()],O.prototype,"absorption",void 0),e([u()],O.prototype,"cloudSize",void 0),e([u()],O.prototype,"detailSize",void 0),e([u()],O.prototype,"smoothness",void 0),e([u()],O.prototype,"cloudHeight",void 0),e([u()],O.prototype,"raymarchingSteps",void 0),e([u()],O.prototype,"running",void 0),O=e([l("esri.views.3d.environment.CloudsGenerator")],O);const k=[w(1,0,0),w(-1,0,0),w(0,1,0),w(0,-1,0),w(0,0,1)],G=[w(0,1,0),w(0,1,0),w(0,0,-1),w(0,0,1),w(0,1,0)],L=T();export{O as CloudsGenerator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{cyclicalPI as t}from"../../../../../core/Cyclical.js";import e from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{clamp as i,rad2deg as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{createAngle as s,createLength as r}from"../../../../../core/quantityUtils.js";import{when as l,initial as c,watch as h}from"../../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../../core/scheduling.js";import{createScreenPointArray as u}from"../../../../../core/screenUtils.js";import{d,E as g,m,k as _,e as f}from"../../../../../chunks/mat4.js";import{c as D}from"../../../../../chunks/mat4f64.js";import{s as S,b as M,l as v,d as y,f as b,a as w}from"../../../../../chunks/vec3.js";import{a as T,f as R}from"../../../../../chunks/vec3f64.js";import{b as j}from"../../../../../chunks/vec4f64.js";import{fromPositionAndNormal as O,create as I,normal as A}from"../../../../../geometry/support/plane.js";import{wrap as k,distance2 as E}from"../../../../../geometry/support/ray.js";import{sv3d as F,sm4d as P}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as C}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as U}from"../../Manipulator3D.js";import{calculateInputRotationTransform as z}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{RING_INDICATOR_DELAY_MS as H,ROTATE_INDICATOR_DIRECTION_BUFFER as V,SCALE_INDICATOR_DIRECTION_BUFFER as q,ROTATE_INDICATOR_ARROW_PLACEMENT_PERCENTAGE as B,RING_THICKNESS as G,HANDLE_COLOR as J,DRAG_THRESHOLD_PX as K,RING_RADIUS as Q,INNER_INDICATOR_RADIUS as W,OUTER_INDICATOR_RADIUS as X,RING_HEIGHT as Y,ROTATE_INDICATOR_ARROW_TIP_RADIUS as Z,ROTATE_INDICATOR_ARROW_TIP_LENGTH as $,SCALE_INDICATOR_OFFSET1 as tt,SCALE_INDICATOR_OFFSET2 as et,INDICATOR_THICKNESS as at,GEOMETRY_SEGMENTS as it,ROTATE_INDICATOR_ARC_LENGTH as ot,RING_RESET_ANIMATION_SPEED_FACTOR as nt,SCALE_INDICATOR_ARC_LENGTH as st}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as lt,transformInPlace as ct,createPathExtrusionGeometry as ht}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as pt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as ut}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as dt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as gt,ManipulatorStateFlags as mt}from"../../../../interactive/interfaces.js";import{Tooltip as _t}from"../../../../interactive/tooltip/Tooltip.js";import{TransformRotateTooltipInfo as ft,TransformScaleTooltipInfo as Dt,TransformAbsoluteTooltipInfo as St}from"../../../../interactive/tooltip/TransformTooltipInfos.js";var Mt,vt;!function(t){t.ScaleIn=gt.Custom2,t.ScaleOut=gt.Custom3,t.RotateLeft=gt.Custom4,t.RotateRight=gt.Custom5,t.Unlocked=gt.Custom7,t.DelayedFocused=gt.Custom8,t.TouchInput=gt.Custom12}(Mt||(Mt={}));class yt{get angle(){return this._adapter.angle}get scale(){return this._adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}constructor({adapter:t,tooltipOptions:i,mode:o,tool:n}){this._mode=null,this._handles=new a,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new e,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>null!=this._scaleRotateDragData&&"scale"===this._scaleRotateDragData.mode?this._adapter.scale:1,this.tool=n,this._mode=o,this._adapter=t,this._tooltipOptions=i,this._tooltip=new _t({view:n.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this._handles.add(l((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),c))}destroy(){null!=this._activeAnimation&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=null),this._handles=n(this._handles),this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=n(this._tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=p({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){null!=this._activeAnimation&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=n(this._activeAnimation))}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);const a=this.tool.graphicState.graphic,n=dt(e,((e,n,s)=>{this._scaleRotateDragData=null;const r=this._adapter.startInteraction(),l={mode:"none",origin:T(e.renderLocation),initialAngle:this._adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=F.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,c),n.next(x(this.tool.view,O(e.renderLocation,c,I()))).next((e=>{const n=A(e.plane),s=z(e.renderStart,e.renderEnd,l.origin,n),c=t.shortestSignedDiff(l.angle,s);l.angleDir=i(l.angleDir+c,-V,V),l.angle=s;const h=bt(l,e),p=h-this._adapter.scale;if(l.scaleDir=i(l.scaleDir+p,-q,q),this._onScaleChanged(),"none"===l.mode){const t=this._mode||wt(e,e.plane,l.origin,this.tool.view.state.camera);if(null!=t){switch(t){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:a,angle:0}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()})}l.mode=t}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+s;break;case"scale":r.state.scale=h,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:a,xScale:h,yScale:h})}break;case"end":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:h,yScale:h})}}return"end"===e.action&&(this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),e})).next(this._updateTooltipPipelineStep(l)),s.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1})}this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this._handles.add([n,e.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(jt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),e.events.on("immediate-click",(t=>{t.stopPropagation()})),h((()=>this.tool.graphicState?.displaying),(t=>this._ringManipulator.available=t),c)])}_updateTooltipPipelineStep(t){return e=>{const a=this._tooltipOptions;if(!a.enabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const i=this._tooltip,o=this._tooltipOptions.visualVariables,n=null!=o?o.size:null,l=null!=o?o.rotation:null;switch(t.mode){case"scale":i.info=new Dt({tooltipOptions:a,scale:{value:this._adapter.scale},size:r(this._adapter.size??-1,"meters"),sizeUnit:null!=n?n.unit:null,sizePrecision:null!=n?Ot(n.valueType):null});break;case"rotate":{const t=null!=l?Ot(l.valueType):null,e=null!=l?l.rotationType:"geographic";i.info=new ft({tooltipOptions:a,rotation:s(-(this._adapter.relativeAngle??0),"radians","geographic"),rotationPrecision:t,orientation:s(-this._adapter.angle,"radians","geographic"),orientationPrecision:t,rotationType:e})}}return e}}_updateFocusTooltip(){if(!this._tooltipOptions.enabled)return;if(this.getFocused()){const t=this._tooltipOptions.visualVariables,e=null!=t?t.rotation:null,a=null!=t?t.size:null;this._tooltip.info=new St({tooltipOptions:this._tooltipOptions,orientation:s(-this._adapter.angle,"radians","geographic"),orientationEnabled:null==this._mode||"rotate"===this._mode,orientationPrecision:null!=e?Ot(e.valueType):null,rotationType:null!=e?e.rotationType:"geographic",size:r(this._adapter.size??-1,"meters"),sizeUnit:null!=a?a.unit:null,sizeEnabled:null==this._mode||"scale"===this._mode,sizePrecision:null!=a?Ot(a.valueType):null})}else this._tooltip.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=d(P.get(),this._adapter.angle,R(0,0,1));if(null==t)return;const e=this.getScale(),a=g(P.get(),S(F.get(),e,e,e));this._ringManipulator.modelTransform=m(P.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(it*(e-t)/(2*Math.PI));for(let n=0;n<o+1;n++){const s=t+n*(e-t)/o;i.push(R(a*Math.cos(s),a*Math.sin(s),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,Y/2],[-t/2,Y/2]],i=this._createMaterial(1),o=(t,e,o=i)=>ht(o,a(e),t,[],[],!1),n=e(Q),s=o(n,G),r={left:new Array,right:new Array},l=[];for(let R=0;R<2;R++){const e=R*Math.PI-Math.PI/4,a=Math.PI/2-ot,n=e+a,s=e+Math.PI/2-a,c=t(n,s,W),h=o(c,at);l.push(c),l.push(t(n,s,X-G/2)),r.left.push(h),r.right.push(h.instantiate());for(let t=0;t<2;t++){const e=0===t,a=D();if(e){_(a,a,[1,-1,1]),f(a,a,-n,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{f(a,a,s,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const o=lt(i,$,0,Z,Y);ct(o,a),(e?r.left:r.right).push(o)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-st,i=e+a,n=e+Math.PI/2-a,s=t(i,n,X);c.push(o(s,at))}const h=this._createMaterial(.66),p=this._createMaterial(.5),u=this._createMaterial(.33),d=e(Q+tt),g=e(Q+et),m=o(d,at,h),S=o(g,at,u),M=e(Q-tt),v=e(Q-et),y=o(M,at,h),b=o(v,at,u);let w=[new L(s,Mt.DelayedFocused),new L(s.instantiate({material:p}),mt.None)];this._mode&&"scale"!==this._mode||(w=w.concat([...c.map((t=>new L(t,Mt.DelayedFocused|Mt.Unlocked))),new L(m,Mt.DelayedFocused|Mt.ScaleIn),new L(S,Mt.DelayedFocused|Mt.ScaleIn),new L(y,Mt.DelayedFocused|Mt.ScaleOut),new L(b,Mt.DelayedFocused|Mt.ScaleOut)])),this._mode&&"rotate"!==this._mode||(w=w.concat([...r.right.map((t=>new L(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateRight)))]));const T=[n,...l];return new U({view:this.tool.view,renderObjects:w,autoScaleRenderObjects:!1,worldOriented:!0,radius:G,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:C(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:T,direction:R(0,0,1)}})}_createMaterial(t){const e=j([...J,t]);return new ut({color:e,transparent:1!==t,cullFace:rt.Back,renderOccluded:pt.Transparent})}get test(){return{ringManipulator:this._ringManipulator,setRingIndicatorDelayMs:t=>this._ringIndicatorDelayMs=t,tooltip:this._tooltip}}}function bt(t,e){const a=M(F.get(),e.renderStart,t.origin),i=M(F.get(),e.renderEnd,t.origin),o=v(a),n=v(i);return 0===o?0:n/o}function wt(t,e,a,i){const{renderStart:o,renderEnd:n}=t,s=Tt(o,i,F.get()),r=Tt(n,i,F.get());if(y(s,r)<K*K)return null;const l=M(F.get(),o,a),c=b(F.get(),l,A(e)),h=o,p=w(F.get(),h,c),u=Tt(a,i,F.get()),d=s,g=Tt(p,i,F.get()),m=M(F.get(),g,d),_=M(F.get(),s,u),f=k(d,m),D=k(u,_);return E(f,r)<E(D,r)?"rotate":"scale"}function Tt(t,e,a){return e.projectToScreen(t,It),S(a,It[0],It[1],0)}function Rt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*nt,1),e(),Math.abs(i-1)<.01?vt.STOP:vt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function jt(t,e,a){let i=0,o=null;const n=()=>!1;return{start:()=>{o=t.getFocused,t.getFocused=n,i=0,e()},update:t=>(i+=t,!o?.()||i>=a.delayMs?vt.STOP:vt.CONTINUE),destroy:()=>{o&&(t.getFocused=o),e()}}}function Ot(t){switch(t){case"integer":case"long":return 0;default:return null}}!function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(vt||(vt={}));const It=u();export{yt as GraphicScaleRotateTransform};
|
|
5
|
+
import{cyclicalPI as t}from"../../../../../core/Cyclical.js";import e from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{clamp as i,rad2deg as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{createAngle as n,createLength as r}from"../../../../../core/quantityUtils.js";import{when as l,initial as c,watch as h}from"../../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../../core/scheduling.js";import{createScreenPointArray as d}from"../../../../../core/screenUtils.js";import{d as u,E as g,m,k as _,e as f}from"../../../../../chunks/mat4.js";import{c as D}from"../../../../../chunks/mat4f64.js";import{s as S,b as M,l as v,d as b,f as y,a as w}from"../../../../../chunks/vec3.js";import{a as T,f as R}from"../../../../../chunks/vec3f64.js";import{b as j}from"../../../../../chunks/vec4f64.js";import{fromPositionAndNormal as O,create as I,normal as A}from"../../../../../geometry/support/plane.js";import{wrap as E,distance2 as k}from"../../../../../geometry/support/ray.js";import{sv3d as F,sm4d as P}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as C}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as U}from"../../Manipulator3D.js";import{calculateInputRotationTransform as z}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{RING_INDICATOR_DELAY_MS as H,ROTATE_INDICATOR_DIRECTION_BUFFER as V,SCALE_INDICATOR_DIRECTION_BUFFER as q,ROTATE_INDICATOR_ARROW_PLACEMENT_PERCENTAGE as B,RING_THICKNESS as G,HANDLE_COLOR as J,DRAG_THRESHOLD_PX as K,RING_RADIUS as Q,INNER_INDICATOR_RADIUS as W,OUTER_INDICATOR_RADIUS as X,RING_HEIGHT as Y,ROTATE_INDICATOR_ARROW_TIP_RADIUS as Z,ROTATE_INDICATOR_ARROW_TIP_LENGTH as $,SCALE_INDICATOR_OFFSET1 as tt,SCALE_INDICATOR_OFFSET2 as et,INDICATOR_THICKNESS as at,GEOMETRY_SEGMENTS as it,ROTATE_INDICATOR_ARC_LENGTH as ot,RING_RESET_ANIMATION_SPEED_FACTOR as st,SCALE_INDICATOR_ARC_LENGTH as nt}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as lt,transformInPlace as ct,createPathExtrusionGeometry as ht}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as pt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as dt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ut}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as gt,ManipulatorStateFlags as mt}from"../../../../interactive/interfaces.js";import{Tooltip as _t}from"../../../../interactive/tooltip/Tooltip.js";import{TransformRotateTooltipInfo as ft,TransformScaleTooltipInfo as Dt,TransformAbsoluteTooltipInfo as St}from"../../../../interactive/tooltip/TransformTooltipInfos.js";var Mt,vt;!function(t){t.ScaleIn=gt.Custom2,t.ScaleOut=gt.Custom3,t.RotateLeft=gt.Custom4,t.RotateRight=gt.Custom5,t.Unlocked=gt.Custom7,t.DelayedFocused=gt.Custom8,t.TouchInput=gt.Custom12}(Mt||(Mt={}));class bt{get angle(){return this._adapter.angle}get scale(){return this._adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}constructor({adapter:t,tooltipOptions:i,mode:o,tool:s}){this._mode=null,this._handles=new a,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new e,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this._adapter.scale:1,this.tool=s,this._mode=o,this._adapter=t,this._tooltipOptions=i,this._tooltip=new _t({view:s.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this._handles.add(l((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),c))}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this._handles=s(this._handles),this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=s(this._tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=p({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=s(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);const a=this.tool.graphicState.graphic,s=ut(e,((e,s,n)=>{this._scaleRotateDragData=null;const r=this._adapter.startInteraction(),l={mode:"none",origin:T(e.renderLocation),initialAngle:this._adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=F.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,c),s.next(x(this.tool.view,O(e.renderLocation,c,I()))).next((e=>{const s=A(e.plane),n=z(e.renderStart,e.renderEnd,l.origin,s),c=t.shortestSignedDiff(l.angle,n);l.angleDir=i(l.angleDir+c,-V,V),l.angle=n;const h=yt(l,e),p=h-this._adapter.scale;if(l.scaleDir=i(l.scaleDir+p,-q,q),this._onScaleChanged(),"none"===l.mode){const t=this._mode||wt(e,e.plane,l.origin,this.tool.view.state.camera);if(null!=t){switch(t){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:a,angle:0}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this._adapter.createUndoRecord()})}l.mode=t}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+n;break;case"scale":r.state.scale=h,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:a,xScale:h,yScale:h})}break;case"end":switch(l.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:o(l.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:h,yScale:h})}}return"end"===e.action&&(this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),e})).next(this._updateTooltipPipelineStep(l)),n.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1})}this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this._handles.add([s,e.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(jt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),e.events.on("immediate-click",(t=>{t.stopPropagation()})),h((()=>this.tool.graphicState?.displaying),(t=>this._ringManipulator.available=t),c)])}_updateTooltipPipelineStep(t){return e=>{const a=this._tooltipOptions;if(!a.enabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const i=this._tooltip,{size:o,scale:s,angle:l,relativeAngle:c}=this._adapter,h=this._tooltipOptions.visualVariables,p=h?.size,d=h?.rotation;switch(t.mode){case"scale":i.info=new Dt({tooltipOptions:a,scale:{value:s},size:r(o??-1,"meters"),sizeEnabled:!!p,sizeUnit:p?.unit,sizePrecision:Ot(p?.valueType)});break;case"rotate":{const t=Ot(d?.valueType);i.info=new ft({tooltipOptions:a,rotation:n(-(c??0),"radians","geographic"),rotationPrecision:t,rotationType:d?.rotationType??"geographic",orientation:n(-l,"radians","geographic"),orientationEnabled:!!d,orientationPrecision:t})}}return e}}_updateFocusTooltip(){if(!this._tooltipOptions.enabled)return;if(this.getFocused()){const t=this._tooltipOptions.visualVariables,e=t?.rotation,a=t?.size,i=this._mode,{size:o,angle:s}=this._adapter;this._tooltip.info=new St({tooltipOptions:this._tooltipOptions,orientation:n(-s,"radians","geographic"),orientationEnabled:!!e&&(null==i||"rotate"===i),orientationPrecision:Ot(e?.valueType),rotationType:e?.rotationType??"geographic",size:r(o??-1,"meters"),sizeUnit:a?.unit,sizeEnabled:!!a&&(null==i||"scale"===i),sizePrecision:Ot(a?.valueType)})}else this._tooltip.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=u(P.get(),this._adapter.angle,R(0,0,1));if(null==t)return;const e=this.getScale(),a=g(P.get(),S(F.get(),e,e,e));this._ringManipulator.modelTransform=m(P.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(it*(e-t)/(2*Math.PI));for(let s=0;s<o+1;s++){const n=t+s*(e-t)/o;i.push(R(a*Math.cos(n),a*Math.sin(n),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,Y/2],[-t/2,Y/2]],i=this._createMaterial(1),o=(t,e,o=i)=>ht(o,a(e),t,[],[],!1),s=e(Q),n=o(s,G),r={left:new Array,right:new Array},l=[];for(let R=0;R<2;R++){const e=R*Math.PI-Math.PI/4,a=Math.PI/2-ot,s=e+a,n=e+Math.PI/2-a,c=t(s,n,W),h=o(c,at);l.push(c),l.push(t(s,n,X-G/2)),r.left.push(h),r.right.push(h.instantiate());for(let t=0;t<2;t++){const e=0===t,a=D();if(e){_(a,a,[1,-1,1]),f(a,a,-s,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{f(a,a,n,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const o=lt(i,$,0,Z,Y);ct(o,a),(e?r.left:r.right).push(o)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-nt,i=e+a,s=e+Math.PI/2-a,n=t(i,s,X);c.push(o(n,at))}const h=this._createMaterial(.66),p=this._createMaterial(.5),d=this._createMaterial(.33),u=e(Q+tt),g=e(Q+et),m=o(u,at,h),S=o(g,at,d),M=e(Q-tt),v=e(Q-et),b=o(M,at,h),y=o(v,at,d);let w=[new L(n,Mt.DelayedFocused),new L(n.instantiate({material:p}),mt.None)];this._mode&&"scale"!==this._mode||(w=w.concat([...c.map((t=>new L(t,Mt.DelayedFocused|Mt.Unlocked))),new L(m,Mt.DelayedFocused|Mt.ScaleIn),new L(S,Mt.DelayedFocused|Mt.ScaleIn),new L(b,Mt.DelayedFocused|Mt.ScaleOut),new L(y,Mt.DelayedFocused|Mt.ScaleOut)])),this._mode&&"rotate"!==this._mode||(w=w.concat([...r.right.map((t=>new L(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new L(t,Mt.DelayedFocused|Mt.RotateRight)))]));const T=[s,...l];return new U({view:this.tool.view,renderObjects:w,autoScaleRenderObjects:!1,worldOriented:!0,radius:G,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:C(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:T,direction:R(0,0,1)}})}_createMaterial(t){const e=j([...J,t]);return new dt({color:e,transparent:1!==t,cullFace:rt.Back,renderOccluded:pt.Transparent})}get test(){return{ringManipulator:this._ringManipulator,setRingIndicatorDelayMs:t=>this._ringIndicatorDelayMs=t,tooltip:this._tooltip}}}function yt(t,e){const a=M(F.get(),e.renderStart,t.origin),i=M(F.get(),e.renderEnd,t.origin),o=v(a),s=v(i);return 0===o?0:s/o}function wt(t,e,a,i){const{renderStart:o,renderEnd:s}=t,n=Tt(o,i,F.get()),r=Tt(s,i,F.get());if(b(n,r)<K*K)return null;const l=M(F.get(),o,a),c=y(F.get(),l,A(e)),h=o,p=w(F.get(),h,c),d=Tt(a,i,F.get()),u=n,g=Tt(p,i,F.get()),m=M(F.get(),g,u),_=M(F.get(),n,d),f=E(u,m),D=E(d,_);return k(f,r)<k(D,r)?"rotate":"scale"}function Tt(t,e,a){return e.projectToScreen(t,It),S(a,It[0],It[1],0)}function Rt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*st,1),e(),Math.abs(i-1)<.01?vt.STOP:vt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function jt(t,e,a){let i=0,o=null;const s=()=>!1;return{start:()=>{o=t.getFocused,t.getFocused=s,i=0,e()},update:t=>(i+=t,!o?.()||i>=a.delayMs?vt.STOP:vt.CONTINUE),destroy:()=>{o&&(t.getFocused=o),e()}}}function Ot(t){switch(t){case"integer":case"long":return 0;default:return null}}!function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(vt||(vt={}));const It=d();export{bt as GraphicScaleRotateTransform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import{HandleOwnerMixin as i}from"../../../../../core/HandleOwner.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import h from"../../../../../geometry/Point.js";import{getGraphicEffectiveElevationInfo as u}from"../../../../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{placeAtGraphic as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{canMoveZ as _}from"../manipulatorUtils.js";import{createVisualElements as M}from"../visualElementUtils.js";import{ALIGN_ARROWS_SCALE_THRESHOLD as f}from"../manipulations/config.js";import{MoveManipulation as y,ManipulationType as S}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as R}from"../manipulations/moveUtils.js";import{GraphicScaleRotateTransform as b}from"./GraphicScaleRotateTransform.js";import{ScaleRotateMeshAdapter as w}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{createGraphicGeometryUndoRecord as A}from"./undoRecords.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{sceneSnappingAtProjectedLocation as x}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as O}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as E}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import G from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as U}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as k,TranslateGraphicTooltipInfo as C}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as L}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";let V=class extends(i(e.EventedMixin(O))){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new G,this.type="transform-3d",this._scaleRotate=null,this._tooltip=null}initialize(){const{graphic:t,view:e}=this;this.graphicState=new T({graphic:t}),this.addHandles(r((()=>this.tooltipOptions.enabled),(t=>{this._tooltip=t?new U({view:e}):o(this._tooltip)}),l)),this._moveManipulation=new y({tool:this,view:e,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&_(t),radius:y.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.handles.add(e.events.on("immediate-click",(e=>{this.emit("immediate-click",{...e,graphic:t}),e.stopPropagation()})))));const i=t=>e=>{this.handles.add(e.events.on("focus-changed",(({action:e})=>{const i=this._tooltip;null!=i&&("focus"===e?this._updateMoveTooltip(t):i.clear())})))};this._moveManipulation.xyManipulation.forEachManipulator(i(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(i(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(i(S.Z));const n=u(t);this._moveManipulation.elevationInfo=n;const s=t.geometry;if(this._moveManipulation.createGraphicDragPipeline(((i,a,o,r,l)=>{if(null!=s&&i===S.XY){const{snappingStep:i,cancelSnapping:a}=D({snappingContext:new z({elevationInfo:n,pointer:l,editGeometryOperations:E.fromGeometry(new h({spatialReference:s.spatialReference}),e.state.viewingMode),visualizer:new v,excludeFeature:t}),snappingManager:this.snappingManager,updatingHandles:this.updatingHandles,useZ:!1});r=r.next(a),o=o.next(x(this.view,n)).next(...i)}return{steps:o=o.next((t=>(this._updateMoveTooltip(i,t),t))),cancel:r}}),this.graphicState,(t=>{const{action:e,graphic:i,dxScreen:a,dyScreen:o}=t,n={graphic:i,dxScreen:a,dyScreen:o};switch(e){case"start":this.emit("graphic-translate-start",n),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",n);break;case"end":this.emit("graphic-translate-stop",n)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.handles.add(r((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new b({tool:this,mode:t,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.handles.add(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.handles.add([M({view:this.view,graphic:this.graphic,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()}),this.graphicState.on("changed",(()=>this._onGeometryChanged())),this._hideManipulatorsForGraphicState(),r((()=>e.scale),(()=>this._updateMoveAngle()))]),this.handles.add(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof d&&this.handles.add(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))})),this.finishToolCreation()}destroy(){this._tooltip=o(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=o(this._scaleRotate),this._scaleRotateAdapter=o(this._scaleRotateAdapter),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){return null!=this.graphic.geometry&&"mesh"===this.graphic.geometry.type?new w({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new j({graphic:this.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.graphic.layer)),sizeAxis:null!=this.tooltipOptions.visualVariables&&null!=this.tooltipOptions.visualVariables.size?this.tooltipOptions.visualVariables.size.axis:null})}_forEachManipulator(t){this._moveManipulation.forEachManipulator(t),null!=this._scaleRotate&&this._scaleRotate.forEachManipulator(t)}_hideManipulatorsForGraphicState(){return r((()=>this.graphicState.displaying),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&_(this.graphic)}))}_createGeometryUndoRecord(){return A(this.graphic)}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this.updatingHandles.updating}set location(t){this._moveManipulation.location=t,null!=this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,null!=this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){null!=this._scaleRotate&&this._scaleRotate.cancelActiveAnimation()}_onScaleChanged(){if(null==this._scaleRotate)return;const t=this._scaleRotate.getScale();this._moveManipulation.displayScale=t}_updateMoveAngle(){this.view.state.viewingMode===m.Local||this.view.scale<f?this._moveManipulation.angle=this._scaleRotateAdapter.angle:this._moveManipulation.angle=0}_onGeometryChanged(){g(this.view,this,this.graphic)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}_updateMoveTooltip(t,e){const{tooltipOptions:i,_tooltip:a}=this;if(null==a)return;a.clear();const o=this.graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=new C({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,e)=>L(t,e,o)));break;case S.XY_AXIS:a.info=new k({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const a=L(t,i,o);return n(a,R(e))}));break;case S.Z:a.info=new I({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:o}=e,n=i(a,o);t.distance=null!=n?n:s}}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:null!=this._scaleRotate?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:t=>null!=this._scaleRotate?this._scaleRotate.test.setRingIndicatorDelayMs(t):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};t([p({constructOnly:!0,nonNullable:!0})],V.prototype,"view",void 0),t([p({constructOnly:!0,nonNullable:!0})],V.prototype,"graphic",void 0),t([p({constructOnly:!0,nonNullable:!0})],V.prototype,"enableZ",void 0),t([p()],V.prototype,"enableRotation",void 0),t([p()],V.prototype,"enableScaling",void 0),t([p({constructOnly:!0,type:G})],V.prototype,"tooltipOptions",void 0),t([p()],V.prototype,"graphicState",void 0),t([p({value:!1})],V.prototype,"snapToScene",null),t([p({constructOnly:!0})],V.prototype,"snappingManager",void 0),t([p({readOnly:!0})],V.prototype,"type",void 0),t([p({readOnly:!0})],V.prototype,"updating",null),V=t([c("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],V);export{V as GraphicTransformTool};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import{HandleOwnerMixin as i}from"../../../../../core/HandleOwner.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import h from"../../../../../geometry/Point.js";import{getGraphicEffectiveElevationInfo as u}from"../../../../../support/elevationInfoUtils.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{placeAtGraphic as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{canMoveZ as _}from"../manipulatorUtils.js";import{createVisualElements as M}from"../visualElementUtils.js";import{ALIGN_ARROWS_SCALE_THRESHOLD as f}from"../manipulations/config.js";import{MoveManipulation as y,ManipulationType as S}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as R}from"../manipulations/moveUtils.js";import{GraphicScaleRotateTransform as w}from"./GraphicScaleRotateTransform.js";import{ScaleRotateMeshAdapter as b}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as j}from"./ScaleRotateObjectSymbol3DAdapter.js";import{createGraphicGeometryUndoRecord as A}from"./undoRecords.js";import{GraphicState as T}from"../../../layers/graphics/GraphicState.js";import{sceneSnappingAtProjectedLocation as x}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as O}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as E}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import G from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as U}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as k,TranslateGraphicTooltipInfo as C}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as L}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";let X=class extends(i(e.EventedMixin(O))){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new G,this.type="transform-3d",this._scaleRotate=null,this._tooltip=null}initialize(){const{graphic:t,view:e}=this;this.graphicState=new T({graphic:t}),this.addHandles(r((()=>this.tooltipOptions.enabled),(t=>{this._tooltip=t?new U({view:e}):o(this._tooltip)}),l)),this._moveManipulation=new y({tool:this,view:e,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&_(t),radius:y.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.handles.add(e.events.on("immediate-click",(e=>{this.emit("immediate-click",{...e,graphic:t}),e.stopPropagation()})))));const i=t=>e=>{this.handles.add(e.events.on("focus-changed",(({action:e})=>{const i=this._tooltip;null!=i&&("focus"===e?this._updateMoveTooltip(t):i.clear())})))};this._moveManipulation.xyManipulation.forEachManipulator(i(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(i(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(i(S.Z));const n=u(t);this._moveManipulation.elevationInfo=n;const s=t.geometry;if(this._moveManipulation.createGraphicDragPipeline(((i,a,o,r,l)=>{if(null!=s&&i===S.XY){const{snappingStep:i,cancelSnapping:a}=D({snappingContext:new z({elevationInfo:n,pointer:l,editGeometryOperations:E.fromGeometry(new h({spatialReference:s.spatialReference}),e.state.viewingMode),visualizer:new v,excludeFeature:t}),snappingManager:this.snappingManager,updatingHandles:this.updatingHandles,useZ:!1});r=r.next(a),o=o.next(x(this.view,n)).next(...i)}return{steps:o=o.next((t=>(this._updateMoveTooltip(i,t),t))),cancel:r}}),this.graphicState,(t=>{const{action:e,graphic:i,dxScreen:a,dyScreen:o}=t,n={graphic:i,dxScreen:a,dyScreen:o};switch(e){case"start":this.emit("graphic-translate-start",n),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",n);break;case"end":this.emit("graphic-translate-stop",n)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.handles.add(r((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new w({tool:this,mode:t,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.handles.add(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.handles.add([M({view:this.view,graphic:this.graphic,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()}),this.graphicState.on("changed",(()=>this._onGeometryChanged())),this._hideManipulatorsForGraphicState(),r((()=>e.scale),(()=>this._updateMoveAngle()))]),this.handles.add(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof d&&this.handles.add(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))})),this.finishToolCreation()}destroy(){this._tooltip=o(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=o(this._scaleRotate),this._scaleRotateAdapter=o(this._scaleRotateAdapter),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){return null!=this.graphic.geometry&&"mesh"===this.graphic.geometry.type?new b({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new j({graphic:this.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.graphic.layer)),sizeAxis:this.tooltipOptions?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForGraphicState(){return r((()=>this.graphicState.displaying),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&_(this.graphic)}))}_createGeometryUndoRecord(){return A(this.graphic)}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this.updatingHandles.updating}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){this.view.state.viewingMode===m.Local||this.view.scale<f?this._moveManipulation.angle=this._scaleRotateAdapter.angle:this._moveManipulation.angle=0}_onGeometryChanged(){g(this.view,this,this.graphic)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}_updateMoveTooltip(t,e){const{tooltipOptions:i,_tooltip:a}=this;if(null==a)return;a.clear();const o=this.graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=new C({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,e)=>L(t,e,o)));break;case S.XY_AXIS:a.info=new k({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const a=L(t,i,o);return n(a,R(e))}));break;case S.Z:a.info=new I({tooltipOptions:i}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,e,i){if(null!=e&&"end"!==e.action){const{mapStart:a,mapEnd:o}=e,n=i(a,o);t.distance=null!=n?n:s}}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:null!=this._scaleRotate?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:t=>null!=this._scaleRotate?this._scaleRotate.test.setRingIndicatorDelayMs(t):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};t([p({constructOnly:!0,nonNullable:!0})],X.prototype,"view",void 0),t([p({constructOnly:!0,nonNullable:!0})],X.prototype,"graphic",void 0),t([p({constructOnly:!0,nonNullable:!0})],X.prototype,"enableZ",void 0),t([p()],X.prototype,"enableRotation",void 0),t([p()],X.prototype,"enableScaling",void 0),t([p({constructOnly:!0,type:G})],X.prototype,"tooltipOptions",void 0),t([p()],X.prototype,"graphicState",void 0),t([p({value:!1})],X.prototype,"snapToScene",null),t([p({constructOnly:!0})],X.prototype,"snappingManager",void 0),t([p({readOnly:!0})],X.prototype,"type",void 0),t([p({readOnly:!0})],X.prototype,"updating",null),X=t([c("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],X);export{X as GraphicTransformTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{deg2rad as o,rad2deg as r}from"../../../../../core/mathUtils.js";import{when as n,sync as s}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{deg2rad as o,rad2deg as r}from"../../../../../core/mathUtils.js";import{when as n,sync as s}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{axis as c,angle as p}from"../../../../../geometry/support/axisAngleDegrees.js";import{ViewingMode as g}from"../../../../ViewingMode.js";import{createGraphicGeometryUndoRecord as h}from"./undoRecords.js";let u=class extends i{constructor(t){super(t),this._interactionState=null}initialize(){this.addHandles([n((()=>{const t=this._interactionState;return t&&t.angle!==t.previousAngle?{interactionState:t,angle:t.state.angle}:null}),(({interactionState:t})=>{this._updateMeshRotation(t)}),s),n((()=>{const t=this._interactionState;return t&&t.scale!==t.previousScale?{interactionState:t,scale:t.state.scale}:null}),(({interactionState:t})=>{this._updateMeshSize(t)}),s)])}get angle(){const t=this.geometry.transform;if(null==t)return this._interactionState?.angle??0;const e=c(t.rotation)[2];return Math.abs(e)>.999999?o(p(t.rotation))*Math.sign(e):0}get relativeAngle(){return this.angle-this.initialAngle}get initialAngle(){return this._interactionState?.initialAngle??0}get scale(){return this._interactionState?.scale??1}startInteraction(){const t=new m({angle:this.angle});this._interactionState=t;const e=()=>{this._interactionState=null};return{state:t,done:e,cancel:()=>{t.cancel(),e()}}}createUndoRecord(){return h(this.graphic)}_updateMeshRotation(t){const e=this.geometry.anchor,i=this.viewingMode===g.Global,{angle:o,previousAngle:n}=t;this.geometry.rotate(0,0,r(o-n),{origin:e,geographic:i}),t.previousAngle=o,null!=this.geometry.transform&&this.graphic.notifyMeshTransformChanged(),this.graphic.notifyGeometryChanged()}_updateMeshSize(t){const e=this.geometry.anchor,i=this.viewingMode===g.Global,{scale:o,previousScale:r}=t;this.geometry.scale(o/r,{origin:e,geographic:i}),t.previousScale=o,null!=this.geometry.transform&&this.graphic.notifyMeshTransformChanged(),this.graphic.notifyGeometryChanged()}};t([a({constructOnly:!0})],u.prototype,"graphic",void 0),t([a({constructOnly:!0})],u.prototype,"geometry",void 0),t([a({constructOnly:!0})],u.prototype,"viewingMode",void 0),t([a()],u.prototype,"angle",null),t([a()],u.prototype,"relativeAngle",null),t([a()],u.prototype,"initialAngle",null),t([a()],u.prototype,"scale",null),t([a()],u.prototype,"_interactionState",void 0),u=t([l("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateMeshAdapter")],u);let m=class extends e{get state(){const{angle:t,scale:e}=this;return{angle:t,scale:e}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=t.angle,this.previousAngle=t.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};t([a()],m.prototype,"angle",void 0),t([a()],m.prototype,"initialAngle",void 0),t([a()],m.prototype,"previousAngle",void 0),t([a()],m.prototype,"previousScale",void 0),t([a()],m.prototype,"scale",void 0),t([a()],m.prototype,"state",null),m=t([l("InteractionState")],m);export{u as ScaleRotateMeshAdapter};
|
package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{rad2deg as l,deg2rad as n}from"../../../../../core/mathUtils.js";import{when as o,sync as r}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";let c=class extends i{constructor(t){super(t),this.sizeAxis=null,this._interactionState=null}initialize(){this.addHandles(o((()=>null!=this._interactionState?this._interactionState.state:null),(t=>{this._updateSymbol(t)}),r))}get angle(){return null!=this._interactionState?this._interactionState.angle:null!=this._orientationReferenceSymbolLayer?h(this._orientationReferenceSymbolLayer.heading??0):0}get scale(){return
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{HandleOwner as i}from"../../../../../core/HandleOwner.js";import{rad2deg as l,deg2rad as n}from"../../../../../core/mathUtils.js";import{when as o,sync as r}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";let c=class extends i{constructor(t){super(t),this.sizeAxis=null,this._interactionState=null}initialize(){this.addHandles(o((()=>null!=this._interactionState?this._interactionState.state:null),(t=>{this._updateSymbol(t)}),r))}get angle(){return null!=this._interactionState?this._interactionState.angle:null!=this._orientationReferenceSymbolLayer?h(this._orientationReferenceSymbolLayer.heading??0):0}get scale(){return this._interactionState?.scale??1}get relativeAngle(){return this.angle-this.initialAngle}get initialAngle(){return this._interactionState?.initialAngle??0}get size(){const t=this._sizeReferenceSymbolLayer;if(null==t)return null;const e=this.findLayerView(),i=this._graphicSymbol;if(null==e||null==i||"point-3d"!==i.type)return null;const l=e.getSymbolLayerSize(i,t);if("size"in l&&null!=l.size)return l.size;const n=this.sizeAxis;return!("width"in l)||null==l.width||null!=n&&"width"!==n&&"all"!==n&&"width-and-depth"!==n?!("depth"in l)||null==t.depth||null!=n&&"depth"!==n&&"all"!==n&&"width-and-depth"!==n?!("height"in l)||null==t.height||null!=n&&"height"!==n&&"all"!==n?null:l.height:l.depth:l.width}get _sizeReferenceSymbolLayer(){const t=this._graphicSymbol;return null==t||0===t.symbolLayers.length?null:t.symbolLayers.find((t=>"object"===t.type))}get _orientationReferenceSymbolLayer(){const t=this._graphicSymbol;return null==t||0===t.symbolLayers.length?null:t.symbolLayers.find((t=>"object"===t.type&&null!=t.heading))}get _graphicSymbol(){return null!=this.graphic&&null!=this.graphic.symbol&&"point-3d"===this.graphic.symbol.type?this.graphic.symbol:null}set _graphicSymbol(t){this.graphic.symbol=t}startInteraction(){const t=this._graphicSymbol,e=this.findLayerView();if(null!=this._interactionState||null==t||null==e)return p;const i=t.symbolLayers.map((i=>"object"===i.type?e.getSymbolLayerSize(t,i):null)).toArray(),l=t.clone(),n=this.angle,o=new y({originalSymbol:l,angle:n,initialSizes:i});this._interactionState=o;const r=()=>{this._interactionState=null};return{state:o,done:r,cancel:()=>{this._graphicSymbol=l,r()}}}createUndoRecord(){let t=this.graphic.symbol,e=null;return{undo:i=>{e=i.symbol,i.symbol=t},redo:i=>{t=i.symbol,i.symbol=e}}}_updateSymbol({scale:t,angle:e,originalSymbol:i,initialSizes:n}){const o=this._graphicSymbol;if(null==o||"point-3d"!==o.type)return;const r=o.clone(),s=-l(e-this.initialAngle);let a=!1;this._forEachObjectSymbolLayerPair(i,r,((e,i,l)=>{const o=(e.heading??0)+s;i.heading!==o&&(i.heading=o,a=!0);const r=n[l];if(null!=r&&"width"in r){r.width=this.sizeFilter(r.width),r.height=this.sizeFilter(r.height),r.depth=this.sizeFilter(r.depth);const e=r.width*t;i.width!==e&&(i.width=e,a=!0);const l=r.depth*t;i.depth!==l&&(i.depth=l,a=!0);const n=r.height*t;i.height!==n&&(i.height=n,a=!0)}})),a&&(this._graphicSymbol=r)}_forEachObjectSymbolLayerPair(t,e,i){t.symbolLayers.forEach(((t,l)=>{const n=e.symbolLayers.getItemAt(l);"object"===t.type&&"object"===n.type&&i(t,n,l)}))}};function h(t){return-n(t)}t([s()],c.prototype,"angle",null),t([s()],c.prototype,"scale",null),t([s()],c.prototype,"relativeAngle",null),t([s()],c.prototype,"initialAngle",null),t([s()],c.prototype,"size",null),t([s()],c.prototype,"sizeAxis",void 0),t([s({constructOnly:!0})],c.prototype,"graphic",void 0),t([s()],c.prototype,"_interactionState",void 0),t([s({constructOnly:!0})],c.prototype,"findLayerView",void 0),t([s({constructOnly:!0})],c.prototype,"sizeFilter",void 0),t([s()],c.prototype,"_sizeReferenceSymbolLayer",null),t([s()],c.prototype,"_orientationReferenceSymbolLayer",null),t([s()],c.prototype,"_graphicSymbol",null),c=t([a("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateObjectSymbol3DAdapter")],c);const p={state:{angle:0,scale:0},done:()=>{},cancel:()=>{}};let y=class extends e{get state(){const{originalSymbol:t,angle:e,initialAngle:i,scale:l,initialSizes:n}=this;return{originalSymbol:t,angle:e,initialAngle:i,scale:l,initialSizes:n}}constructor(t){super(t),this.angle=0,this.initialAngle=0,this.scale=1,this.initialAngle=t.angle}};t([s()],y.prototype,"originalSymbol",void 0),t([s()],y.prototype,"angle",void 0),t([s()],y.prototype,"initialAngle",void 0),t([s()],y.prototype,"initialSizes",void 0),t([s()],y.prototype,"scale",void 0),t([s()],y.prototype,"state",null),y=t([a("InteractionState")],y);export{c as ScaleRotateObjectSymbol3DAdapter,h as headingToAngle};
|