@arcgis/core 4.28.0-next.20230821 → 4.28.0-next.20230822

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.
Files changed (183) hide show
  1. package/arcade/functions/geomasync.js +1 -1
  2. package/arcade/portalUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0746319459dbcd3ab6f7.js +1 -0
  5. package/assets/esri/core/workers/chunks/217910f88fe2c03e6bdd.js +1 -0
  6. package/assets/esri/core/workers/chunks/54aaa21144431b29b6ed.js +1 -0
  7. package/assets/esri/core/workers/chunks/{46f6b77e586d78aeb75c.js → 6866dee1c7e2f230ad08.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{d6c96a20e9640b433719.js → 7dad40179a9767ea9087.js} +56 -56
  9. package/assets/esri/core/workers/chunks/{05ab09713d599687afa3.js → c6bd9c400615107591ec.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4922a0fed7cbc6895882.js → f701a5afa1b730c51a49.js} +1 -1
  11. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_ar.json +1 -0
  12. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_bg.json +1 -0
  13. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_bs.json +1 -0
  14. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_ca.json +1 -0
  15. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_cs.json +1 -0
  16. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_da.json +1 -0
  17. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_de.json +1 -0
  18. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_el.json +1 -0
  19. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_es.json +1 -0
  20. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_et.json +1 -0
  21. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_fi.json +1 -0
  22. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_fr.json +1 -0
  23. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_he.json +1 -0
  24. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_hr.json +1 -0
  25. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_hu.json +1 -0
  26. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_id.json +1 -0
  27. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_it.json +1 -0
  28. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_ja.json +1 -0
  29. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_ko.json +1 -0
  30. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_lt.json +1 -0
  31. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_lv.json +1 -0
  32. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_nb.json +1 -0
  33. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_nl.json +1 -0
  34. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_pl.json +1 -0
  35. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_pt-BR.json +1 -0
  36. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_pt-PT.json +1 -0
  37. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_ro.json +1 -0
  38. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_ru.json +1 -0
  39. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_sk.json +1 -0
  40. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_sl.json +1 -0
  41. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_sr.json +1 -0
  42. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_sv.json +1 -0
  43. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_th.json +1 -0
  44. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_tr.json +1 -0
  45. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_uk.json +1 -0
  46. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_vi.json +1 -0
  47. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_zh-CN.json +1 -0
  48. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_zh-HK.json +1 -0
  49. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_zh-TW.json +1 -0
  50. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  51. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  52. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  53. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  54. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  55. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  56. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  58. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  59. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  60. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  61. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  62. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  63. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  64. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  65. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  66. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  67. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  68. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  69. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  70. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  71. package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
  72. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  73. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  89. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
  90. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
  91. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
  92. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
  93. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
  94. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
  95. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
  96. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
  97. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
  98. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
  99. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
  100. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
  101. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
  102. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
  103. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
  104. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
  105. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
  106. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
  107. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
  108. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
  109. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
  110. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
  111. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
  112. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
  113. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
  114. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
  115. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
  116. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
  117. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
  118. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
  119. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
  120. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
  121. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
  122. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
  123. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
  124. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
  125. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
  126. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
  127. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
  128. package/chunks/LineSeries.js +1 -1
  129. package/chunks/Theme.js +1 -1
  130. package/chunks/chartUtilsAm5.js +1 -1
  131. package/layers/support/layerUtils.js +1 -1
  132. package/package.json +1 -1
  133. package/portal/support/utils.js +5 -0
  134. package/smartMapping/popup/support/utils.js +1 -1
  135. package/support/revision.js +1 -1
  136. package/symbols/cim/CIMImageColorSubstitutionHelper.js +1 -1
  137. package/symbols/support/previewSymbol3D.js +1 -1
  138. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  139. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  140. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  141. package/views/3d/analysis/images/Factory.js +5 -0
  142. package/views/3d/interactive/Manipulator3D.js +1 -1
  143. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  144. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  145. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  146. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  147. package/views/3d/layers/I3SMeshView3D.js +1 -1
  148. package/views/3d/layers/MediaLayerView3D.js +1 -1
  149. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  150. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  151. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  152. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  153. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  154. package/views/3d/support/StreamTextureCollection.js +1 -1
  155. package/views/3d/support/TextureCollection.js +1 -1
  156. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  157. package/views/3d/webgl-engine/Stage.js +1 -1
  158. package/views/3d/webgl-engine/lib/ContentObject.js +1 -1
  159. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  160. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  161. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  162. package/views/3d/webgl-engine/lib/ITexture.js +5 -0
  163. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  164. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  165. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  166. package/views/3d/webgl-engine/parts/Model.js +1 -1
  167. package/views/draw/DrawManipulator.js +1 -1
  168. package/views/interactive/GraphicManipulator.js +1 -1
  169. package/views/interactive/ManipulatorCollection.js +1 -1
  170. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  171. package/views/support/layerViewUtils.js +1 -1
  172. package/widgets/Sketch.js +1 -1
  173. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  174. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  175. package/assets/esri/core/workers/chunks/4e39252f40bc57be9d12.js +0 -1
  176. package/assets/esri/core/workers/chunks/c99fa4189a114370b004.js +0 -1
  177. package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +0 -1
  178. package/views/3d/analysis/Slice/images/Factory.js +0 -5
  179. /package/assets/esri/views/3d/analysis/{Slice/images → images}/heading-rotate.ts.svg +0 -0
  180. /package/assets/esri/views/3d/analysis/{Slice/images → images}/tilt-rotate.ts.svg +0 -0
  181. /package/views/3d/analysis/{Slice/images → images}/generateTextures.js +0 -0
  182. /package/views/3d/analysis/{Slice/images → images}/heading-rotate-svg.js +0 -0
  183. /package/views/3d/analysis/{Slice/images → images}/tilt-rotate-svg.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return a(e)||s(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function s(e){return"scene"===e?.type}function a(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function c(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function o(e){return null!=e&&"type"in e&&"group"===e.type}const l={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function f(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function p(e){return"voxel"===e?.type}function y(e){return"imagery-tile"===e?.type}function g(e){return null!=e&&null!=e.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function b(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function d(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function m(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function v(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function h(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function j(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function w(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:c}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return c?.owningSystemUrl||null}function E(e){if(!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function L(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function S(e){return E(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function C(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function x(e){return!!C(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{x as getEffectiveEditingEnabled,S as getEffectiveLayerCapabilities,w as getOwningPortalUrl,j as getTileMaxtrixSetFromActiveLayer,g as isBaseLayer,n as isBasemap3DSupportedLayer,a as isBasemapSupportedTiledLayer,b as isFeatureCollectionLayer,r as isFeatureLayer,m as isFeatureServiceLayer,i as isGraphicsLayer,o as isGroupLayer,y as isImageryTileLayer,d as isLayerWithFeatureLayerSource,u as isMapNotesLayer,s as isSceneLayer,f as isSceneServiceLayer,L as isTable,c as isTiledLayer,p as isVoxelLayer,l as sceneServiceLayerTypeToClassName,v as serializeLayerDefinitions,h as serializeTimeOptions};
5
+ import{id as e}from"../../kernel.js";import t from"../../request.js";function n(e){return c(e)||a(e)}function r(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function i(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function a(e){return"scene"===e?.type}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function c(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function l(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function f(e){return null!=e&&"type"in e&&"group"===e.type}const p={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function y(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function g(e){return"voxel"===e?.type}function b(e){return"imagery-tile"===e?.type}function d(e){return null!=e&&null!=e.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent.baseLayers.includes(e)}function m(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function h(e){return("feature"===e?.type||"subtype-group"===e?.type)&&"feature-layer"===e.source?.type}function v(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function j(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function w(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function E(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function L(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.substring(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:o}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return o?.owningSystemUrl||null}function S(e){if(!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function C(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function x(e){return S(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function M(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function O(e){return!!M(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}export{O as getEffectiveEditingEnabled,x as getEffectiveLayerCapabilities,L as getOwningPortalUrl,E as getTileMaxtrixSetFromActiveLayer,d as isBaseLayer,n as isBasemap3DSupportedLayer,c as isBasemapSupportedTiledLayer,m as isFeatureCollectionLayer,r as isFeatureLayer,v as isFeatureServiceLayer,i as isGraphicsLayer,f as isGroupLayer,b as isImageryTileLayer,s as isKnowledgeGraphLayer,h as isLayerWithFeatureLayerSource,u as isMapNotesLayer,a as isSceneLayer,y as isSceneServiceLayer,o as isSubtypeGroupLayer,C as isTable,l as isTiledLayer,g as isVoxelLayer,p as sceneServiceLayerTypeToClassName,j as serializeLayerDefinitions,w as serializeTimeOptions};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.28.0-next.20230821",
3
+ "version": "4.28.0-next.20230822",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
+ */
5
+ import{id as e}from"../../kernel.js";import r from"../../request.js";async function n(n,s,t){const u=e?.findCredential(n.restUrl);if(!u)return null;if("loaded"===n.loadStatus&&""===s&&n.user&&n.user.sourceJSON&&!1===t)return n.user.sourceJSON;const o={responseType:"json",query:{f:"json"}};if(t&&(o.query.returnUserLicenseTypeExtensions=!0),""===s){const e=await r(n.restUrl+"/community/self",o);if(e.data){const r=e.data;if(r&&r.username)return r}return null}const i=await r(n.restUrl+"/community/users/"+s,o);if(i.data){const e=i.data;return e.error?null:e}return null}async function s(e,r,s){const t=await n(e,r,!0);return!!t.userLicenseTypeExtensions?.includes(s)}export{s as hasUserTypeExtension,n as lookupUser};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{unique as e}from"../../../core/arrayUtils.js";import{fetchMessageBundle as t}from"../../../intl/messages.js";import{substitute as n}from"../../../intl/substitute.js";import{numericTypes as i}from"../../../layers/support/fieldUtils.js";import"../../../popup/content/AttachmentsContent.js";import"../../../popup/content/Content.js";import"../../../popup/content/CustomContent.js";import"../../../popup/content/ExpressionContent.js";import o from"../../../popup/content/FieldsContent.js";import"../../../popup/content/MediaContent.js";import"../../../popup/content/RelationshipContent.js";import s from"../../../popup/content/TextContent.js";import r from"../../../popup/ExpressionInfo.js";import a from"../../../popup/FieldInfo.js";import{getAttributes as p}from"../../../renderers/support/utils.js";import{viewScaleRE as l}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{getFeatureReductionFields as u}from"../../support/adapters/support/utils.js";let m=0;const f="expression/";function d(e){return"hasVisualVariables"in e&&e.hasVisualVariables()?e.visualVariables.filter((e=>!l.test(e.valueExpression)&&(!("target"in e)||"outline"!==e.target))):[]}function c(e,t){if(!t)return null;const n=u(e);return n?.find((e=>e.name.toLowerCase()===t.toLowerCase()))}function b(e,t,n){let o=null;if(n){const t=e.featureReduction;t&&"popupTemplate"in t&&t.popupTemplate&&(o=t.popupTemplate.fieldInfos)}else"popupTemplate"in e&&e.popupTemplate&&(o=e.popupTemplate.fieldInfos);const s=n?c(e,t):e.getField(t);let r=null;if(o&&o.some((e=>!(!e||e.fieldName.toLowerCase()!==s?.name.toLowerCase())&&(r=e.clone(),!0))),!r){const e=i.includes(s.type),t="integer"===s.type||"small-integer"===s.type;r=new a({fieldName:s.name,isEditable:s.editable,visible:!0,format:e?{places:t?0:2,digitSeparator:!0}:null})}return r.label||(r.label=s.alias),r}function x(e){const{expression:t,title:n,returnType:i}=e;return new r({name:"expr"+m++,expression:t,title:n,returnType:i})}function g(e){const t="number"===e.returnType?{places:2,digitSeparator:!0}:null;return new a({fieldName:`${f}${e.name}`,visible:!0,format:t})}async function j(i){const o=await t("esri/smartMapping/t9n/smartMapping"),{renderer:s,layer:r,normFieldExpressionTemplate:a,isFeatureReduction:l}=i,u=[],m=[],f=p(s,d);for(const e of f)if("field"===e.type)u.push(b(r,e.field,l));else if("normalized-field"===e.type){const t=l?c(r,e.field):r.getField(e.field),i=l?c(r,e.normalizationField):r.getField(e.normalizationField),s=x({type:"expression",expression:`\n $feature["${t.name}"];\n $feature["${i.name}"];\n ${"percentage"===a?`($feature["${t.name}"] / $feature["${i.name}"]) * 100;`:`$feature["${t.name}"] / $feature["${i.name}"];`}\n `,title:n("percentage"===a?o.normFieldLabelAsPercent:o.normFieldLabel,{expression1:t.alias,expression2:i.alias}),returnType:"number"});u.push(g(s),b(r,e.field,l),b(r,e.normalizationField,l)),m.push(s)}else if("expression"===e.type){const t=x(e);u.push(g(t)),m.push(t)}return{fieldInfos:e(u,((e,t)=>e.fieldName===t.fieldName)),expressionInfos:e(m,((e,t)=>e.expression===t.expression))}}async function F(e,i,r){const{fieldInfos:a,expressionInfos:p}=i,l=await t("esri/smartMapping/t9n/smartMapping");if(a.length>2)return[new o({fieldInfos:a})];const u=[];for(const t of a){const i=t.fieldName;let o=t.label;if(!o){const t=r?c(e,i):e.getField(i);if(t)o=t.alias||i;else if(p){const e=i.split(f)[1],t=p[p.findIndex((t=>t.name===e))];t&&(o=t.title||t.name)}}u.push(new s({text:n(l.fieldInfo,{fieldLabel:o,fieldValue:`{${i}}`})}))}return u}function y(e){return!(!("normalizationField"in e)||!e.normalizationField)||"hasVisualVariables"in e&&e.hasVisualVariables()&&e.visualVariables.some((e=>!(!("normalizationField"in e)||!e.normalizationField)))}export{f as expressionFieldPrefix,F as getContentFromFieldInfos,x as getExpressionInfo,j as getFieldAndExpressionInfos,b as getFieldInfo,g as getFieldInfoFromExpressionInfo,d as getPrimaryVisualVariables,y as hasNormalizedField};
5
+ import{unique as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{fetchMessageBundle as t}from"../../../intl/messages.js";import{substitute as n}from"../../../intl/substitute.js";import{numericTypes as i}from"../../../layers/support/fieldUtils.js";import"../../../popup/content/AttachmentsContent.js";import"../../../popup/content/Content.js";import"../../../popup/content/CustomContent.js";import"../../../popup/content/ExpressionContent.js";import o from"../../../popup/content/FieldsContent.js";import"../../../popup/content/MediaContent.js";import"../../../popup/content/RelationshipContent.js";import s from"../../../popup/content/TextContent.js";import r from"../../../popup/ExpressionInfo.js";import a from"../../../popup/FieldInfo.js";import{getAttributes as p}from"../../../renderers/support/utils.js";import{viewScaleRE as l}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{getFeatureReductionFields as u}from"../../support/adapters/support/utils.js";let m=0;function f(e=0){}const d="expression/";function c(e){return"hasVisualVariables"in e&&e.hasVisualVariables()?e.visualVariables.filter((e=>!l.test(e.valueExpression)&&(!("target"in e)||"outline"!==e.target))):[]}function b(e,t){if(!t)return null;const n=u(e);return n?.find((e=>e.name.toLowerCase()===t.toLowerCase()))}function x(e,t,n){let o=null;if(n){const t=e.featureReduction;t&&"popupTemplate"in t&&t.popupTemplate&&(o=t.popupTemplate.fieldInfos)}else"popupTemplate"in e&&e.popupTemplate&&(o=e.popupTemplate.fieldInfos);const s=n?b(e,t):e.getField(t);let r=null;if(o&&o.some((e=>!(!e||e.fieldName.toLowerCase()!==s?.name.toLowerCase())&&(r=e.clone(),!0))),!r){const e=i.includes(s.type),t="integer"===s.type||"small-integer"===s.type;r=new a({fieldName:s.name,isEditable:s.editable,visible:!0,format:e?{places:t?0:2,digitSeparator:!0}:null})}return r.label||(r.label=s.alias),r}function g(e){const{expression:t,title:n,returnType:i}=e;return new r({name:"expr"+m++,expression:t,title:n,returnType:i})}function j(e){const t="number"===e.returnType?{places:2,digitSeparator:!0}:null;return new a({fieldName:`${d}${e.name}`,visible:!0,format:t})}async function F(i){const o=await t("esri/smartMapping/t9n/smartMapping"),{renderer:s,layer:r,normFieldExpressionTemplate:a,isFeatureReduction:l}=i,u=[],m=[],f=p(s,c);for(const e of f)if("field"===e.type)u.push(x(r,e.field,l));else if("normalized-field"===e.type){const t=l?b(r,e.field):r.getField(e.field),i=l?b(r,e.normalizationField):r.getField(e.normalizationField),s=g({type:"expression",expression:`\n $feature["${t.name}"];\n $feature["${i.name}"];\n ${"percentage"===a?`($feature["${t.name}"] / $feature["${i.name}"]) * 100;`:`$feature["${t.name}"] / $feature["${i.name}"];`}\n `,title:n("percentage"===a?o.normFieldLabelAsPercent:o.normFieldLabel,{expression1:t.alias,expression2:i.alias}),returnType:"number"});u.push(j(s),x(r,e.field,l),x(r,e.normalizationField,l)),m.push(s)}else if("expression"===e.type){const t=g(e);u.push(j(t)),m.push(t)}return{fieldInfos:e(u,((e,t)=>e.fieldName===t.fieldName)),expressionInfos:e(m,((e,t)=>e.expression===t.expression))}}async function y(e,i,r){const{fieldInfos:a,expressionInfos:p}=i,l=await t("esri/smartMapping/t9n/smartMapping");if(a.length>2)return[new o({fieldInfos:a})];const u=[];for(const t of a){const i=t.fieldName;let o=t.label;if(!o){const t=r?b(e,i):e.getField(i);if(t)o=t.alias||i;else if(p){const e=i.split(d)[1],t=p[p.findIndex((t=>t.name===e))];t&&(o=t.title||t.name)}}u.push(new s({text:n(l.fieldInfo,{fieldLabel:o,fieldValue:`{${i}}`})}))}return u}function $(e){return!(!("normalizationField"in e)||!e.normalizationField)||"hasVisualVariables"in e&&e.hasVisualVariables()&&e.visualVariables.some((e=>!(!("normalizationField"in e)||!e.normalizationField)))}export{d as expressionFieldPrefix,y as getContentFromFieldInfos,g as getExpressionInfo,F as getFieldAndExpressionInfos,x as getFieldInfo,j as getFieldInfoFromExpressionInfo,c as getPrimaryVisualVariables,$ as hasNormalizedField,f as resetSuffixForTests};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const c="20230821",a="accf51d40adc5636cda9c9f5d37a532b14bc0934";export{c as buildDate,a as commitHash};
5
+ const d="20230822",c="148b95a56370d36774501683cc9edd0d782b9fe4";export{d as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- class t{applyColorSubstituition(t,a){if(!a)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:e,height:n}=t,o=this._rasterizationCanvas,r=o.getContext("2d");t!==o&&(o.width=e,o.height=n,r.drawImage(t,0,0,e,n));const i=r.getImageData(0,0,e,n).data;if(a)for(const h of a)if(h&&h.oldColor&&4===h.oldColor.length&&h.newColor&&4===h.newColor.length){const[t,a,e,n]=h.oldColor,[o,r,s,l]=h.newColor;if(t===o&&a===r&&e===s&&n===l)continue;for(let h=0;h<i.length;h+=4)t===i[h]&&a===i[h+1]&&e===i[h+2]&&n===i[h+3]&&(i[h]=o,i[h+1]=r,i[h+2]=s,i[h+3]=l)}const s=new ImageData(i,e,n);return r.putImageData(s,0,0),o}tintImageData(t,a){if(!a||a.length<4)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:e,height:n}=t,o=this._rasterizationCanvas,r=o.getContext("2d");t!==o&&(o.width=e,o.height=n,r.drawImage(t,0,0,e,n));const i=r.getImageData(0,0,e,n),s=new Uint8Array(i.data),h=[a[0]/255,a[1]/255,a[2]/255,a[3]/255];for(let g=0;g<s.length;g+=4)s[g]*=h[0],s[g+1]*=h[1],s[g+2]*=h[2],s[g+3]*=h[3];const l=new ImageData(new Uint8ClampedArray(s.buffer),e,n);return r.putImageData(l,0,0),o}}export{t as default};
5
+ class t{applyColorSubstituition(t,a){if(!a)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:e,height:n}=t,o=this._rasterizationCanvas,r=o.getContext("2d",{willReadFrequently:!0});t!==o&&(o.width=e,o.height=n,r.drawImage(t,0,0,e,n));const i=r.getImageData(0,0,e,n).data;if(a)for(const l of a)if(l&&l.oldColor&&4===l.oldColor.length&&l.newColor&&4===l.newColor.length){const[t,a,e,n]=l.oldColor,[o,r,s,h]=l.newColor;if(t===o&&a===r&&e===s&&n===h)continue;for(let l=0;l<i.length;l+=4)t===i[l]&&a===i[l+1]&&e===i[l+2]&&n===i[l+3]&&(i[l]=o,i[l+1]=r,i[l+2]=s,i[l+3]=h)}const s=new ImageData(i,e,n);return r.putImageData(s,0,0),o}tintImageData(t,a){if(!a||a.length<4)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:e,height:n}=t,o=this._rasterizationCanvas,r=o.getContext("2d",{willReadFrequently:!0});t!==o&&(o.width=e,o.height=n,r.drawImage(t,0,0,e,n));const i=r.getImageData(0,0,e,n),s=new Uint8Array(i.data),l=[a[0]/255,a[1]/255,a[2]/255,a[3]/255];for(let g=0;g<s.length;g+=4)s[g]*=l[0],s[g+1]*=l[1],s[g+2]*=l[2],s[g+3]*=l[3];const h=new ImageData(new Uint8ClampedArray(s.buffer),e,n);return r.putImageData(h,0,0),o}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../assets.js";import{toHSV as t,toRGB as l}from"../../core/colorUtils.js";import"../../core/has.js";import a from"../../core/Error.js";import s from"../../core/Logger.js";import{pt2px as n}from"../../core/screenUtils.js";import{defaultThematicColor as r,getPatternUrlWithColor as o,dekebabifyLineStyle as i}from"./gfxUtils.js";import{defaultPrimitive as c}from"./IconSymbol3DLayerResource.js";import{defaultPrimitive as p}from"./ObjectSymbol3DLayerResource.js";import{SymbolSizeDefaults as u,adjustColorComponentBrightness as h,getPathSymbolShapes as m,shapes as f,getExtrudeSymbolShapes as y,getTetrahedronShapes as b,getDiamondShapes as d,getCylinderShapes as k,getCubeShapes as v,getInvertedConeShapes as w,getConeShapes as g,getWaterSymbolShapes as x}from"./previewUtils.js";import{tintImageWithColor as M,renderSymbol as L}from"./renderUtils.js";import{isVolumetricSymbol as j,getIconHref as z}from"./utils.js";import{resolveWebStyleSymbol as S}from"./webStyleSymbolUtils.js";const P=u.size,D=u.maxSize,U=u.maxOutlineSize,O=u.lineWidth,C=u.tallSymbolWidth;function R(e){const t=e.outline,l=null!=e.material?e.material.color:null,a=null!=l?l.toHex():null;if(null==t||"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type&&"none"===t.pattern.style)return"fill"===e.type&&"#ffffff"===a?{color:"#bdc3c7",width:.75}:null;const s=n(t.size)||0;return{color:"rgba("+(null!=t.color?t.color.toRgba():"255,255,255,1")+")",width:Math.min(s,U),style:"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type?i(t.pattern.style):null,join:"butt",cap:"patternCap"in t?t.patternCap:"butt"}}async function E(t,l){if(t.thumbnail?.url)return t.thumbnail.url;if("icon"===l.type){const e=l?.resource?.href;if(e)return z(l)}const a=e("esri/images/Legend/legend3dsymboldefault.png");if(t.styleOrigin&&(t.styleOrigin.styleName||t.styleOrigin.styleUrl)){const e=await S(t.styleOrigin,{portal:t.styleOrigin.portal},"webRef").catch((()=>null));if(e&&"thumbnail"in e&&e.thumbnail?.url)return e.thumbnail.url}return a}function I(e,a=1){const s=e.a,n=t(e),r=n.h,o=n.s/a,i=100-(100-n.v)/a,{r:c,g:p,b:u}=l({h:r,s:o,v:i});return[c,p,u,s]}function Z(e){return"water"===e.type?null==e.color?null:e.color:null==e.material||null==e.material.color?null:e.material.color}function q(e,t=0){const l=Z(e);if(!l){if("fill"===e.type)return null;const l=r.r,a=h(l,t);return[a,a,a,100]}const a=l.toRgba();for(let s=0;s<3;s++)a[s]=h(a[s],t);return a}async function H(t,l){const a=t.style;if("none"===a)return null;return{type:"pattern",x:0,y:0,src:await o(e(`esri/symbols/patterns/${a}.png`),l.toCss(!0)),width:5,height:5}}function N(e){return e.outline?R(e):{color:"rgba(0, 0, 0, 1)",width:1.5}}function T(e,t){const l=Z(e);if(!l)return null;let a="rgba(";return a+=h(l.r,t)+",",a+=h(l.g,t)+",",a+=h(l.b,t)+",",a+l.a+");"}function W(e,t){const l=T(e,t);if(!l)return{};if("pattern"in e&&null!=e.pattern&&"style"===e.pattern.type&&"none"===e.pattern.style)return null;return{color:l,width:Math.min(e.size?n(e.size):.75,U),style:"pattern"in e&&null!=e.pattern&&"style"===e.pattern.type?i(e.pattern.style):null,cap:"cap"in e?e.cap:null,join:"join"in e?"miter"===e.join?n(2):e.join:null}}function F(e,t,l){const a=null!=l?.75*l:0;return{type:"linear",x1:a?.25*a:0,y1:a?.5*a:0,x2:a||4,y2:a?.5*a:4,colors:[{color:e,offset:0},{color:t,offset:1}]}}function $(e){const t=e.depth,l=e.height,a=e.width;return 0!==a&&0!==t&&0!==l&&a===t&&null!=a&&null!=l&&a<l}function A(e,t,l){const a=[];if(!e)return a;switch(e.type){case"icon":{const l=0,s=0,n=t,r=t;switch(e.resource&&e.resource.primitive||c){case"circle":a.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:q(e,0),stroke:R(e)});break;case"square":a.push({shape:{type:"path",path:[{command:"M",values:[l,r]},{command:"L",values:[l,s]},{command:"L",values:[n,s]},{command:"L",values:[n,r]},{command:"Z",values:[]}]},fill:q(e,0),stroke:R(e)});break;case"triangle":a.push({shape:{type:"path",path:[{command:"M",values:[l,r]},{command:"L",values:[.5*n,s]},{command:"L",values:[n,r]},{command:"Z",values:[]}]},fill:q(e,0),stroke:R(e)});break;case"cross":a.push({shape:{type:"path",path:[{command:"M",values:[.5*n,s]},{command:"L",values:[.5*n,r]},{command:"M",values:[l,.5*r]},{command:"L",values:[n,.5*r]}]},stroke:N(e)});break;case"x":a.push({shape:{type:"path",path:[{command:"M",values:[l,s]},{command:"L",values:[n,r]},{command:"M",values:[n,s]},{command:"L",values:[l,r]}]},stroke:N(e)});break;case"kite":a.push({shape:{type:"path",path:[{command:"M",values:[l,.5*r]},{command:"L",values:[.5*n,s]},{command:"L",values:[n,.5*r]},{command:"L",values:[.5*n,r]},{command:"Z",values:[]}]},fill:q(e,0),stroke:R(e)})}break}case"object":switch(e.resource&&e.resource.primitive||p){case"cone":{const s=F(q(e,0),q(e,-.6),l?C:t),n=g(t,l);a.push({shape:n[0],fill:s},{shape:n[1],fill:s});break}case"inverted-cone":{const l=q(e,0),s=F(l,q(e,-.6),t),n=w(t);a.push({shape:n[0],fill:s},{shape:n[1],fill:l});break}case"cube":{const s=v(t,l);a.push({shape:s[0],fill:q(e,0)},{shape:s[1],fill:q(e,-.3)},{shape:s[2],fill:q(e,-.5)});break}case"cylinder":{const s=F(q(e,0),q(e,-.6),l?C:t),n=k(t,l);a.push({shape:n[0],fill:s},{shape:n[1],fill:s},{shape:n[2],fill:q(e,0)});break}case"diamond":{const l=d(t);a.push({shape:l[0],fill:q(e,-.3)},{shape:l[1],fill:q(e,0)},{shape:l[2],fill:q(e,-.3)},{shape:l[3],fill:q(e,-.7)});break}case"sphere":{const l=F(q(e,0),q(e,-.6));l.x1=0,l.y1=0,l.x2=.25*t,l.y2=.25*t,a.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:l});break}case"tetrahedron":{const l=b(t);a.push({shape:l[0],fill:q(e,-.3)},{shape:l[1],fill:q(e,0)},{shape:l[2],fill:q(e,-.6)});break}}break}return a}function B(e){const t="number"==typeof e?.size?e?.size:null;return t?n(t):null}function G(e){return"icon"===e.type?"multiply":"tint"}async function J(e,t){const l=B(t),a=t?.maxSize?n(t.maxSize):null,r=t?.disableUpsampling??!1,o=e.symbolLayers,i=[];let c=0,p=0;const u=o.at(-1);let h;u&&"icon"===u.type&&(h=u.size&&n(u.size)),o.forEach((s=>{if("icon"!==s.type&&"object"!==s.type)return;const o="icon"===s.type?s.size&&n(s.size):0,u=l||o?Math.ceil(Math.min(l||o,a||D)):P;if(s&&s.resource&&s.resource.href){const t=E(e,s).then((e=>{const t=s?.material?.color,l=G(s);return M(e,u,t,l,r)})).then((e=>{const t=e.width,l=e.height;return c=Math.max(c,t),p=Math.max(p,l),[{shape:{type:"image",x:0,y:0,width:t,height:l,src:e.url},fill:null,stroke:null}]}));i.push(t)}else{let e=u;"icon"===s.type&&h&&l&&(e=u*(o/h));const a="tall"===t?.symbolConfig||t?.symbolConfig?.isTall||"object"===s.type&&$(s);c=Math.max(c,a?C:e),p=Math.max(p,e),i.push(Promise.resolve(A(s,e,a)))}}));const m=await Promise.allSettled(i),f=[];return m.forEach((e=>{"fulfilled"===e.status?f.push(e.value):e.reason&&s.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.reason)})),L(f,[c,p],{node:t&&t.node,scale:!1,opacity:t&&t.opacity,ariaLabel:t?.ariaLabel})}function K(e,t){const l=e.symbolLayers,a=[],s=j(e),r=B(t),o=(t&&t.maxSize?n(t.maxSize):null)||U;let i,c=0,p=0;return l.forEach(((e,t)=>{if(!e)return;if("line"!==e.type&&"path"!==e.type)return;const l=[];switch(e.type){case"line":{const a=W(e,0);if(null==a)break;const s=a&&a.width||0;0===t&&(i=s);const n=Math.min(r||s,o),u=0===t?n:r?n*(s/i):n,h=u>O/2?2*u:O;p=Math.max(p,u),c=Math.max(c,h),a.width=u,l.push({shape:{type:"path",path:[{command:"M",values:[0,.5*p]},{command:"L",values:[c,.5*p]}]},stroke:a});break}case"path":{const t=Math.min(r||P,o),a=q(e,0),s=q(e,-.2),n=T(e,-.4),i=n?{color:n,width:1}:{};if("quad"===e.profile){const t=e.width,n=e.height,r=m(t&&n?t/n:1,0===n,0===t),o={...i,join:"bevel"};l.push({shape:r[0],fill:s,stroke:o},{shape:r[1],fill:s,stroke:o},{shape:r[2],fill:a,stroke:o})}else l.push({shape:f.pathSymbol3DLayer[0],fill:s,stroke:i},{shape:f.pathSymbol3DLayer[1],fill:a,stroke:i});p=Math.max(p,t),c=p}}a.push(l)})),Promise.resolve(L(a,[c,p],{node:t&&t.node,scale:s,opacity:t&&t.opacity,ariaLabel:t?.ariaLabel}))}async function Q(e,t){const l="mesh-3d"===e.type,a=e.symbolLayers,s=B(t),r=t&&t.maxSize?n(t.maxSize):null,o=s||P,i=[];let c=0,p=0,u=!1;for(let n=0;n<a.length;n++){const e=a.at(n),t=[];if(!l||"fill"===e.type){switch(e.type){case"fill":{const a=R(e),s=Math.min(o,r||D);c=Math.max(c,s),p=Math.max(p,s),u=!0;let n=q(e,0);const i="pattern"in e?e.pattern:null,h=Z(e);if(!l&&null!=i&&"style"===i.type&&"solid"!==i.style&&h&&(n=await H(i,h)),l){const l=f.meshSymbol3DFill;t.push({shape:l[0],fill:q(e,0)},{shape:l[1],fill:q(e,-.2)},{shape:l[2],fill:q(e,-.6)})}else t.push({shape:f.fill[0],fill:n,stroke:a});break}case"line":{const l=W(e,0);if(null==l)break;const a={stroke:l,shape:f.fill[0]};c=Math.max(c,P),p=Math.max(p,P),t.push(a);break}case"extrude":{const l={join:"round",width:1,...W(e,-.4)},a=q(e,0),s=q(e,-.2),n=Math.min(o,r||D),i=y(n);l.width=1,t.push({shape:i[0],fill:s,stroke:l},{shape:i[1],fill:s,stroke:l},{shape:i[2],fill:a,stroke:l});const u=P,h=.7*P+.5*n;c=Math.max(c,u),p=Math.max(p,h);break}case"water":{const l=Z(e),a=I(l),s=I(l,2),n=I(l,3),i=x();u=!0,t.push({shape:i[0],fill:a},{shape:i[1],fill:s},{shape:i[2],fill:n});const h=Math.min(o,r||D);c=Math.max(c,h),p=Math.max(p,h);break}}i.push(t)}}return L(i,[c,p],{node:t&&t.node,scale:u,opacity:t&&t.opacity,ariaLabel:t?.ariaLabel})}function V(e,t){if(0===e.symbolLayers.length)return Promise.reject(new a("symbolPreview: renderPreviewHTML3D","No symbolLayers in the symbol."));switch(e.type){case"point-3d":return J(e,t);case"line-3d":return K(e,t);case"polygon-3d":case"mesh-3d":return Q(e,t)}return Promise.reject(new a("symbolPreview: swatchInfo3D","symbol not supported."))}export{H as getPatternDescriptor,B as getSizeFromOptions,q as getSymbolLayerFill,V as previewSymbol3D};
5
+ import{getAssetUrl as e}from"../../assets.js";import{toHSV as t,toRGB as l}from"../../core/colorUtils.js";import"../../core/has.js";import a from"../../core/Error.js";import s from"../../core/Logger.js";import{pt2px as n}from"../../core/screenUtils.js";import{defaultThematicColor as r,getPatternUrlWithColor as o,dekebabifyLineStyle as i}from"./gfxUtils.js";import{defaultPrimitive as c}from"./IconSymbol3DLayerResource.js";import{defaultPrimitive as p}from"./ObjectSymbol3DLayerResource.js";import{SymbolSizeDefaults as u,adjustColorComponentBrightness as h,getPathSymbolShapes as m,shapes as f,getExtrudeSymbolShapes as y,getTetrahedronShapes as d,getDiamondShapes as b,getCylinderShapes as k,getCubeShapes as w,getInvertedConeShapes as v,getConeShapes as g,getWaterSymbolShapes as x}from"./previewUtils.js";import{tintImageWithColor as M,renderSymbol as L}from"./renderUtils.js";import{isVolumetricSymbol as j,getIconHref as z}from"./utils.js";import{resolveWebStyleSymbol as S}from"./webStyleSymbolUtils.js";const P=u.size,D=u.maxSize,U=u.maxOutlineSize,O=u.lineWidth,C=u.tallSymbolWidth;function R(e){const t=e.outline,l=null!=e.material?e.material.color:null,a=null!=l?l.toHex():null;if(null==t||"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type&&"none"===t.pattern.style)return"fill"===e.type&&"#ffffff"===a?{color:"#bdc3c7",width:.75}:null;const s=n(t.size)||0;return{color:"rgba("+(null!=t.color?t.color.toRgba():"255,255,255,1")+")",width:Math.min(s,U),style:"pattern"in t&&null!=t.pattern&&"style"===t.pattern.type?i(t.pattern.style):null,join:"butt",cap:"patternCap"in t?t.patternCap:"butt"}}async function E(t,l){if(t.thumbnail?.url)return t.thumbnail.url;if("icon"===l.type){const e=l?.resource?.href;if(e)return z(l)}const a=e("esri/images/Legend/legend3dsymboldefault.png");if(t.styleOrigin&&(t.styleOrigin.styleName||t.styleOrigin.styleUrl)){const e=await S(t.styleOrigin,{portal:t.styleOrigin.portal},"webRef").catch((()=>null));if(e&&"thumbnail"in e&&e.thumbnail?.url)return e.thumbnail.url}return a}function I(e,a=1){const s=e.a,n=t(e),r=n.h,o=n.s/a,i=100-(100-n.v)/a,{r:c,g:p,b:u}=l({h:r,s:o,v:i});return[c,p,u,s]}function Z(e){return"water"===e.type?null==e.color?null:e.color:null==e.material||null==e.material.color?null:e.material.color}function q(e,t=0){const l=Z(e);if(!l){if("fill"===e.type)return null;const l=r.r,a=h(l,t);return[a,a,a,100]}const a=l.toRgba();for(let s=0;s<3;s++)a[s]=h(a[s],t);return a}async function H(t,l){const a=t.style;if("none"===a)return null;return{type:"pattern",x:0,y:0,src:await o(e(`esri/symbols/patterns/${a}.png`),l.toCss(!0)),width:5,height:5}}function N(e){return e.outline?R(e):{color:"rgba(0, 0, 0, 1)",width:1.5}}function T(e,t){const l=Z(e);if(!l)return null;let a="rgba(";return a+=h(l.r,t)+",",a+=h(l.g,t)+",",a+=h(l.b,t)+",",a+l.a+");"}function W(e,t){const l=T(e,t);if(!l)return{};if("pattern"in e&&null!=e.pattern&&"style"===e.pattern.type&&"none"===e.pattern.style)return null;return{color:l,width:Math.min(e.size?n(e.size):.75,U),style:"pattern"in e&&null!=e.pattern&&"style"===e.pattern.type?i(e.pattern.style):null,cap:"cap"in e?e.cap:null,join:"join"in e?"miter"===e.join?n(2):e.join:null}}function F(e,t,l){const a=null!=l?.75*l:0;return{type:"linear",x1:a?.25*a:0,y1:a?.5*a:0,x2:a||4,y2:a?.5*a:4,colors:[{color:e,offset:0},{color:t,offset:1}]}}function $(e){const t=e.depth,l=e.height,a=e.width;return 0!==a&&0!==t&&0!==l&&a===t&&null!=a&&null!=l&&a<l}function A(e,t,l){const a=[];if(!e)return a;switch(e.type){case"icon":{const l=0,s=0,n=t,r=t;switch(e.resource&&e.resource.primitive||c){case"circle":a.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:q(e,0),stroke:R(e)});break;case"square":a.push({shape:{type:"path",path:[{command:"M",values:[l,r]},{command:"L",values:[l,s]},{command:"L",values:[n,s]},{command:"L",values:[n,r]},{command:"Z",values:[]}]},fill:q(e,0),stroke:R(e)});break;case"triangle":a.push({shape:{type:"path",path:[{command:"M",values:[l,r]},{command:"L",values:[.5*n,s]},{command:"L",values:[n,r]},{command:"Z",values:[]}]},fill:q(e,0),stroke:R(e)});break;case"cross":a.push({shape:{type:"path",path:[{command:"M",values:[.5*n,s]},{command:"L",values:[.5*n,r]},{command:"M",values:[l,.5*r]},{command:"L",values:[n,.5*r]}]},stroke:N(e)});break;case"x":a.push({shape:{type:"path",path:[{command:"M",values:[l,s]},{command:"L",values:[n,r]},{command:"M",values:[n,s]},{command:"L",values:[l,r]}]},stroke:N(e)});break;case"kite":a.push({shape:{type:"path",path:[{command:"M",values:[l,.5*r]},{command:"L",values:[.5*n,s]},{command:"L",values:[n,.5*r]},{command:"L",values:[.5*n,r]},{command:"Z",values:[]}]},fill:q(e,0),stroke:R(e)})}break}case"object":switch(e.resource&&e.resource.primitive||p){case"cone":{const s=F(q(e,0),q(e,-.6),l?C:t),n=g(t,l);a.push({shape:n[0],fill:s},{shape:n[1],fill:s});break}case"inverted-cone":{const l=q(e,0),s=F(l,q(e,-.6),t),n=v(t);a.push({shape:n[0],fill:s},{shape:n[1],fill:l});break}case"cube":{const s=w(t,l);a.push({shape:s[0],fill:q(e,0)},{shape:s[1],fill:q(e,-.3)},{shape:s[2],fill:q(e,-.5)});break}case"cylinder":{const s=F(q(e,0),q(e,-.6),l?C:t),n=k(t,l);a.push({shape:n[0],fill:s},{shape:n[1],fill:s},{shape:n[2],fill:q(e,0)});break}case"diamond":{const l=b(t);a.push({shape:l[0],fill:q(e,-.3)},{shape:l[1],fill:q(e,0)},{shape:l[2],fill:q(e,-.3)},{shape:l[3],fill:q(e,-.7)});break}case"sphere":{const l=F(q(e,0),q(e,-.6));l.x1=0,l.y1=0,l.x2=.25*t,l.y2=.25*t,a.push({shape:{type:"circle",cx:0,cy:0,r:.5*t},fill:l});break}case"tetrahedron":{const l=d(t);a.push({shape:l[0],fill:q(e,-.3)},{shape:l[1],fill:q(e,0)},{shape:l[2],fill:q(e,-.6)});break}}break}return a}function B(e){const t="number"==typeof e?.size?e?.size:null;return t?n(t):null}function G(e){return"icon"===e.type?"multiply":"tint"}async function J(e,t){const l=B(t),a=t?.maxSize?n(t.maxSize):null,r=t?.disableUpsampling??!1,o=e.symbolLayers,i=[];let c=0,p=0;const u=o.at(-1);let h;u&&"icon"===u.type&&(h=u.size&&n(u.size)),o.forEach((s=>{if("icon"!==s.type&&"object"!==s.type)return;const o="icon"===s.type?s.size&&n(s.size):0,u=l||o?Math.ceil(Math.min(l||o,a||D)):P;if(s&&s.resource&&s.resource.href){const t=E(e,s).then((e=>{const t=s?.material?.color,l=G(s);return M(e,u,t,l,r)})).then((e=>{const t=e.width,l=e.height;return c=Math.max(c,t),p=Math.max(p,l),[{shape:{type:"image",x:0,y:0,width:t,height:l,src:e.url},fill:null,stroke:null}]}));i.push(t)}else{let e=u;"icon"===s.type&&h&&l&&(e=u*(o/h));const a="tall"===t?.symbolConfig||t?.symbolConfig?.isTall||"object"===s.type&&$(s);c=Math.max(c,a?C:e),p=Math.max(p,e),i.push(Promise.resolve(A(s,e,a)))}}));const m=await Promise.allSettled(i),f=[];return m.forEach((e=>{"fulfilled"===e.status?f.push(e.value):e.reason&&s.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.reason)})),L(f,[c,p],{node:t&&t.node,scale:!1,opacity:t&&t.opacity,ariaLabel:t?.ariaLabel})}function K(e,t){const l=e.symbolLayers,a=[],s=j(e),r=B(t),o=(t&&t.maxSize?n(t.maxSize):null)||U;let i,c=0,p=0;return l.forEach(((e,t)=>{if(!e)return;if("line"!==e.type&&"path"!==e.type)return;const l=[];switch(e.type){case"line":{const a=W(e,0);if(null==a)break;const s=a&&a.width||0;0===t&&(i=s);const n=Math.min(r||s,o),u=0===t?n:r?n*(s/i):n,h=u>O/2?2*u:O;p=Math.max(p,u),c=Math.max(c,h),a.width=u,l.push({shape:{type:"path",path:[{command:"M",values:[0,.5*p]},{command:"L",values:[c,.5*p]}]},stroke:a});break}case"path":{const t=Math.min(r||P,o),a=q(e,0),s=q(e,-.2),n=T(e,-.4),i=n?{color:n,width:1}:{};if("quad"===e.profile){const t=e.width,n=e.height,r=m(t&&n?t/n:1,0===n,0===t),o={...i,join:"bevel"};l.push({shape:r[0],fill:s,stroke:o},{shape:r[1],fill:s,stroke:o},{shape:r[2],fill:a,stroke:o})}else l.push({shape:f.pathSymbol3DLayer[0],fill:s,stroke:i},{shape:f.pathSymbol3DLayer[1],fill:a,stroke:i});p=Math.max(p,t),c=p}}a.push(l)})),Promise.resolve(L(a,[c,p],{node:t&&t.node,scale:s,opacity:t&&t.opacity,ariaLabel:t?.ariaLabel}))}async function Q(e,t){const l="mesh-3d"===e.type,a=e.symbolLayers,s=B(t),r=t&&t.maxSize?n(t.maxSize):null,o=s||P,i=[];let c=0,p=0,u=!1;for(let n=0;n<a.length;n++){const e=a.at(n),t=[];if(!l||"fill"===e.type){switch(e.type){case"fill":{const a=Math.min(o,r||D);if(c=Math.max(c,a),p=Math.max(p,a),u=!0,l){const l=f.meshSymbol3DFill,a=T(e,-.4),s=a?{color:a,width:1,join:"round"}:{};t.push({shape:l[0],fill:q(e,0),stroke:s},{shape:l[1],fill:q(e,-.2),stroke:s},{shape:l[2],fill:q(e,-.6),stroke:s})}else{let l=q(e,0);const a="pattern"in e?e.pattern:null,s=R(e),n=Z(e);null!=a&&"style"===a.type&&"solid"!==a.style&&n&&(l=await H(a,n)),t.push({shape:f.fill[0],fill:l,stroke:s})}break}case"line":{const l=W(e,0);if(null==l)break;const a={stroke:l,shape:f.fill[0]};c=Math.max(c,P),p=Math.max(p,P),t.push(a);break}case"extrude":{const l={join:"round",width:1,...W(e,-.4)},a=q(e,0),s=q(e,-.2),n=Math.min(o,r||D),i=y(n);l.width=1,t.push({shape:i[0],fill:s,stroke:l},{shape:i[1],fill:s,stroke:l},{shape:i[2],fill:a,stroke:l});const u=P,h=.7*P+.5*n;c=Math.max(c,u),p=Math.max(p,h);break}case"water":{const l=Z(e),a=I(l),s=I(l,2),n=I(l,3),i=x();u=!0,t.push({shape:i[0],fill:a},{shape:i[1],fill:s},{shape:i[2],fill:n});const h=Math.min(o,r||D);c=Math.max(c,h),p=Math.max(p,h);break}}i.push(t)}}return L(i,[c,p],{node:t&&t.node,scale:u,opacity:t&&t.opacity,ariaLabel:t?.ariaLabel})}function V(e,t){if(0===e.symbolLayers.length)return Promise.reject(new a("symbolPreview: renderPreviewHTML3D","No symbolLayers in the symbol."));switch(e.type){case"point-3d":return J(e,t);case"line-3d":return K(e,t);case"polygon-3d":case"mesh-3d":return Q(e,t)}return Promise.reject(new a("symbolPreview: swatchInfo3D","symbol not supported."))}export{H as getPatternDescriptor,B as getSizeFromOptions,q as getSymbolLayerFill,V as previewSymbol3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{clock as t}from"../../../../core/clock.js";import{destroyHandle as i,makeHandle as o}from"../../../../core/handleUtils.js";import{removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as r,when as a}from"../../../../core/reactiveUtils.js";import{property as l}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{sv3d as u}from"../../../../geometry/support/vectorStacks.js";import{DidPointerMoveRecentlyFlag as p}from"./lengthDimensionManipulatorUtils.js";import{LengthDimensionSubTool as m}from"./LengthDimensionSubTool.js";import{pointerMoveTimeoutMs as h}from"./settings.js";import{newIntersector as d}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as _}from"../../../interactive/AnalysisToolBase.js";import{SKETCH_KEYS as y}from"../../../interactive/keybindings.js";import{createScreenPointArrayFromEvent as T}from"../../../support/screenUtils.js";var g;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(g||(g={}));let S=class extends _{constructor(e){super(e),this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this._pointerMoveTimerMs=h,this._prevPointerMoveTimeout=null}initialize(){this._intersector=d(this.view.state.viewingMode),this._intersector.options.store=v.MIN,this._lengthDimensionSubTool=new m({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,parentTool:this,view:this.view}),this.addHandles([i(this._lengthDimensionSubTool),o((()=>this._clearPointerMoveTimeout())),n((()=>this.state),(e=>{e===g.Created&&this.finishToolCreation()}),r),a((()=>this.firstGrabbedManipulator),(e=>{this.selectedDimension=e.metadata}),r),n((()=>this.selectedDimension),(()=>this._resetPointerMoveTimeout()),r)])}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?null!=this._activeSubTool?g.Creating:g.Created:g.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":if(y.cancel===e.key){if(null!=this._activeSubTool&&this._activeSubTool.removeStaged())return void e.stopPropagation();this.active||(this.selectedDimension=null)}else y.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){null!=this._activeSubTool&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onShow(){this._resetPointerMoveTimeout()}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(this.hasFocusedManipulators)return void e.stopPropagation();if(null==this._activeSubTool)return;const t=this._intersectScreen(e);null!=t&&(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(this._resetPointerMoveTimeout(),null==this._activeSubTool)return;if(this.hasFocusedManipulators)return;const t=this._intersectScreen(e);null!=t&&this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){null!=this._activeSubTool&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=T(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=u.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,this.view.spatialReference):null}_removeSelected(){null!=this.selectedDimension&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.manipulators.forEach((e=>{e.manipulator.state|=p})),this._prevPointerMoveTimeout=t.setTimeout((()=>{this.manipulators.forEach((e=>{e.manipulator.state&=~p}))}),this._pointerMoveTimerMs)}get testInfo(){return{...this._lengthDimensionSubTool.testInfo,setManipulatorAutoHideDelay:e=>{this._pointerMoveTimerMs=e,this._resetPointerMoveTimeout()}}}};e([l({constructOnly:!0})],S.prototype,"view",void 0),e([l({constructOnly:!0})],S.prototype,"analysis",void 0),e([l({readOnly:!0})],S.prototype,"state",null),e([l({readOnly:!0})],S.prototype,"updating",null),e([l({readOnly:!0})],S.prototype,"cursor",null),e([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([l()],S.prototype,"selectedDimension",null),e([l()],S.prototype,"automaticManipulatorSelection",void 0),e([l()],S.prototype,"_activeSubTool",void 0),e([l()],S.prototype,"_lengthDimensionSubTool",void 0),S=e([c("esri.views.3d.analysis.Dimension.DimensionTool")],S);export{S as DimensionTool};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{clock as t}from"../../../../core/clock.js";import{destroyHandle as i,makeHandle as o}from"../../../../core/handleUtils.js";import{removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as r,when as a}from"../../../../core/reactiveUtils.js";import{property as l}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{sv3d as u}from"../../../../geometry/support/vectorStacks.js";import{DidPointerMoveRecentlyFlag as p}from"./lengthDimensionManipulatorUtils.js";import{LengthDimensionSubTool as m}from"./LengthDimensionSubTool.js";import{pointerMoveTimeoutMs as h}from"./settings.js";import{newIntersector as d}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as _}from"../../../interactive/AnalysisToolBase.js";import{SKETCH_KEYS as y}from"../../../interactive/keybindings.js";import{createScreenPointArrayFromEvent as T}from"../../../support/screenUtils.js";var g;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(g||(g={}));let S=class extends _{constructor(e){super(e),this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this._pointerMoveTimerMs=h,this._prevPointerMoveTimeout=null}initialize(){this._intersector=d(this.view.state.viewingMode),this._intersector.options.store=v.MIN,this._lengthDimensionSubTool=new m({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,parentTool:this,view:this.view}),this.addHandles([i(this._lengthDimensionSubTool),o((()=>this._clearPointerMoveTimeout())),n((()=>this.state),(e=>{e===g.Created&&this.finishToolCreation()}),r),a((()=>this.firstGrabbedManipulator),(e=>{this.selectedDimension=e.metadata}),r),n((()=>this.selectedDimension),(()=>this._resetPointerMoveTimeout()),r)])}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?null!=this._activeSubTool?g.Creating:g.Created:g.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":if(y.cancel===e.key){if(null!=this._activeSubTool&&this._activeSubTool.removeStaged())return void e.stopPropagation();this.active||(this.selectedDimension=null)}else y.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){null!=this._activeSubTool&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onShow(){this._resetPointerMoveTimeout()}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(this.hasFocusedManipulators)return void e.stopPropagation();if(null==this._activeSubTool)return;const t=this._intersectScreen(e);null!=t&&(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(this._resetPointerMoveTimeout(),null==this._activeSubTool)return;if(this.hasFocusedManipulators)return;const t=this._intersectScreen(e);null!=t&&this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){null!=this._activeSubTool&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=T(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=u.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,this.view.spatialReference):null}_removeSelected(){null!=this.selectedDimension&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.manipulators.forEach((e=>e.manipulator.state|=p)),this._prevPointerMoveTimeout=t.setTimeout((()=>{this.manipulators.forEach((e=>e.manipulator.state&=~p))}),this._pointerMoveTimerMs)}get testInfo(){return{...this._lengthDimensionSubTool.testInfo,setManipulatorAutoHideDelay:e=>{this._pointerMoveTimerMs=e,this._resetPointerMoveTimeout()}}}};e([l({constructOnly:!0})],S.prototype,"view",void 0),e([l({constructOnly:!0})],S.prototype,"analysis",void 0),e([l({readOnly:!0})],S.prototype,"state",null),e([l({readOnly:!0})],S.prototype,"updating",null),e([l({readOnly:!0})],S.prototype,"cursor",null),e([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([l()],S.prototype,"selectedDimension",null),e([l()],S.prototype,"automaticManipulatorSelection",void 0),e([l()],S.prototype,"_activeSubTool",void 0),e([l()],S.prototype,"_lengthDimensionSubTool",void 0),S=e([c("esri.views.3d.analysis.Dimension.DimensionTool")],S);export{S as DimensionTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import n from"../../../../analysis/LengthDimension.js";import a from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{equals as r}from"../../../../core/lang.js";import{destroyMaybe as p}from"../../../../core/maybe.js";import{memoize as l}from"../../../../core/memoize.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{mapCollection as d,watch as c,sync as m,syncAndInitial as h,initial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,LengthDimensionConstraint as w,applyConstraint as b,computeConstraint as D,constraintDependencies as O}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as P,createPointManipulator as j,pointManipulatorHandles as H,createOffsetManipulator as T,offsetManipulatorHandles as G,createOrientationManipulator as I,headingManipulatorHandles as z,rotationManipulatorHandles as x,createMeasureTypeManipulator as U,measureTypeManipulatorHandles as V,updateOffsetManipulatorTransform as R,updateHeadingManipulatorTransform as A,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as E,updateOrientationManipulator as F,unfocusedOffsetWidth as L,focusedOffsetWidth as q}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as B,arePointsVerticallyAligned as N,computeGeometryFromDimension as J,computationToGeometryDependencies as K}from"./lengthDimensionUtils.js";import{Settings as Q}from"./settings.js";import{getRotateHeadingTexture as W}from"../Slice/images/Factory.js";import{SnappingVisualizer3D as X}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as Z}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as $}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as tt}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as et}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as it}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as nt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as at}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as st}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as ot}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as rt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as pt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as lt}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as ut}from"../../../interactive/snapping/snappingUtils.js";import dt from"../../../../geometry/Point.js";let ct=class extends a{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._updatingHandles=new v,this._getSnappingContext=l((t=>new rt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new st(new at("point",nt(!0,!1,this.view.spatialReference))),visualizer:new X})));const{view:i}=t;this._settings=new Q(i.effectiveTheme),this._snappingManagerResult=ot(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:et(2)}),this._constraintSnappingIndicator=new Y({view:i,attached:!0,width:1,color:e.toUnitRGBA(this._settings.constraint.color),renderOccluded:$.OccludeAndTransparent,stipplePattern:et(5),isDecoration:!0});const n=e.toUnitRGBA(this._settings.disabledPointIndicator.color);this._stagedStartIndicator=new Z({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:n,size:2*this._settings.disabledPointIndicator.radius,outlineSize:0,renderOccluded:$.OccludeAndTransparent,isDecoration:!0})}initialize(){this._snappingOperation=new lt({view:this.view});const{color:t,contrastColor:e}=this._settings.orientationManipulator,i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorTexture=W(this.view.toolViewManager.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i}),this._orientationManipulatorMaterial=new tt({transparent:!0,writeDepth:!1,textureId:this._orientationManipulatorTexture.texture.id,renderOccluded:$.Opaque,isDecoration:!0});const n=d((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(n)),this.addHandles([c((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=S(t,new dt);this._applyPointUpdate(e,{endPoint:i})}),m),c((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:n,firstGrabbedManipulator:a}=t;if(i===e?.stagedDimension&&a===e?.firstGrabbedManipulator){for(const s of[n,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),h),c((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),g),c((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),c((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),ut(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(u(this._snappingOperation.resnap(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",n=this._computeConstraint(t);C(t,i,{constraint:n,view:this.view})}}}))}destroy(){this._snappingOperation=p(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...h,equals:r}),c((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:n,computation:a}=t;switch(a.previousConstraint){case w.Horizontal:a.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case w.Vertical:a.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case w.Direct:a.preConstraintProperties={measureType:i.Direct,orientation:n};break;default:a.preConstraintProperties={measureType:e,orientation:n}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),m)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[c((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const n=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)n.attached=!0;else{const{start:e,end:a}=this._computationManipulators.get(i),s=()=>{n.attached=e.grabbing||a.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),a.events.on("grab-changed",s)],t)}else n.attached=!1})),c((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==w.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(u(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const s=new n({startPoint:S(a,new dt),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const a=S(n,new dt);this._applyPointUpdate(i,{endPoint:a}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),n=this._setupPointManipulator(t,{isStart:!1}),a=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new P({start:e,end:n,offset:a,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([c((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...h,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:n}=t,a=j(i,{metadata:n}),s=H(a,{isStart:e.isStart,createSnappingPipelineStep:t=>pt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:n,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),a}_setupOffsetManipulator(t){const{view:e}=this,i=T(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),n=G(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=I(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),n=z(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupRotationManipulator(t){const{view:e}=this,i=I(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),n=x(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,n=U(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),a=V(n,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(a,t),n}_updateManipulators(t,e,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:a,selectedComputation:s,firstGrabbedManipulator:o}=n,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=B(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==a&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);N(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;R(l,g,f),u.available&&A(u,t,f),d.available&&k(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&E(e,t,i,f)}))}_updateManipulatorStyle(t){const e=L(t),i=q(t),n={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:a,heading:s,rotation:o}of this._computationManipulators.values())a.radius=i/2,F(this.view,s,n),F(this.view,o,n);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,n=K(t);"startPoint"in e&&(n.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(n.elevationAlignedEndPoint=e.endPoint);const a=J(n,i.renderCoordsHelper);if(null==a)return;const s=this._computeConstraint({...n,geometry:a});b(t,e,{...n,constraint:s,unconstrainedGeometry:a,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,mt);const e=this.view.state.camera.computeRenderPixelSizeAt(mt);t.dimension.offset=this._settings.initialOffsetPx*e}_computeConstraint(t){return D(O(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){const{color:t}=this._settings.offsetManipulator;return new it({color:e.toUnitRGBA(t),width:1,renderOccluded:$.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const t=t=>this.analysisViewData.computations.find((({computation:e})=>e.dimension===t))?.computation;return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=$.Occlude,this.manipulators.forEach((({manipulator:t})=>{for(const{geometry:e}of t.renderObjects)e.material.setParameters({renderOccluded:$.Occlude})}))},getManipulatorsForDimension:e=>this._computationManipulators.get(t(e)),getComputationForDimension:e=>t(e),getConstraintForDimension:e=>{const i=t(e);return null!=i?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};t([_({constructOnly:!0})],ct.prototype,"analysis",void 0),t([_({constructOnly:!0})],ct.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],ct.prototype,"manipulators",void 0),t([_({constructOnly:!0})],ct.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],ct.prototype,"view",void 0),t([_({readOnly:!0})],ct.prototype,"updating",null),t([_()],ct.prototype,"firstGrabbedManipulator",null),t([_()],ct.prototype,"hasGrabbedManipulators",null),t([_()],ct.prototype,"snappingOptions",null),t([_()],ct.prototype,"_stagedDimension",void 0),t([_()],ct.prototype,"_activeComputation",null),t([_()],ct.prototype,"_stagedComputation",null),ct=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ct);const mt=y();export{ct as LengthDimensionSubTool};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import n from"../../../../analysis/LengthDimension.js";import a from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{equals as r}from"../../../../core/lang.js";import{destroyMaybe as p}from"../../../../core/maybe.js";import{memoize as l}from"../../../../core/memoize.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{mapCollection as d,watch as c,sync as m,syncAndInitial as h,initial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,LengthDimensionConstraint as w,applyConstraint as b,computeConstraint as D,constraintDependencies as O}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as P,createPointManipulator as j,pointManipulatorHandles as H,createOffsetManipulator as T,offsetManipulatorHandles as G,createOrientationManipulator as I,headingManipulatorHandles as z,rotationManipulatorHandles as x,createMeasureTypeManipulator as U,measureTypeManipulatorHandles as V,updateOffsetManipulatorTransform as R,updateHeadingManipulatorTransform as A,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as E,updateOrientationManipulator as F,unfocusedOffsetWidth as L,focusedOffsetWidth as q}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as B,arePointsVerticallyAligned as N,computeGeometryFromDimension as J,computationToGeometryDependencies as K}from"./lengthDimensionUtils.js";import{Settings as Q}from"./settings.js";import{getRotateHeadingTexture as W}from"../images/Factory.js";import{SnappingVisualizer3D as X}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as Z}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as $}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as tt}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as et}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as it}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as nt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as at}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as st}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as ot}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as rt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as pt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as lt}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as ut}from"../../../interactive/snapping/snappingUtils.js";import dt from"../../../../geometry/Point.js";let ct=class extends a{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._updatingHandles=new v,this._getSnappingContext=l((t=>new rt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new st(new at("point",nt(!0,!1,this.view.spatialReference))),visualizer:new X})));const{view:i}=t;this._settings=new Q(i.effectiveTheme),this._snappingManagerResult=ot(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:et(2)}),this._constraintSnappingIndicator=new Y({view:i,attached:!0,width:1,color:e.toUnitRGBA(this._settings.constraint.color),renderOccluded:$.OccludeAndTransparent,stipplePattern:et(5),isDecoration:!0});const n=e.toUnitRGBA(this._settings.disabledPointIndicator.color);this._stagedStartIndicator=new Z({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:n,size:2*this._settings.disabledPointIndicator.radius,outlineSize:0,renderOccluded:$.OccludeAndTransparent,isDecoration:!0})}initialize(){this._snappingOperation=new lt({view:this.view});const{color:t,contrastColor:e}=this._settings.orientationManipulator,i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorTexture=W(this.view.toolViewManager.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i}),this._orientationManipulatorMaterial=new tt({transparent:!0,writeDepth:!1,textureId:this._orientationManipulatorTexture.texture.id,renderOccluded:$.Opaque,isDecoration:!0});const n=d((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(n)),this.addHandles([c((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=S(t,new dt);this._applyPointUpdate(e,{endPoint:i})}),m),c((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:n,firstGrabbedManipulator:a}=t;if(i===e?.stagedDimension&&a===e?.firstGrabbedManipulator){for(const s of[n,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),h),c((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),g),c((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),c((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),ut(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(u(this._snappingOperation.resnap(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",n=this._computeConstraint(t);C(t,i,{constraint:n,view:this.view})}}}))}destroy(){this._snappingOperation=p(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...h,equals:r}),c((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:n,computation:a}=t;switch(a.previousConstraint){case w.Horizontal:a.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case w.Vertical:a.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case w.Direct:a.preConstraintProperties={measureType:i.Direct,orientation:n};break;default:a.preConstraintProperties={measureType:e,orientation:n}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),m)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[c((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const n=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)n.attached=!0;else{const{start:e,end:a}=this._computationManipulators.get(i),s=()=>{n.attached=e.grabbing||a.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),a.events.on("grab-changed",s)],t)}else n.attached=!1})),c((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==w.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(u(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const s=new n({startPoint:S(a,new dt),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const a=S(n,new dt);this._applyPointUpdate(i,{endPoint:a}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),n=this._setupPointManipulator(t,{isStart:!1}),a=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new P({start:e,end:n,offset:a,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([c((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...h,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:n}=t,a=j(i,{metadata:n}),s=H(a,{isStart:e.isStart,createSnappingPipelineStep:t=>pt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:n,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),a}_setupOffsetManipulator(t){const{view:e}=this,i=T(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),n=G(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=I(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),n=z(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupRotationManipulator(t){const{view:e}=this,i=I(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),n=x(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,n=U(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),a=V(n,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(a,t),n}_updateManipulators(t,e,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:a,selectedComputation:s,firstGrabbedManipulator:o}=n,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=B(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==a&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);N(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;R(l,g,f),u.available&&A(u,t,f),d.available&&k(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&E(e,t,i,f)}))}_updateManipulatorStyle(t){const e=L(t),i=q(t),n={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:a,heading:s,rotation:o}of this._computationManipulators.values())a.radius=i/2,F(this.view,s,n),F(this.view,o,n);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,n=K(t);"startPoint"in e&&(n.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(n.elevationAlignedEndPoint=e.endPoint);const a=J(n,i.renderCoordsHelper);if(null==a)return;const s=this._computeConstraint({...n,geometry:a});b(t,e,{...n,constraint:s,unconstrainedGeometry:a,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,mt);const e=this.view.state.camera.computeRenderPixelSizeAt(mt);t.dimension.offset=this._settings.initialOffsetPx*e}_computeConstraint(t){return D(O(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){const{color:t}=this._settings.offsetManipulator;return new it({color:e.toUnitRGBA(t),width:1,renderOccluded:$.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const t=t=>this.analysisViewData.computations.find((({computation:e})=>e.dimension===t))?.computation;return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=$.Occlude,this.manipulators.forEach((({manipulator:t})=>{for(const{geometry:e}of t.renderObjects)e.material.setParameters({renderOccluded:$.Occlude})}))},getManipulatorsForDimension:e=>this._computationManipulators.get(t(e)),getComputationForDimension:e=>t(e),getConstraintForDimension:e=>{const i=t(e);return null!=i?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};t([_({constructOnly:!0})],ct.prototype,"analysis",void 0),t([_({constructOnly:!0})],ct.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],ct.prototype,"manipulators",void 0),t([_({constructOnly:!0})],ct.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],ct.prototype,"view",void 0),t([_({readOnly:!0})],ct.prototype,"updating",null),t([_()],ct.prototype,"firstGrabbedManipulator",null),t([_()],ct.prototype,"hasGrabbedManipulators",null),t([_()],ct.prototype,"snappingOptions",null),t([_()],ct.prototype,"_stagedDimension",void 0),t([_()],ct.prototype,"_activeComputation",null),t([_()],ct.prototype,"_stagedComputation",null),ct=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ct);const mt=y();export{ct as LengthDimensionSubTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../analysis/SlicePlane.js";import{clock as a}from"../../../../core/clock.js";import{releaseMaybe as s,destroyMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{watch as l,sync as o,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as c,createScreenPointArray as d}from"../../../../core/screenUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as P,E as y,m}from"../../../../chunks/mat4.js";import{d as g,l as w,i as f,b as M,e as T,m as D,n as V,s as b}from"../../../../chunks/vec3.js";import{a as k,c as E}from"../../../../chunks/vec3f64.js";import{Z as S}from"../../../../chunks/vec4f64.js";import{a as H,c as x,n as R,f as I}from"../../../../chunks/boundedPlane.js";import{signedDistance as C,create as j,intersectRay as O,normal as z}from"../../../../geometry/support/plane.js";import{create as G}from"../../../../geometry/support/ray.js";import{sv3d as U,sm4d as A,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{Settings as B}from"./settings.js";import{POINTER_MOVE_TIMER_MS as K,PLANE_PREVIEW_OUTLINE_WIDTH as F,forceVerticalModifier as N,forceHorizontalModifier as Z,PREVIEW_FADE_DOT_THRESHOLD as q,PREVIEW_FADE_DURATION_SECONDS as W,INITIAL_DEPTH_OFFSET_FRAC as J}from"./sliceToolConfig.js";import{createShiftManipulator as Q,OffsetMode as X,createRotateManipulator as Y,createResizeManipulator as $,createGridVisualElement as tt,createOutlineVisualElement as et,planeToShape as it,createRotatePlane as at,RotationAxis as st,resizePlane as nt,calculatePlaneHalfSize as rt,SliceOrientation as lt,createPlane as ot,DidPointerMoveRecentlyFlag as ht,calculateBoundedPlaneTranslateRotate as pt,updateShiftRestartHandle as ut,updateRotateHeadingHandle as ct,updateRotateTiltHandle as dt,updateResizeHandle as _t,createShiftPlane as vt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as Pt,getTiltRotateTexture as yt}from"./images/Factory.js";import{calculateInputRotationTransform as mt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as gt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as wt}from"../../support/geometryUtils/ray.js";import{newIntersector as ft}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as Mt}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as Tt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Dt}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as Vt}from"../../../support/screenUtils.js";var bt;let kt=bt=class extends Tt{constructor(t){super(t),this._clock=a,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=K,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=H(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=ft(t.view.state.viewingMode),this._intersector.options.store=Mt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this._settings=new B(this.view.effectiveTheme);const t=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,e={accentColor:this._settings.rotateManipulators.color,contrastColor:this._settings.rotateManipulators.contrastColor,preMultiplyAlpha:t};this._rotateHeadingImage=Pt(this.view.toolViewManager.textures,e),this._rotateTiltImage=yt(this.view.toolViewManager.textures,e);const i=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Q(this.view,{offsetMode:X.CENTER_ON_ARROW,calloutColor:this._settings.callouts.color,color:this._settings.shiftManipulator.color,outlineColor:this._settings.shiftManipulator.outlineColor}),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(t=>{this._onShiftGrab(t),i(this.shiftManipulator)})),this.addHandles(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=Y(this.view,this._rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(t=>{this._onRotateHeadingGrab(t),i(this.rotateHeadingManipulator)})),this.addHandles(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=Y(this.view,this._rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(t=>{this._onRotateTiltGrab(t),i(this.rotateTiltManipulator)})),this.addHandles(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((t,e)=>{const a=$(this.view,t,{color:this._settings.resizeManipulators.color});return a.events.on("grab-changed",(t=>{this._onResizeGrab(t,e),i(a)})),this.addHandles(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=tt(this.view),this._previewPlaneOutlineVisualElement=et(this.view),this._previewPlaneOutlineVisualElement.width=F,this.addHandles(l((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),o));const a=l((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),h);this.addHandles([a,l((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._rotateHeadingImage=s(this._rotateHeadingImage),this._rotateTiltImage=s(this._rotateTiltImage),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!St(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!St(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!St(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Vt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Vt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Vt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const e=Vt(t),a=H();if(this._pickPlane(e,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const i=this._calculatePickRay(e);this.inputState=Et(i,t.pointerId,a.origin,a)}return x(a,this._startPlane),this.analysis.shape=it(a,this.view,this.view.spatialReference,new i),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Vt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===N||t.key===Z)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==N&&t.key!==Z||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=this._calculatePickRay(t.screenPoint);x(this.analysisViewData.plane,this._startPlane),this.inputState=Et(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(g(R(this.analysisViewData.plane),e.ray.direction)/w(e.ray.direction)))/i,1),s=-C(this._startPlane.plane,e.renderEnd),n=-C(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=f(U.get(),this._startPlane.origin),i=f(U.get(),R(this._startPlane));M(i,i,-t.depth),T(i,i,e);const a=I(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,H());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=at(this.analysisViewData.plane,this.view.renderCoordsHelper,st.HEADING,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=at(this.analysisViewData.plane,this.view.renderCoordsHelper,st.TILT,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=z(t.rotatePlane),a=mt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=P(A.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=D(U.get(),this._startPlane.basis1,e),a=D(U.get(),this._startPlane.basis2,e),s=I(this.analysisViewData.plane.origin,i,a,H());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=this._calculatePickRay(t.screenPoint),a=U.get();O(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:k(a)})}_createResizeDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=x(this.analysisViewData.plane,H());e.next(gt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=nt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:H();if(i=null!=i?x(i,Ht):null,this._pickPlane(t,!0,e,a)){const t=q;let e=!1;null!=i&&(e=g(i.plane,a.plane)<t||g(V(U.get(),i.basis1),V(U.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=p({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*W),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=r(this._frameTask)}_calculatePickRay(t){const e=G(),i=c(t,xt);return wt(this.view.state.camera,i,e),V(e.direction,e.direction),e}_pickMinResult(t){const e=c(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=U.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(U.get()),l=this.view.state.camera;g(r,l.viewForward)>0&&M(r,r,-1);const o=rt(n,l),h=(e?1:-1)*o*J,p=M(U.get(),r,h);T(p,p,n);const u=this.analysis.tiltEnabled?lt.TILTED:lt.HORIZONTAL_OR_VERTICAL,c=i[N]?lt.VERTICAL:i[Z]?lt.HORIZONTAL:u;return ot(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=r(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ht,this.rotateHeadingManipulator.state|=ht,this.rotateTiltManipulator.state|=ht,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ht,this.rotateHeadingManipulator.state&=~ht,this.rotateTiltManipulator.state&=~ht}),this._pointerMoveTimerMs)}_updateManipulators(){if(bt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=pt(t,A.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ut(this.shiftManipulator,i,t,this.view.state.camera),ct(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),dt(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>_t(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=b(U.get(),w(t.basis1),w(t.basis2),1),s=y(A.get(),a),n=m(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=e.toUnitRGBA(this._settings.plane.outlineColor);t[3]*=this._previewPlaneOpacity;const i=e.toUnitRGBA(this._settings.plane.color);i[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=i,this._previewPlaneGridVisualElement.gridColor=S}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Et(t,e,i,a){const s=vt(i,R(a),t.direction,j()),n=E();return O(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function St(t){return"mouse"!==t.pointerType||0===t.button}kt.disableEngineLayers=!1,t([_()],kt.prototype,"_clock",void 0),t([_({constructOnly:!0})],kt.prototype,"view",void 0),t([_()],kt.prototype,"analysisViewData",void 0),t([_({readOnly:!0})],kt.prototype,"state",null),t([_({readOnly:!0})],kt.prototype,"cursor",null),t([_()],kt.prototype,"analysis",null),t([_()],kt.prototype,"removeIncompleteOnCancel",void 0),t([_({readOnly:!0})],kt.prototype,"layersMode",void 0),t([_({value:null})],kt.prototype,"inputState",null),t([_()],kt.prototype,"_isPlacingSlicePlane",null),t([_()],kt.prototype,"_creatingPointerId",null),kt=bt=t([v("esri.views.3d.analysis.Slice.SliceTool")],kt);const Ht=H(),xt=d(),Rt=kt;export{Rt as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../analysis/SlicePlane.js";import{clock as a}from"../../../../core/clock.js";import{releaseMaybe as s,destroyMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{watch as l,sync as o,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as c,createScreenPointArray as d}from"../../../../core/screenUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as P,E as y,m}from"../../../../chunks/mat4.js";import{d as g,l as w,i as f,b as M,e as T,m as D,n as V,s as b}from"../../../../chunks/vec3.js";import{a as k,c as E}from"../../../../chunks/vec3f64.js";import{Z as S}from"../../../../chunks/vec4f64.js";import{a as H,c as x,n as R,f as I}from"../../../../chunks/boundedPlane.js";import{signedDistance as C,create as j,intersectRay as O,normal as z}from"../../../../geometry/support/plane.js";import{create as G}from"../../../../geometry/support/ray.js";import{sv3d as U,sm4d as A,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as B,getTiltRotateTexture as K}from"../images/Factory.js";import{Settings as F}from"./settings.js";import{POINTER_MOVE_TIMER_MS as N,PLANE_PREVIEW_OUTLINE_WIDTH as Z,forceVerticalModifier as q,forceHorizontalModifier as W,PREVIEW_FADE_DOT_THRESHOLD as J,PREVIEW_FADE_DURATION_SECONDS as Q,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,OffsetMode as $,createRotateManipulator as tt,createResizeManipulator as et,createGridVisualElement as it,createOutlineVisualElement as at,planeToShape as st,createRotatePlane as nt,RotationAxis as rt,resizePlane as lt,calculatePlaneHalfSize as ot,SliceOrientation as ht,createPlane as pt,DidPointerMoveRecentlyFlag as ut,calculateBoundedPlaneTranslateRotate as ct,updateShiftRestartHandle as dt,updateRotateHeadingHandle as _t,updateRotateTiltHandle as vt,updateResizeHandle as Pt,createShiftPlane as yt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as mt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as gt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as wt}from"../../support/geometryUtils/ray.js";import{newIntersector as ft}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as Mt}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as Tt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Dt}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as Vt}from"../../../support/screenUtils.js";var bt;let kt=bt=class extends Tt{constructor(t){super(t),this._clock=a,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=N,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=H(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=ft(t.view.state.viewingMode),this._intersector.options.store=Mt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this._settings=new F(this.view.effectiveTheme);const t=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,e={accentColor:this._settings.rotateManipulators.color,contrastColor:this._settings.rotateManipulators.contrastColor,preMultiplyAlpha:t};this._rotateHeadingImage=B(this.view.toolViewManager.textures,e),this._rotateTiltImage=K(this.view.toolViewManager.textures,e);const i=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view,{offsetMode:$.CENTER_ON_ARROW,calloutColor:this._settings.callouts.color,color:this._settings.shiftManipulator.color,outlineColor:this._settings.shiftManipulator.outlineColor}),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(t=>{this._onShiftGrab(t),i(this.shiftManipulator)})),this.addHandles(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=tt(this.view,this._rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(t=>{this._onRotateHeadingGrab(t),i(this.rotateHeadingManipulator)})),this.addHandles(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=tt(this.view,this._rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(t=>{this._onRotateTiltGrab(t),i(this.rotateTiltManipulator)})),this.addHandles(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((t,e)=>{const a=et(this.view,t,{color:this._settings.resizeManipulators.color});return a.events.on("grab-changed",(t=>{this._onResizeGrab(t,e),i(a)})),this.addHandles(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=it(this.view),this._previewPlaneOutlineVisualElement=at(this.view),this._previewPlaneOutlineVisualElement.width=Z,this.addHandles(l((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),o));const a=l((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),h);this.addHandles([a,l((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._rotateHeadingImage=s(this._rotateHeadingImage),this._rotateTiltImage=s(this._rotateTiltImage),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!St(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!St(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!St(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Vt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Vt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Vt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const e=Vt(t),a=H();if(this._pickPlane(e,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const i=this._calculatePickRay(e);this.inputState=Et(i,t.pointerId,a.origin,a)}return x(a,this._startPlane),this.analysis.shape=st(a,this.view,this.view.spatialReference,new i),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Vt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===q||t.key===W)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==q&&t.key!==W||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=this._calculatePickRay(t.screenPoint);x(this.analysisViewData.plane,this._startPlane),this.inputState=Et(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(g(R(this.analysisViewData.plane),e.ray.direction)/w(e.ray.direction)))/i,1),s=-C(this._startPlane.plane,e.renderEnd),n=-C(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=f(U.get(),this._startPlane.origin),i=f(U.get(),R(this._startPlane));M(i,i,-t.depth),T(i,i,e);const a=I(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,H());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.HEADING,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=nt(this.analysisViewData.plane,this.view.renderCoordsHelper,rt.TILT,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=z(t.rotatePlane),a=mt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=P(A.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=D(U.get(),this._startPlane.basis1,e),a=D(U.get(),this._startPlane.basis2,e),s=I(this.analysisViewData.plane.origin,i,a,H());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=this._calculatePickRay(t.screenPoint),a=U.get();O(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:k(a)})}_createResizeDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=x(this.analysisViewData.plane,H());e.next(gt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=lt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:H();if(i=null!=i?x(i,Ht):null,this._pickPlane(t,!0,e,a)){const t=J;let e=!1;null!=i&&(e=g(i.plane,a.plane)<t||g(V(U.get(),i.basis1),V(U.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=p({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*Q),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=r(this._frameTask)}_calculatePickRay(t){const e=G(),i=c(t,xt);return wt(this.view.state.camera,i,e),V(e.direction,e.direction),e}_pickMinResult(t){const e=c(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=U.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(U.get()),l=this.view.state.camera;g(r,l.viewForward)>0&&M(r,r,-1);const o=ot(n,l),h=(e?1:-1)*o*X,p=M(U.get(),r,h);T(p,p,n);const u=this.analysis.tiltEnabled?ht.TILTED:ht.HORIZONTAL_OR_VERTICAL,c=i[q]?ht.VERTICAL:i[W]?ht.HORIZONTAL:u;return pt(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=r(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ut,this.rotateHeadingManipulator.state|=ut,this.rotateTiltManipulator.state|=ut,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ut,this.rotateHeadingManipulator.state&=~ut,this.rotateTiltManipulator.state&=~ut}),this._pointerMoveTimerMs)}_updateManipulators(){if(bt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ct(t,A.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),dt(this.shiftManipulator,i,t,this.view.state.camera),_t(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),vt(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>Pt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=b(U.get(),w(t.basis1),w(t.basis2),1),s=y(A.get(),a),n=m(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=e.toUnitRGBA(this._settings.plane.outlineColor);t[3]*=this._previewPlaneOpacity;const i=e.toUnitRGBA(this._settings.plane.color);i[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=i,this._previewPlaneGridVisualElement.gridColor=S}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Et(t,e,i,a){const s=yt(i,R(a),t.direction,j()),n=E();return O(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function St(t){return"mouse"!==t.pointerType||0===t.button}kt.disableEngineLayers=!1,t([_()],kt.prototype,"_clock",void 0),t([_({constructOnly:!0})],kt.prototype,"view",void 0),t([_()],kt.prototype,"analysisViewData",void 0),t([_({readOnly:!0})],kt.prototype,"state",null),t([_({readOnly:!0})],kt.prototype,"cursor",null),t([_()],kt.prototype,"analysis",null),t([_()],kt.prototype,"removeIncompleteOnCancel",void 0),t([_({readOnly:!0})],kt.prototype,"layersMode",void 0),t([_({value:null})],kt.prototype,"inputState",null),t([_()],kt.prototype,"_isPlacingSlicePlane",null),t([_()],kt.prototype,"_creatingPointerId",null),kt=bt=t([v("esri.views.3d.analysis.Slice.SliceTool")],kt);const Ht=H(),xt=d(),Rt=kt;export{Rt as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
+ */
5
+ import{generateStyledTexture as t}from"./generateTextures.js";import o from"./heading-rotate-svg.js";import r from"./tilt-rotate-svg.js";import{Texture as e}from"../../webgl-engine/lib/Texture.js";const a=64;function l(r,l){const{accentColor:n,contrastColor:c,preMultiplyAlpha:i}=l;return r.fromData(`heading-rotate:[accent:${n},contrast:${c},size:${a}]`,(()=>new e(t(o,{accentColor:n,contrastColor:c,size:a}),{mipmap:!0,reloadable:!0,preMultiplyAlpha:i})))}function n(o,l){const{accentColor:n,contrastColor:c,preMultiplyAlpha:i}=l;return o.fromData(`tilt-rotate:[accent:${n},contrast:${c},size:${a}]`,(()=>new e(t(r,{accentColor:n,contrastColor:c,size:a}),{mipmap:!0,reloadable:!0,preMultiplyAlpha:i})))}export{l as getRotateHeadingTexture,n as getTiltRotateTexture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{createScreenPointArray as n,createRenderScreenPointArray3 as r,screenPointObjectToArray as a,castRenderScreenPointArray as c}from"../../../core/screenUtils.js";import{f as l}from"../../../chunks/mat3.js";import{c as h}from"../../../chunks/mat3f64.js";import{c as d,s as _,m as u,i as g}from"../../../chunks/mat4.js";import{c as m}from"../../../chunks/mat4f64.js";import{k as f}from"../../../chunks/vec2.js";import{e as p,t as b,m as v,b as y,i as j,a as L,s as S,g as R}from"../../../chunks/vec3.js";import{c as O,Z as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as A,projectPoint as E}from"../../../geometry/projection.js";import{computeENUToSphericalPCPFLocalRotation as D}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as F}from"../../../geometry/projection/projectors.js";import{containsPointObject as k}from"../../../geometry/support/aaBoundingRect.js";import{create as z,distance2 as P,fromPoints as C,closestRayDistance2 as I}from"../../../geometry/support/lineSegment.js";import{create as M,fromPositionAndNormal as x,intersectRay as U}from"../../../geometry/support/plane.js";import{create as B}from"../../../geometry/support/ray.js";import{sv3d as W}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N,hydratedSpatialReference as H}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as V}from"../support/ElevationProvider.js";import{fromScreen as G}from"../support/geometryUtils/ray.js";import{Camera as Y}from"../webgl-engine/lib/Camera.js";import{Object3D as Z}from"../webgl-engine/lib/Object3D.js";import{UpdatePolicy as q}from"../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as J}from"../webgl-engine/lib/WebGLLayer.js";import{ManipulatorStateCustomFlags as K,ManipulatorStateFlags as Q}from"../../interactive/interfaces.js";import X from"../../../geometry/Point.js";class ${constructor(e){this.metadata=void 0,this._camera=new Y,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=m(),this._worldFrame=null,this._renderLocation=O(),this._renderLocationDirty=!0,this._location=new X({x:0,y:0,z:0}),this._elevationAlignedLocation=new X,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=K.None,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:n(),renderScreenPointArray:r(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),i((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=m()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=H(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=p(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(t,i){if(!this.available)return null;const s=a(t,ie),o=this._getCollisionRadius(i),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(f(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae),r=o*this.screenLocation.pixelSize,a=G(this._camera,s,oe);if(null==a)return null;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],i);for(let t=1;t<s.length;t++){const o=v(he,s[t],i),l=I(C(e,o,se),a);if(null!=l&&l<r*r){const t=p(W.get(),e,o);y(t,t,.5);const i=c(W.get());return this._camera.projectToRenderScreen(t,i),i[2]+n}j(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??w,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this.screenLocation.pixelSize,c=G(this._camera,s,oe);if(null==c)return null;const h=l(ne,r),d=b(_e,e,h),_=v(ue,t,r);x(_,d,ce);const u=de;if(U(ce,c,u)&&L(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=G(this._camera,s,oe);if(null==h)return null;const d=l(ne,r),_=b(_e,t,d),u=this._calculateModelTransformPosition(ue);x(u,_,ce);const g=de;if(!U(ce,h,g))break;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],r);for(let t=1;t<s.length;t++){const i=v(he,s[t],r),o=P(C(e,i,se),g);if(null!=o&&o<a*a){const t=p(W.get(),e,i);y(t,t,.5);const s=c(W.get());return this._camera.projectToRenderScreen(t,s),s[2]+n}j(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new J(t,{pickable:!1,updatePolicy:q.SYNC}),i.engineLayerId=this._engineLayer.id):t?.getObject&&(this._engineLayer=t.getObject(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,null==this._materialIdReferences&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),A(this._location.spatialReference,this.view.spatialReference)||(this.location=new X({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,o(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){E(this.location,me,e.spatialReference)&&k(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=this.elevationInfo.offset??0;switch(this.elevationInfo.mode){case"on-the-ground":e=V(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(V(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(V(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?Q.Focused:Q.Unfocused)|(this.selected?Q.Selected:Q.Unselected),o=this._noDisplayCount>0;for(const{stateMask:n,objects:r}of i){if(o){for(const e of r)e.visible=!1;continue}const e=(n&Q.All)!==Q.None,i=(n&K.All)!==K.None,a=!e||(s&n)==(n&Q.All),c=!i||(this.state&n)==(n&K.All);if(a&&c)for(const s of r)s.visible=!0,s.transformation=t;else for(const t of r)t.visible=!1}}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach((({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))}));const s=new Map;this._renderObjects.forEach((e=>{const t=new Z({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)}));const o=[];s.forEach(((e,t)=>o.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id)||0;0===s&&e.add(t),i.set(t.id,s+1)})),t.forEach((({objects:t})=>{i.addMany(t),e.addMany(t)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:t})=>{i.removeMany(t),e.removeMany(t)})),s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id);1===s?(e.remove(t),i.delete(t.id)):i.set(t.id,s-1)})),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,re);return S(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return R(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return _(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&u(t,t,this._worldFrame),u(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){let e=!1;if(null!=this._engineResources)for(const t in this._engineResources.objectsByState){const i=this._engineResources.objectsByState[t];for(const t of i.objects)if(t.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,i){switch(e.viewingMode){case"local":return g(i),!0;case"global":{const o=T(e.renderCoordsHelper.spatialReference);return F(t,0,le,0,o.radius),D(s(le[0]),s(le[1]),i),!0}}}const ie=n(),se=z(),oe=B(),ne=h(),re=m(),ae=m(),ce=M(),le=O(),he=O(),de=O(),_e=O(),ue=O(),ge=O(),me=new X({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{$ as Manipulator3D};
5
+ import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{createScreenPointArray as n,createRenderScreenPointArray3 as r,screenPointObjectToArray as a,castRenderScreenPointArray as c}from"../../../core/screenUtils.js";import{f as l}from"../../../chunks/mat3.js";import{c as h}from"../../../chunks/mat3f64.js";import{c as d,s as _,m as u,i as g}from"../../../chunks/mat4.js";import{c as m}from"../../../chunks/mat4f64.js";import{k as f}from"../../../chunks/vec2.js";import{e as p,t as b,m as v,b as y,i as j,a as L,s as S,g as R}from"../../../chunks/vec3.js";import{c as O,Z as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as A,projectPoint as E}from"../../../geometry/projection.js";import{computeENUToSphericalPCPFLocalRotation as D}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as k}from"../../../geometry/projection/projectors.js";import{containsPointObject as F}from"../../../geometry/support/aaBoundingRect.js";import{create as z,distance2 as C,fromPoints as P,closestRayDistance2 as I}from"../../../geometry/support/lineSegment.js";import{create as M,fromPositionAndNormal as x,intersectRay as U}from"../../../geometry/support/plane.js";import{create as B}from"../../../geometry/support/ray.js";import{sv3d as W}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N,hydratedSpatialReference as H}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as V}from"../support/ElevationProvider.js";import{fromScreen as G}from"../support/geometryUtils/ray.js";import{Camera as Y}from"../webgl-engine/lib/Camera.js";import{Object3D as Z}from"../webgl-engine/lib/Object3D.js";import{UpdatePolicy as q}from"../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as J}from"../webgl-engine/lib/WebGLLayer.js";import{ManipulatorStateCustomFlags as K,ManipulatorStateFlags as Q}from"../../interactive/interfaces.js";import X from"../../../geometry/Point.js";class ${constructor(e){this.metadata=void 0,this._camera=new Y,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=m(),this._worldFrame=null,this._renderLocation=O(),this._renderLocationDirty=!0,this._location=new X({x:0,y:0,z:0}),this._elevationAlignedLocation=new X,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=K.None,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:n(),renderScreenPointArray:r(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),i((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=m()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=H(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=p(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(t,i){if(!this.available)return null;const s=a(t,ie),o=this._getCollisionRadius(i),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(f(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae),r=o*this.screenLocation.pixelSize,a=G(this._camera,s,oe);if(null==a)return null;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],i);for(let t=1;t<s.length;t++){const o=v(he,s[t],i),l=I(P(e,o,se),a);if(null!=l&&l<r*r){const t=p(W.get(),e,o);y(t,t,.5);const i=c(W.get());return this._camera.projectToRenderScreen(t,i),i[2]+n}j(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??w,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this.screenLocation.pixelSize,c=G(this._camera,s,oe);if(null==c)return null;const h=l(ne,r),d=b(_e,e,h),_=v(ue,t,r);x(_,d,ce);const u=de;if(U(ce,c,u)&&L(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=G(this._camera,s,oe);if(null==h)return null;const d=l(ne,r),_=b(_e,t,d),u=this._calculateModelTransformPosition(ue);x(u,_,ce);const g=de;if(!U(ce,h,g))break;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],r);for(let t=1;t<s.length;t++){const i=v(he,s[t],r),o=C(P(e,i,se),g);if(null!=o&&o<a*a){const t=p(W.get(),e,i);y(t,t,.5);const s=c(W.get());return this._camera.projectToRenderScreen(t,s),s[2]+n}j(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new J(t,{pickable:!1,updatePolicy:q.SYNC}),i.engineLayerId=this._engineLayer.id):t?.getObject&&(this._engineLayer=t.getObject(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,null==this._materialIdReferences&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),A(this._location.spatialReference,this.view.spatialReference)||(this.location=new X({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,o(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){E(this.location,me,e.spatialReference)&&F(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=this.elevationInfo.offset??0;switch(this.elevationInfo.mode){case"on-the-ground":e=V(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(V(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(V(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?Q.Focused:Q.Unfocused)|(this.selected?Q.Selected:Q.Unselected),o=this._noDisplayCount>0;for(const{stateMask:n,objects:r}of i){if(o){for(const e of r)e.visible=!1;continue}const e=(n&Q.All)!==Q.None,i=(n&K.All)!==K.None,a=!e||(s&n)==(n&Q.All),c=!i||(this.state&n)==(n&K.All);if(a&&c)for(const s of r)s.visible=!0,s.transformation=t;else for(const t of r)t.visible=!1}}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach((({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))}));const s=new Map;this._renderObjects.forEach((e=>{const t=new Z({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)}));const o=[];s.forEach(((e,t)=>o.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id)||0;0===s&&e.add(t),i.set(t.id,s+1)})),t.forEach((({objects:t})=>{i.addMany(t),e.addMany(t)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:t})=>{i.removeMany(t),e.removeMany(t)})),s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id);1===s?(e.remove(t),i.delete(t.id)):i.set(t.id,s-1)})),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,re);return S(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return R(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return _(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&u(t,t,this._worldFrame),u(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){let e=!1;if(null!=this._engineResources)for(const t in this._engineResources.objectsByState){const i=this._engineResources.objectsByState[t];for(const t of i.objects)if(t.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,i){switch(e.viewingMode){case"local":return g(i),!0;case"global":{const o=T(e.renderCoordsHelper.spatialReference);return k(t,0,le,0,o.radius),D(s(le[0]),s(le[1]),i),!0}}}const ie=n(),se=z(),oe=B(),ne=h(),re=m(),ae=m(),ce=M(),le=O(),he=O(),de=O(),_e=O(),ue=O(),ge=O(),me=new X({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{$ as Manipulator3D};