@arcgis/core 4.32.0-next.20250107 → 4.32.0-next.20250108

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 (99) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
  4. package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
  5. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
  6. package/assets/esri/core/workers/chunks/{f6d6bc43ac1c13892d44.js → 58485909e1cfeb52c01e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{c49707b577f3805f0142.js → 5b61a1e7ac60a02a906d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
  9. package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{dca0eb66116e4b5403fc.js → 7df076d15b7b7a66dcee.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{4423aac6e44c3dbf184e.js → 89286d8f59844724cd16.js} +1 -1
  13. package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
  14. package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
  15. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  16. package/chunks/LineSeries.js +1 -1
  17. package/chunks/OperatorProject.js +1 -1
  18. package/chunks/Pattern.glsl.js +1 -1
  19. package/chunks/QuadraticBezier.js +1 -1
  20. package/chunks/Transformation2D.js +1 -1
  21. package/chunks/chartUtilsAm5.js +1 -1
  22. package/chunks/lyr3DWorker.js +1 -1
  23. package/chunks/vxlLayer.js +1 -1
  24. package/geometry/support/meshUtils/primitives.js +1 -1
  25. package/geometry/support/triangle.js +1 -1
  26. package/interfaces.d.ts +175 -91
  27. package/layers/LinkChartLayer.js +1 -1
  28. package/layers/MapNotesLayer.js +1 -1
  29. package/layers/MediaLayer.js +1 -1
  30. package/layers/support/ImageElement.js +1 -1
  31. package/layers/support/VideoElement.js +1 -1
  32. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  33. package/layers/video/VideoController.js +1 -1
  34. package/linkChart/OrganicLayoutSettings.js +1 -1
  35. package/package.json +3 -3
  36. package/smartMapping/renderers/color.js +1 -1
  37. package/smartMapping/renderers/size.js +1 -1
  38. package/smartMapping/renderers/univariateColorSize.js +1 -1
  39. package/support/mediaLayerUtils.js +5 -0
  40. package/support/revision.js +1 -1
  41. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  42. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  43. package/views/2d/AnimationManager.js +1 -1
  44. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  45. package/views/2d/engine/webgl/Overlay.js +1 -1
  46. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  47. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  48. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  49. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  50. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  51. package/views/2d/navigation/MapViewNavigation.js +1 -1
  52. package/views/2d/support/HighlightGroup.js +1 -1
  53. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  54. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  55. package/views/3d/analysis/support/measurementUtils.js +1 -1
  56. package/views/3d/environment/CloudsParameters.js +1 -1
  57. package/views/3d/environment/MarsAtmosphere.js +1 -1
  58. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  59. package/views/3d/layers/MediaLayerView3D.js +1 -1
  60. package/views/3d/layers/graphics/placementUtils.js +1 -1
  61. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  62. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  63. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  64. package/views/3d/support/HighlightGroup.js +1 -1
  65. package/views/3d/terrain/SphericalPatch.js +1 -1
  66. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  67. package/views/3d/terrain/TileRenderer.js +1 -1
  68. package/views/3d/terrain/TileTexture.js +1 -1
  69. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  70. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  71. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  72. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  73. package/views/SceneView.js +1 -1
  74. package/views/View.js +1 -1
  75. package/views/input/BrowserEventSource.js +1 -1
  76. package/views/layers/MediaLayerView.js +1 -1
  77. package/views/support/HighlightGroup.d.ts +4 -0
  78. package/views/support/HighlightGroup.js +5 -0
  79. package/views/webgl/Texture.js +1 -1
  80. package/views/webgl/textureUtils.js +1 -1
  81. package/webscene/Slide.js +1 -1
  82. package/widgets/BasemapLayerList.js +1 -1
  83. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  84. package/widgets/CatalogLayerList.js +1 -1
  85. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  86. package/widgets/LayerList/support/layerListUtils.js +1 -1
  87. package/widgets/LayerList.js +1 -1
  88. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  89. package/widgets/PanoramicViewer/utils.js +1 -1
  90. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  91. package/widgets/Sketch/SketchViewModel.js +1 -1
  92. package/widgets/TableList.js +1 -1
  93. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
  94. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
  95. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
  96. package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +0 -1
  97. package/assets/esri/core/workers/chunks/c05e0bd145a1c27d6857.js +0 -2
  98. package/views/2d/support/HighlightGroup.d.ts +0 -4
  99. /package/assets/esri/core/workers/chunks/{c05e0bd145a1c27d6857.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import i from"../../Viewpoint.js";import e from"../../core/Accessor.js";import has from"../../core/has.js";import{removeMaybe as n}from"../../core/maybe.js";import{addFrameTask as o}from"../../core/scheduling.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{Milliseconds as a}from"../../core/time.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import p from"../ViewAnimation.js";import u from"./PaddedViewState.js";import{easingFunctions as c,parse as d}from"./unitBezier.js";import{copy as l}from"./viewpointUtils.js";import{Camera as w}from"./pointToPoint/Camera.js";import{Animation as _}from"../animation/pointToPoint/Animation.js";import{defaultSettings2D as g}from"../animation/pointToPoint/Settings.js";import f from"../../geometry/Point.js";const v=2e3,j=64;class y{constructor(t){this._view=t,this._animation=new _((()=>new w(this._view))),this._current=new w(this._view)}get _source(){return this._animation.definition.source}get _target(){return this._animation.definition.target}get duration(){return this._animation.time}get animation(){return this._animation}update(t,i,e={}){l(this._current.viewpoint,t),l(this._source.viewpoint,t),l(this._target.viewpoint,i),this._animation.update(this._source,this._target,e)}applyRatio(t,i){this._animation.cameraAt(i,this._current),l(t,this._current.viewpoint)}}let T=class extends e{constructor(t){super(t),this._animation=null,this._destinationViewState=new u,this.updateFunction=null,this.easing=c.ease,this.viewpoint=new i({targetGeometry:new f,scale:0,rotation:0}),this._updateTask=o({postRender:this._postRender.bind(this)}),this._updateTask.pause(),this._transition=new y(t.view)}destroy(){this._updateTask=n(this._updateTask)}get animation(){return this._animation}set animation(t){this._animation=t,this.view.animation=t}animate(t,i,e){this.stop();const n=this.viewpoint;l(n,i);const o=("string"==typeof e?.easing?d(e.easing):e?.easing)||this.easing,s=t.target;this._transition.update(this.viewpoint,s,{apex:{maximumDistance:Math.min(Math.min(i.scale,s.scale)*j,this.view.constraints.effectiveMinScale),desiredSlope:5e-8},duration:e?.duration,maxDuration:"auto"===e?.animationMode?a(1/0):e?.maxDuration??g.maxDuration,speedFactor:e?.speedFactor,easing:"function"==typeof o?t=>o(t):void 0}),"auto"===e?.animationMode&&(this._destinationViewState.copy(this.view.state),this._destinationViewState.viewpoint=s,x(this._transition.animation,e,this.view.state,this._destinationViewState)||this._transition.update(this.viewpoint,s,{duration:a(0)}));const r=()=>{this.animation===t&&this._updateTask&&("finished"===t.state&&(this._transition.applyRatio(this.viewpoint,1),this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())),this.animation=null,this.updateFunction=null)};return t.when(r,r),this._startTime=performance.now(),this._updateTask.resume(),this.animation=t,t}animateContinuous(t,i){this.stop(),this.updateFunction=i,this.viewpoint=t;const e=new p({target:t.clone()}),n=()=>{this.animation===e&&this._updateTask&&(this.animation=null,this.updateFunction=null)};return e.when(n,n),this._startTime=performance.now(),this._updateTask.resume(),this.animation=e,e}stop(){this.animation&&(this.animation.stop(),this.animation=null,this.updateFunction=null)}_postRender(t){const i=this.animation;if(i&&i.state!==p.State.STOPPED){if(this.updateFunction)this.updateFunction(this.viewpoint,t.deltaTime),this.animation?.update(this.viewpoint);else{const t=performance.now()-this._startTime,i=this._transition.duration,e=i>0?t/i:1,n=e>=1;this._transition.applyRatio(this.viewpoint,e),n&&this.animation?.finish()}this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())}else this._updateTask.pause()}};function x(t,i,e,n){if(null!=i?.duration)return!0;const{time:o,isLinear:a}=t,r=i?.speedFactor||1,h=i?.maxDuration??g.maxDuration/r;if(has("esri-goto-debug")&&(console.log("speed factor:",r),console.log("adjusted duration:\t\t",o),console.log("adjusted max duration:\t",h),console.log("is linear:",a)),o>h)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: animations must be shorter than ${h/1e3}s`),!1;if(a){const t=1.5,i=m(),a=s(...n.toScreen(i,...e.center)),p=s(...e.toScreen(i,...n.center)),u=null!=p&&p.x>-(t-.5)*e.size[0]&&p.x<(t+.5)*e.size[0]&&p.y>-(t-.5)*e.size[1]&&p.y<(t+.5)*e.size[1],c=null!=a&&a.x>-(t-.5)*n.size[0]&&a.x<(t+.5)*n.size[0]&&a.y>-(t-.5)*n.size[1]&&a.y<(t+.5)*n.size[1];if(has("esri-goto-debug")&&(console.log(`dest is within ${t} screens at start view:`,u),console.log(`start is within ${t} screens at dest view:`,c)),o>v/r&&!u&&!c)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: linear animations must be...\n - shorter than ${v/1e3/r}s, or\n - shorter than ${h/1e3}s and the destination is close enough to the starting screen, or\n - shorter than ${h/1e3}s and the start point is close enough to the destination screen`),!1}return!0}t([r()],T.prototype,"easing",void 0),t([r()],T.prototype,"view",void 0),t([r()],T.prototype,"viewpoint",void 0),T=t([h("esri.views.2d.AnimationManager")],T);const S=T;export{S as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import i from"../../Viewpoint.js";import e from"../../core/Accessor.js";import has from"../../core/has.js";import{removeMaybe as n}from"../../core/maybe.js";import{addFrameTask as o}from"../../core/scheduling.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{Milliseconds as a}from"../../core/time.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import p from"../ViewAnimation.js";import u from"./PaddedViewState.js";import{easingFunctions as c,parse as d}from"./unitBezier.js";import{copy as l}from"./viewpointUtils.js";import{Camera as w}from"./pointToPoint/Camera.js";import{Animation as _}from"../animation/pointToPoint/Animation.js";import{defaultSettings2D as g}from"../animation/pointToPoint/Settings.js";import f from"../../geometry/Point.js";const v=2e3,j=64;class y{constructor(t){this._view=t,this._animation=new _((()=>new w(this._view))),this._current=new w(this._view)}get _source(){return this._animation.definition.source}get _target(){return this._animation.definition.target}get duration(){return this._animation.time}get animation(){return this._animation}update(t,i,e={}){l(this._current.viewpoint,t),l(this._source.viewpoint,t),l(this._target.viewpoint,i),this._animation.update(this._source,this._target,e)}applyRatio(t,i){this._animation.cameraAt(i,this._current),l(t,this._current.viewpoint)}}let T=class extends e{constructor(t){super(t),this._animation=null,this._destinationViewState=new u,this.updateFunction=null,this.easing=c.ease,this.viewpoint=new i({targetGeometry:new f,scale:0,rotation:0}),this._updateTask=o({postRender:this._postRender.bind(this)}),this._updateTask.pause(),this._transition=new y(t.view)}destroy(){this._updateTask=n(this._updateTask)}get animation(){return this._animation}set animation(t){this._animation=t,this.view.animation=t}animate(t,i,e){this.stop();const n=this.viewpoint;l(n,i);const o=("string"==typeof e?.easing?d(e.easing):e?.easing)||this.easing,s=t.target;this._transition.update(this.viewpoint,s,{apex:{maximumDistance:Math.min(Math.min(i.scale,s.scale)*j,this.view.constraints.effectiveMinScale),desiredSlope:5e-8},duration:e?.duration,maxDuration:"auto"===e?.animationMode?a(1/0):e?.maxDuration??g.maxDuration,speedFactor:e?.speedFactor,easing:"function"==typeof o?t=>o(t):void 0}),"auto"===e?.animationMode&&(this._destinationViewState.copy(this.view.state),this._destinationViewState.viewpoint=s,x(this._transition.animation,e,this.view.state,this._destinationViewState)||this._transition.update(this.viewpoint,s,{duration:a(0)}));const r=()=>{this.animation===t&&this._updateTask&&("finished"===t.state&&(this._transition.applyRatio(this.viewpoint,1),this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())),this.animation=null,this.updateFunction=null)};return t.when(r,r),this._startTime=performance.now(),this._updateTask.resume(),this.animation=t,t}animateContinuous(t,i){this.stop(),this.updateFunction=i,this.viewpoint=t;const e=new p({target:t.clone()}),n=()=>{this.animation===e&&this._updateTask&&(this.animation=null,this.updateFunction=null)};return e.when(n,n),this._startTime=performance.now(),this._updateTask.resume(),this.animation=e,e}stop(){this.animation&&(this.animation.stop(),this.animation=null,this.updateFunction=null)}_postRender(t){const i=this.animation;if(i&&i.state!==p.State.STOPPED){if(this.updateFunction)this.updateFunction(this.viewpoint,t.deltaTime),this.animation?.update(this.viewpoint);else{const t=performance.now()-this._startTime,i=this._transition.duration,e=i>0?t/i:1,n=e>=1;this._transition.applyRatio(this.viewpoint,e),n&&this.animation?.finish()}this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())}else this._updateTask.pause()}};function x(t,i,e,n){if(null!=i?.duration)return!0;const{time:o,isLinear:a}=t,r=i?.speedFactor||1,h=i?.maxDuration??g.maxDuration/r;if(has("esri-goto-debug")&&(console.log("speed factor:",r),console.log("adjusted duration:\t\t",o),console.log("adjusted max duration:\t",h),console.log("is linear:",a)),o>h)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: animations must be shorter than ${h/1e3}s`),!1;if(a){const t=1.5,i=m(),a=s(...n.toScreen(i,...e.center)),p=s(...e.toScreen(i,...n.center)),u=null!=p&&p.x>-1*e.size[0]&&p.x<(t+.5)*e.size[0]&&p.y>-1*e.size[1]&&p.y<(t+.5)*e.size[1],c=null!=a&&a.x>-1*n.size[0]&&a.x<(t+.5)*n.size[0]&&a.y>-1*n.size[1]&&a.y<(t+.5)*n.size[1];if(has("esri-goto-debug")&&(console.log(`dest is within ${t} screens at start view:`,u),console.log(`start is within ${t} screens at dest view:`,c)),o>v/r&&!u&&!c)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: linear animations must be...\n - shorter than ${v/1e3/r}s, or\n - shorter than ${h/1e3}s and the destination is close enough to the starting screen, or\n - shorter than ${h/1e3}s and the start point is close enough to the destination screen`),!1}return!0}t([r()],T.prototype,"easing",void 0),t([r()],T.prototype,"view",void 0),t([r()],T.prototype,"viewpoint",void 0),T=t([h("esri.views.2d.AnimationManager")],T);const S=T;export{S 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.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/ArrayPool.js";import{e}from"../../../../../chunks/earcut.js";import{triangulate as i}from"../../../../../geometry/libtess.js";import{Point as r}from"../../../../../geometry/support/TileClipper.js";import{BucketType as l}from"../enums.js";import n from"./BaseBucket.js";class s extends n{constructor(t,e,i,r,n,s,o){super(t,e,i),this.type=l.FILL,this._patternMap=new Map,this._fillVertexBuffer=r,this._fillIndexBuffer=n,this._outlineVertexBuffer=s,this._outlineIndexBuffer=o}get fillIndexStart(){return this._fillIndexStart}get fillIndexCount(){return this._fillIndexCount}get outlineIndexStart(){return this._outlineIndexStart}get outlineIndexCount(){return this._outlineIndexCount}getResources(t,e,i){const r=this.layer,l=this.zoom,n=r.getPaintProperty("fill-pattern");if(n)if(n.isDataDriven)for(const s of this._features)e(n.getValue(l,s),!0);else e(n.getValue(l),!0)}processFeatures(t){this._fillIndexStart=3*this._fillIndexBuffer.index,this._fillIndexCount=0,this._outlineIndexStart=3*this._outlineIndexBuffer.index,this._outlineIndexCount=0;const e=this.layer,i=this.zoom,{fillMaterial:r,outlineMaterial:l,hasDataDrivenFill:n,hasDataDrivenOutline:s}=e;t&&t.setExtent(this.layerExtent);const o=e.getPaintProperty("fill-pattern"),a=o?.isDataDriven;let f=!o&&e.getPaintValue("fill-antialias",i);if(e.outlineUsesFillColor){if(f&&!e.hasDataDrivenOpacity){const t=e.getPaintValue("fill-opacity",i),r=e.getPaintValue("fill-opacity",i+1);t<1&&r<1&&(f=!1)}if(f&&!e.hasDataDrivenColor){const t=e.getPaintValue("fill-color",i),r=e.getPaintValue("fill-color",i+1);t[3]<1&&r[3]<1&&(f=!1)}}const u=this._features,d=t?.validateTessellation;if(a){const n=[];for(const a of u){const u=o.getValue(i,a),h=this._spriteInfo[u];if(!h?.rect)continue;const x=r.encodeAttributes(a,i,e,h),c=f&&s?l.encodeAttributes(a,i,e):[],_=a.getGeometry(t);n.push({ddFillAttributes:x,ddOutlineAttributes:c,page:h.page,geometry:_}),n.sort(((t,e)=>t.page-e.page));for(const{ddFillAttributes:t,ddOutlineAttributes:i,page:r,geometry:l}of n)this._processFeature(l,f,e.outlineUsesFillColor,t,i,d,r)}}else for(const h of u){const o=n?r.encodeAttributes(h,i,e):null,a=f&&s?l.encodeAttributes(h,i,e):null,u=h.getGeometry(t);this._processFeature(u,f,e.outlineUsesFillColor,o,a,d)}}serialize(){let t=10;t+=this.layerUIDs.length,t+=this._fillVertexBuffer.array.length,t+=this._fillIndexBuffer.array.length,t+=this._outlineVertexBuffer.array.length,t+=this._outlineIndexBuffer.array.length,t+=3*this._patternMap.size+1;const e=new Uint32Array(t),i=new Int32Array(e.buffer);let r=0;e[r++]=this.type,e[r++]=this.layerUIDs.length;for(let s=0;s<this.layerUIDs.length;s++)e[r++]=this.layerUIDs[s];e[r++]=this._fillIndexStart,e[r++]=this._fillIndexCount,e[r++]=this._outlineIndexStart,e[r++]=this._outlineIndexCount;const l=this._patternMap,n=l.size;if(e[r++]=n,n>0)for(const[s,[o,a]]of l)e[r++]=s,e[r++]=o,e[r++]=a;e[r++]=this._fillVertexBuffer.array.length;for(let s=0;s<this._fillVertexBuffer.array.length;s++)i[r++]=this._fillVertexBuffer.array[s];e[r++]=this._fillIndexBuffer.array.length;for(let s=0;s<this._fillIndexBuffer.array.length;s++)e[r++]=this._fillIndexBuffer.array[s];e[r++]=this._outlineVertexBuffer.array.length;for(let s=0;s<this._outlineVertexBuffer.array.length;s++)i[r++]=this._outlineVertexBuffer.array[s];e[r++]=this._outlineIndexBuffer.array.length;for(let s=0;s<this._outlineIndexBuffer.array.length;s++)e[r++]=this._outlineIndexBuffer.array[s];return e.buffer}_processFeature(t,e,i,r,l,n,o){if(!t)return;const a=t.length,f=!l||0===l.length;if(e&&(!i||f))for(let s=0;s<a;s++)this._processOutline(t[s],l);const u=32;let d;for(let h=0;h<a;h++){const e=s._area(t[h]);e>u?(void 0!==d&&this._processFill(t,d,r,n,o),d=[h]):e<-u&&void 0!==d&&d.push(h)}void 0!==d&&this._processFill(t,d,r,n,o)}_processOutline(t,e){const i=this._outlineVertexBuffer,l=this._outlineIndexBuffer,n=l.index;let s,o,a;const f=new r(0,0),u=new r(0,0),d=new r(0,0);let h=-1,x=-1,c=-1,_=-1,y=-1,g=!1;const p=0;let I=t.length;if(I<2)return;const B=t[p];let m=t[I-1];for(;I&&m.isEqual(B);)--I,m=t[I-1];if(!(I-p<2)){for(let r=p;r<I;++r){r===p?(s=t[I-1],o=t[p],a=t[p+1],f.assignSub(o,s),f.normalize(),f.rightPerpendicular()):(s=o,o=a,a=r!==I-1?t[r+1]:t[p],f.assign(u));const n=this._isClipEdge(s,o);-1===_&&(g=n),u.assignSub(a,o),u.normalize(),u.rightPerpendicular();const B=f.x*u.y-f.y*u.x;d.assignAdd(f,u),d.normalize();const m=-d.x*-f.x+-d.y*-f.y;let V=Math.abs(0!==m?1/m:1);V>8&&(V=8),B>=0?(c=i.add(o.x,o.y,f.x,f.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,V*-d.x,V*-d.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,d.x,d.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,u.x,u.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c)):(c=i.add(o.x,o.y,V*d.x,V*d.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,-f.x,-f.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,-d.x,-d.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=i.add(o.x,o.y,-u.x,-u.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c))}h>=0&&x>=0&&_>=0&&!g&&l.add(h,x,_),h>=0&&_>=0&&y>=0&&!g&&l.add(h,y,_),this._outlineIndexCount+=3*(l.index-n)}}_processFill(r,l,n,s,o){s=!0;let a;l.length>1&&(a=[]);let f=0;for(const t of l)0!==f&&a.push(f),f+=r[t].length;const u=2*f,d=t.acquire();for(const t of l){const e=r[t],i=e.length;for(let t=0;t<i;++t)d.push(e[t].x,e[t].y)}const h=e(d,a,2);if(s&&e.deviation(d,a,2,h)>0){const t=l.map((t=>r[t].length)),{buffer:e,vertexCount:s}=i(d,t);if(s>0){const t=this._fillVertexBuffer.index;for(let i=0;i<s;i++)this._fillVertexBuffer.add(e[2*i],e[2*i+1],n);for(let e=0;e<s;e+=3){const i=t+e;this._fillIndexBuffer.add(i,i+1,i+2)}if(void 0!==o){const t=this._patternMap,e=t.get(o);e?e[1]+=s:t.set(o,[this._fillIndexStart+this._fillIndexCount,s])}this._fillIndexCount+=s}}else{const t=h.length;if(t>0){const e=this._fillVertexBuffer.index;let i=0;for(;i<u;)this._fillVertexBuffer.add(d[i++],d[i++],n);let r=0;for(;r<t;)this._fillIndexBuffer.add(e+h[r++],e+h[r++],e+h[r++]);if(void 0!==o){const e=this._patternMap,i=e.get(o);i?i[1]+=t:e.set(o,[this._fillIndexStart+this._fillIndexCount,t])}this._fillIndexCount+=t}}t.release(d)}_isClipEdge(t,e){return t.x===e.x?t.x<=-64||t.x>=4160:t.y===e.y&&(t.y<=-64||t.y>=4160)}static _area(t){let e=0;const i=t.length-1;for(let r=0;r<i;r++)e+=(t[r].x-t[r+1].x)*(t[r].y+t[r+1].y);return e+=(t[i].x-t[0].x)*(t[i].y+t[0].y),.5*e}}export{s as default};
5
+ import t from"../../../../../core/ArrayPool.js";import{e}from"../../../../../chunks/earcut.js";import{triangulate as i}from"../../../../../geometry/libtess.js";import{Point as r}from"../../../../../geometry/support/TileClipper.js";import{BucketType as l}from"../enums.js";import n from"./BaseBucket.js";class s extends n{constructor(t,e,i,r,n,s,o){super(t,e,i),this.type=l.FILL,this._patternMap=new Map,this._fillVertexBuffer=r,this._fillIndexBuffer=n,this._outlineVertexBuffer=s,this._outlineIndexBuffer=o}get fillIndexStart(){return this._fillIndexStart}get fillIndexCount(){return this._fillIndexCount}get outlineIndexStart(){return this._outlineIndexStart}get outlineIndexCount(){return this._outlineIndexCount}getResources(t,e,i){const r=this.layer,l=this.zoom,n=r.getPaintProperty("fill-pattern");if(n)if(n.isDataDriven)for(const s of this._features)e(n.getValue(l,s),!0);else e(n.getValue(l),!0)}processFeatures(t){this._fillIndexStart=3*this._fillIndexBuffer.index,this._fillIndexCount=0,this._outlineIndexStart=3*this._outlineIndexBuffer.index,this._outlineIndexCount=0;const e=this.layer,i=this.zoom,{fillMaterial:r,outlineMaterial:l,hasDataDrivenFill:n,hasDataDrivenOutline:s}=e;t&&t.setExtent(this.layerExtent);const o=e.getPaintProperty("fill-pattern"),a=o?.isDataDriven;let f=!o&&e.getPaintValue("fill-antialias",i);if(e.outlineUsesFillColor){if(f&&!e.hasDataDrivenOpacity){const t=e.getPaintValue("fill-opacity",i),r=e.getPaintValue("fill-opacity",i+1);t<1&&r<1&&(f=!1)}if(f&&!e.hasDataDrivenColor){const t=e.getPaintValue("fill-color",i),r=e.getPaintValue("fill-color",i+1);t[3]<1&&r[3]<1&&(f=!1)}}const u=this._features,d=t?.validateTessellation;if(a){const n=[];for(const a of u){const u=o.getValue(i,a),h=this._spriteInfo[u];if(!h?.rect)continue;const x=r.encodeAttributes(a,i,e,h),c=f&&s?l.encodeAttributes(a,i,e):[],_=a.getGeometry(t);n.push({ddFillAttributes:x,ddOutlineAttributes:c,page:h.page,geometry:_}),n.sort(((t,e)=>t.page-e.page));for(const{ddFillAttributes:t,ddOutlineAttributes:i,page:r,geometry:l}of n)this._processFeature(l,f,e.outlineUsesFillColor,t,i,d,r)}}else for(const h of u){const o=n?r.encodeAttributes(h,i,e):null,a=f&&s?l.encodeAttributes(h,i,e):null,u=h.getGeometry(t);this._processFeature(u,f,e.outlineUsesFillColor,o,a,d)}}serialize(){let t=10;t+=this.layerUIDs.length,t+=this._fillVertexBuffer.array.length,t+=this._fillIndexBuffer.array.length,t+=this._outlineVertexBuffer.array.length,t+=this._outlineIndexBuffer.array.length,t+=3*this._patternMap.size+1;const e=new Uint32Array(t),i=new Int32Array(e.buffer);let r=0;e[r++]=this.type,e[r++]=this.layerUIDs.length;for(let s=0;s<this.layerUIDs.length;s++)e[r++]=this.layerUIDs[s];e[r++]=this._fillIndexStart,e[r++]=this._fillIndexCount,e[r++]=this._outlineIndexStart,e[r++]=this._outlineIndexCount;const l=this._patternMap,n=l.size;if(e[r++]=n,n>0)for(const[s,[o,a]]of l)e[r++]=s,e[r++]=o,e[r++]=a;e[r++]=this._fillVertexBuffer.array.length;for(let s=0;s<this._fillVertexBuffer.array.length;s++)i[r++]=this._fillVertexBuffer.array[s];e[r++]=this._fillIndexBuffer.array.length;for(let s=0;s<this._fillIndexBuffer.array.length;s++)e[r++]=this._fillIndexBuffer.array[s];e[r++]=this._outlineVertexBuffer.array.length;for(let s=0;s<this._outlineVertexBuffer.array.length;s++)i[r++]=this._outlineVertexBuffer.array[s];e[r++]=this._outlineIndexBuffer.array.length;for(let s=0;s<this._outlineIndexBuffer.array.length;s++)e[r++]=this._outlineIndexBuffer.array[s];return e.buffer}_processFeature(t,e,i,r,l,n,o){if(!t)return;const a=t.length,f=!l||0===l.length;if(e&&(!i||f))for(let s=0;s<a;s++)this._processOutline(t[s],l);const u=32;let d;for(let h=0;h<a;h++){const e=s._area(t[h]);e>u?(void 0!==d&&this._processFill(t,d,r,n,o),d=[h]):e<-32&&void 0!==d&&d.push(h)}void 0!==d&&this._processFill(t,d,r,n,o)}_processOutline(t,e){const i=this._outlineVertexBuffer,l=this._outlineIndexBuffer,n=l.index;let s,o,a;const f=new r(0,0),u=new r(0,0),d=new r(0,0);let h=-1,x=-1,c=-1,_=-1,y=-1,g=!1;const p=0;let I=t.length;if(I<2)return;const B=t[p];let m=t[I-1];for(;I&&m.isEqual(B);)--I,m=t[I-1];if(!(I-p<2)){for(let r=p;r<I;++r){r===p?(s=t[I-1],o=t[p],a=t[p+1],f.assignSub(o,s),f.normalize(),f.rightPerpendicular()):(s=o,o=a,a=r!==I-1?t[r+1]:t[p],f.assign(u));const n=this._isClipEdge(s,o);-1===_&&(g=n),u.assignSub(a,o),u.normalize(),u.rightPerpendicular();const B=f.x*u.y-f.y*u.x;d.assignAdd(f,u),d.normalize();const m=-d.x*-f.x+-d.y*-f.y;let V=Math.abs(0!==m?1/m:1);V>8&&(V=8),B>=0?(c=i.add(o.x,o.y,f.x,f.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,V*-d.x,V*-d.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,d.x,d.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,u.x,u.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c)):(c=i.add(o.x,o.y,V*d.x,V*d.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,-f.x,-f.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,-d.x,-d.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=i.add(o.x,o.y,-u.x,-u.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c))}h>=0&&x>=0&&_>=0&&!g&&l.add(h,x,_),h>=0&&_>=0&&y>=0&&!g&&l.add(h,y,_),this._outlineIndexCount+=3*(l.index-n)}}_processFill(r,l,n,s,o){s=!0;let a;l.length>1&&(a=[]);let f=0;for(const t of l)0!==f&&a.push(f),f+=r[t].length;const u=2*f,d=t.acquire();for(const t of l){const e=r[t],i=e.length;for(let t=0;t<i;++t)d.push(e[t].x,e[t].y)}const h=e(d,a,2);if(s&&e.deviation(d,a,2,h)>0){const t=l.map((t=>r[t].length)),{buffer:e,vertexCount:s}=i(d,t);if(s>0){const t=this._fillVertexBuffer.index;for(let i=0;i<s;i++)this._fillVertexBuffer.add(e[2*i],e[2*i+1],n);for(let e=0;e<s;e+=3){const i=t+e;this._fillIndexBuffer.add(i,i+1,i+2)}if(void 0!==o){const t=this._patternMap,e=t.get(o);e?e[1]+=s:t.set(o,[this._fillIndexStart+this._fillIndexCount,s])}this._fillIndexCount+=s}}else{const t=h.length;if(t>0){const e=this._fillVertexBuffer.index;let i=0;for(;i<u;)this._fillVertexBuffer.add(d[i++],d[i++],n);let r=0;for(;r<t;)this._fillIndexBuffer.add(e+h[r++],e+h[r++],e+h[r++]);if(void 0!==o){const e=this._patternMap,i=e.get(o);i?i[1]+=t:e.set(o,[this._fillIndexStart+this._fillIndexCount,t])}this._fillIndexCount+=t}}t.release(d)}_isClipEdge(t,e){return t.x===e.x?t.x<=-64||t.x>=4160:t.y===e.y&&(t.y<=-64||t.y>=4160)}static _area(t){let e=0;const i=t.length-1;for(let r=0;r<i;r++)e+=(t[r].x-t[r+1].x)*(t[r].y+t[r+1].y);return e+=(t[i].x-t[0].x)*(t[i].y+t[0].y),.5*e}}export{s 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.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{AnimatedSymbolRepeatType as p}from"../../../../symbols/cim/enums.js";import{DisplayObject as u}from"../DisplayObject.js";import{play as c}from"./animatedFormats/utils.js";import{TextureWrapMode as f}from"../../../webgl/enums.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../webgl/TextureDescriptor.js";const x=[1,1],g=d(),v={none:p.None,loop:p.Loop,oscillate:p.Oscillate};function b(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?v[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class q extends u{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),l),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),l),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=s(this.texture),this.requestRender()}),l),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),l)]),n.element.load().catch((t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return x}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,s=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(s,n),this.texture)i&&(this.texture.setData(r),this.texture.generateMipmap(),"requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender());else{const e=new y;if(e.wrapMode=f.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=s,e.height=n,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new w(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(c(r,b(this.elementView.element.animationOptions),null,i),"play")}else this.texture=new w(t,e,r);this.texture.generateMipmap(),i&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:x,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,l[0]-h,l[1]-p,d[0]-h,d[1]-p]);let u=t;if(i){const[e,,t]=n,{worldWidth:r,xBounds:s}=i,[o,a]=s;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(g,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,g[6]/g[8]*e,g[7]/g[8]*t)}}export{q as default};
5
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{AnimatedSymbolRepeatType as u}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as f}from"./animatedFormats/utils.js";import{TextureWrapMode as w}from"../../../webgl/enums.js";import{Texture as y}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const g=[1,1],v=d(),b={none:u.None,loop:u.Loop,oscillate:u.Oscillate};function q(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?b[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class V extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),l),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),l),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=s(this.texture),this.requestRender()}),l),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),p(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),l)]),n.element.load().catch((t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return g}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,s=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(s,n),this.texture)i&&(this.texture.setData(r),this.texture.generateMipmap(),"requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender());else{const e=new x;if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=s,e.height=n,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new y(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(f(r,q(this.elementView.element.animationOptions),null,i),"play")}else this.texture=new y(t,e,r);this.texture.generateMipmap(),i&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:g,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,l[0]-h,l[1]-p,d[0]-h,d[1]-p]);let u=t;if(i){const[e,,t]=n,{worldWidth:r,xBounds:s}=i,[o,a]=s;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(v,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,v[6]/v[8]*e,v[7]/v[8]*t)}}export{V 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as e,createAbortError as s}from"../../../../core/promiseUtils.js";import{destroyHiddenSvg as i,createHiddenSvg as r,createSvgElement as n}from"../svgUtils.js";const o=1e20;class a{constructor(t,e=2){this._textureSize=t,this._rasterizationScale=e,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:s}=this,i=document.createElement("canvas");i.width=i.height=s,this._context=i.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(s*s),this._gridInner=new Float64Array(s*s),this._f=new Float64Array(s),this._d=new Float64Array(s),this._z=new Float64Array(s+1),this._v=new Int16Array(s)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg=i(this._svg)}draw(i,r,n){const{_canvasSize:a,_textureSize:h,_rasterizationScale:_}=this,l=h/4;this._initSVG();const c=this.createSVGString(i,r);return new Promise(((i,r)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(c),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,a,a),this._context.drawImage(d,0,0,a,a);const e=this._context.getImageData(0,0,a,a),s=new Uint8Array(h*h*4);for(let t=0;t<a*a;t++){const s=e.data[4*t+3]/255;this._gridOuter[t]=1===s?0:0===s?o:Math.max(0,.5-s)**2,this._gridInner[t]=1===s?o:0===s?0:Math.max(0,s-.5)**2}this._edt(this._gridOuter,a,a),this._edt(this._gridInner,a,a);for(let i=0;i<h*h;i++){let e=0;for(let t=0;t<_;t++){const s=Math.floor(i/h)*_+t;for(let t=0;t<_;t++){const r=s*a+(i%h*_+t);e+=this._gridOuter[r]-this._gridInner[r]}}e/=_*_,e/=_;t(.5-e/(2*l),s,4*i)}i(s)};const g=n?.signal;g&&e(g,(()=>r(s())))}))}_initSVG(){return this._svg||(this._svg=r()),this._svg}createSVGString(t,e){const s=this._initSVG(),i=n("path");i.setAttribute("d",t),s.appendChild(i);const r=i.getBBox(),o=r.width/r.height,a=this._canvasSize/2;let h,_,l;if(o>1){h=a/r.width;const t=a*(1/o);_=this._canvasSize/4,l=a-t/2}else{h=a/r.height;_=a-a*o/2,l=this._canvasSize/4}const c=-r.x*h+_,d=-r.y*h+l;i.setAttribute("style",`transform: matrix(${h}, 0, 0, ${h}, ${c}, ${d})`),i.setAttribute("stroke-width",""+.5/h);const g=`<svg style="fill:${e?"red":"none"}; stroke:${e?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${s.innerHTML}</svg>`;return s.removeChild(i),g}_edt(t,e,s){const i=this._f,r=this._d,n=this._v,o=this._z;for(let a=0;a<e;a++){for(let r=0;r<s;r++)i[r]=t[r*e+a];this._edt1d(i,r,n,o,s);for(let i=0;i<s;i++)t[i*e+a]=r[i]}for(let a=0;a<s;a++){for(let s=0;s<e;s++)i[s]=t[a*e+s];this._edt1d(i,r,n,o,e);for(let s=0;s<e;s++)t[a*e+s]=Math.sqrt(r[s])}}_edt1d(t,e,s,i,r){s[0]=0,i[0]=-o,i[1]=+o;for(let n=1,a=0;n<r;n++){let e=(t[n]+n*n-(t[s[a]]+s[a]*s[a]))/(2*n-2*s[a]);for(;e<=i[a];)a--,e=(t[n]+n*n-(t[s[a]]+s[a]*s[a]))/(2*n-2*s[a]);a++,s[a]=n,i[a]=e,i[a+1]=+o}for(let n=0,o=0;n<r;n++){for(;i[o+1]<n;)o++;e[n]=(n-s[o])*(n-s[o])+t[s[o]]}}}export{a as default};
5
+ import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as e,createAbortError as s}from"../../../../core/promiseUtils.js";import{destroyHiddenSvg as i,createHiddenSvg as r,createSvgElement as n}from"../svgUtils.js";const o=1e20;class a{constructor(t,e=2){this._textureSize=t,this._rasterizationScale=e,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:s}=this,i=document.createElement("canvas");i.width=i.height=s,this._context=i.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(s*s),this._gridInner=new Float64Array(s*s),this._f=new Float64Array(s),this._d=new Float64Array(s),this._z=new Float64Array(s+1),this._v=new Int16Array(s)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg=i(this._svg)}draw(i,r,n){const{_canvasSize:a,_textureSize:h,_rasterizationScale:_}=this,l=h/4;this._initSVG();const c=this.createSVGString(i,r);return new Promise(((i,r)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(c),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,a,a),this._context.drawImage(d,0,0,a,a);const e=this._context.getImageData(0,0,a,a),s=new Uint8Array(h*h*4);for(let t=0;t<a*a;t++){const s=e.data[4*t+3]/255;this._gridOuter[t]=1===s?0:0===s?o:Math.max(0,.5-s)**2,this._gridInner[t]=1===s?o:0===s?0:Math.max(0,s-.5)**2}this._edt(this._gridOuter,a,a),this._edt(this._gridInner,a,a);for(let i=0;i<h*h;i++){let e=0;for(let t=0;t<_;t++){const s=Math.floor(i/h)*_+t;for(let t=0;t<_;t++){const r=s*a+(i%h*_+t);e+=this._gridOuter[r]-this._gridInner[r]}}e/=_*_,e/=_;t(.5-e/(2*l),s,4*i)}i(s)};const g=n?.signal;g&&e(g,(()=>r(s())))}))}_initSVG(){return this._svg||(this._svg=r()),this._svg}createSVGString(t,e){const s=this._initSVG(),i=n("path");i.setAttribute("d",t),s.appendChild(i);const r=i.getBBox(),o=r.width/r.height,a=this._canvasSize/2;let h,_,l;if(o>1){h=a/r.width;const t=a*(1/o);_=this._canvasSize/4,l=a-t/2}else{h=a/r.height;_=a-a*o/2,l=this._canvasSize/4}const c=-r.x*h+_,d=-r.y*h+l;i.setAttribute("style",`transform: matrix(${h}, 0, 0, ${h}, ${c}, ${d})`),i.setAttribute("stroke-width",""+.5/h);const g=`<svg style="fill:${e?"red":"none"}; stroke:${e?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${s.innerHTML}</svg>`;return s.removeChild(i),g}_edt(t,e,s){const i=this._f,r=this._d,n=this._v,o=this._z;for(let a=0;a<e;a++){for(let r=0;r<s;r++)i[r]=t[r*e+a];this._edt1d(i,r,n,o,s);for(let i=0;i<s;i++)t[i*e+a]=r[i]}for(let a=0;a<s;a++){for(let s=0;s<e;s++)i[s]=t[a*e+s];this._edt1d(i,r,n,o,e);for(let s=0;s<e;s++)t[a*e+s]=Math.sqrt(r[s])}}_edt1d(t,e,s,i,r){s[0]=0,i[0]=-1e20,i[1]=1e20;for(let n=1,o=0;n<r;n++){let e=(t[n]+n*n-(t[s[o]]+s[o]*s[o]))/(2*n-2*s[o]);for(;e<=i[o];)o--,e=(t[n]+n*n-(t[s[o]]+s[o]*s[o]))/(2*n-2*s[o]);o++,s[o]=n,i[o]=e,i[o+1]=1e20}for(let n=0,o=0;n<r;n++){for(;i[o+1]<n;)o++;e[n]=(n-s[o])*(n-s[o])+t[s[o]]}}}export{a 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{fromRotation as t,multiply as s,translate as i,rotate as e}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o,transformMany as h}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as f,getYAnchorDirection as c,VAlign as d}from"../../alignmentUtils.js";import m from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const _=22,l=4,u=_+l,x=_-6,p=3,b=Math.PI/180,y=8,w=1.5;class L{constructor(t,s,i,e){this._rotationT=o(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const h=i.rect,n=new Float32Array(8);t*=e,s*=e;const r=i.code?h.width*e:i.metrics.width,a=i.code?h.height*e:i.metrics.height;this.width=r,this.height=a,n[0]=t,n[1]=s,n[2]=t+r,n[3]=s,n[4]=t,n[5]=s+a,n[6]=t+r,n[7]=s+a,this._data=n,this._setTextureCoords(h),this._scale=e,this._mosaic=i,this.x=t,this.y=s,this.maxOffset=Math.max(t+r,s+a)}get mosaic(){return this._mosaic}set angle(s){this._angle=s,t(this._rotationT,-s),this._setOffsets()}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:i}=this._mosaic.metrics,e=i*this._scale,n=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+e,r[3]=this.y,r[4]=this.x,r[5]=this.y+n,r[6]=this.x+e,r[7]=this.y+n;const a=s(o(),this._rotationT,this._transform);h(r,r,a);let f=1/0,c=1/0,d=-1/0,m=-1/0;for(let s=0;s<4;s++){const t=r[2*s],i=r[2*s+1];f=Math.min(f,t),c=Math.min(c,i),d=Math.max(d,t),m=Math.max(m,i)}const _=d-f,l=m-c,u=f+_/2,x=c+l/2;this._bounds=new g(u,x,_,l)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(){this._offsets||(this._offsets={topLeft:[0,0],topRight:[0,0],bottomLeft:[0,0],bottomRight:[0,0]});const t=s(o(),this._rotationT,this._transform);this._offsets.topLeft[0]=this._data[0],this._offsets.topLeft[1]=this._data[1],this._offsets.topRight[0]=this._data[2],this._offsets.topRight[1]=this._data[3],this._offsets.bottomLeft[0]=this._data[4],this._offsets.bottomLeft[1]=this._data[5],this._offsets.bottomRight[0]=this._data[6],this._offsets.bottomRight[1]=this._data[7],n(this._offsets.topLeft,this._offsets.topLeft,t),n(this._offsets.topRight,this._offsets.topRight,t),n(this._offsets.bottomLeft,this._offsets.bottomLeft,t),n(this._offsets.bottomRight,this._offsets.bottomRight,t)}_setTextureCoords({x:t,y:s,width:i,height:e}){this._texcoords={topLeft:[t,s],topRight:[t+i,s],bottomLeft:[t,s+e],bottomRight:[t+i,s+e]}}}const M=(t,s)=>({code:0,page:0,sdf:!0,rect:new m(0,0,11,8),textureBinding:s,metrics:{advance:0,height:4,width:t,left:0,top:0}});function R(t,s){return t.forEach((t=>n(t,t,s))),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class B{constructor(t,s,i){this._rotation=0,this._decorate(t,s,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=s.length>1,this._hasRotation=0!==i.angle,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSizePx=i.borderLineSizePx,(i.borderLineSizePx||i.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const e of t)e.setTransform(this._transform)}setRotation(i){if(0===i&&0===this._rotation)return;this._rotation=i;const e=this._transform,h=t(o(),i);s(e,h,e);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,s,i){if(!i.decoration||"none"===i.decoration||!t.length)return;const e=i.scale,o="underline"===i.decoration?u:x,h=t[0].textureBinding;for(const n of s){const s=n.startX*e,i=n.startY*e,r=(n.width+n.glyphWidthEnd)*e;t.push(new L(s,i+o*e,M(r,h),1))}}shapeBackground(t){const s=this._borderLineSizePx||0,i=(w+s)/2,e=this._borderLineSizePx?i:0,{xmin:o,ymin:h,xmax:n,ymax:r,x:a,y:f,width:c,height:d}=this.bounds,m=[o-y,h-y],_=[n+y,h-y],l=[o-y,r+y],u=[n+y,r+y],x=R([[m[0]-i,m[1]-i],[_[0]+i,_[1]-i],[m[0]+e,m[1]+e],[_[0]-e,_[1]+e]],t),p=R([[l[0]+e,l[1]-e],[u[0]-e,u[1]-e],[l[0]-i,l[1]+i],[u[0]+i,u[1]+i]],t),b=R([[m[0]-i,m[1]-i],[m[0]+e,m[1]+e],[l[0]-i,l[1]+i],[l[0]+e,l[1]-e]],t),L=R([[_[0]-e,_[1]+e],[_[0]+i,_[1]-i],[u[0]-e,u[1]-e],[u[0]+i,u[1]+i]],t),M={main:R([m,_,l,u],t),top:x,bot:p,left:b,right:L};return[new g(a,f,c+2*i,d+2*i),M]}get boundsT(){const t=this.bounds,s=r(a(),t.x,t.y);if(n(s,s,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new g(s[0],s[1],i,i)}return new g(s[0],s[1],t.width,t.height)}_createBounds(t){let s=1/0,i=1/0,e=0,o=0;for(const r of t)s=Math.min(s,r.xTopLeft),i=Math.min(i,r.yTopLeft),e=Math.max(e,r.xBottomRight),o=Math.max(o,r.yBottomRight);const h=e-s,n=o-i;return new g(s+h/2,i+n/2,h,n)}_createGlyphTransform(t,s){const h=b*s.angle,n=o(),f=a();return i(n,n,r(f,s.xOffset,-s.yOffset)),s.useCIMAngleBehavior?e(n,n,h):(i(n,n,r(f,t.x,t.y)),e(n,n,h),i(n,n,r(f,-t.x,-t.y))),n}}class T{constructor(t,s,i,e,o,h){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(s,i)),this.end=Math.max(0,Math.max(s,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=e,this.yMin=o,this.yMax=h}}const v=t=>10===t,j=t=>32===t;function A(t,s,i){const e=new Array,o=1/i.scale,h=i.maxLineWidth*o,n=s?t.length-1:0,r=s?-1:t.length,a=s?-1:1;let f=n,c=0,d=0,m=f,g=m,_=0,l=1/0,u=0;for(;f!==r;){const{code:s,metrics:i}=t[f],o=Math.abs(i.top);if(v(s)||j(s)||(l=Math.min(l,o),u=Math.max(u,o+i.height)),v(s))f!==n&&(e.push(new T(t,m,f-a,c,l===1/0?0:l,u)),l=1/0,u=0),c=0,m=f+a,g=f+a,d=0;else if(j(s))g=f+a,d=0,_=i.advance,c+=i.advance;else if(c>h){if(g!==m){const s=g-2*a;c-=_,e.push(new T(t,m,s,c-d,l,u)),l=1/0,u=0,m=g,c=d}else e.push(new T(t,m,f-a,c,l,u)),l=1/0,u=0,m=f,g=f,c=0;c+=i.advance,d+=i.advance}else c+=i.advance,d+=i.advance;f+=a}const x=new T(t,m,f-a,c,l,u);return x.start>=0&&x.end<t.length&&e.push(x),e}function z(t,s){let i=0;for(let h=0;h<t.length;h++){const{width:s}=t[h];i=Math.max(s,i)}const e="underline"===s.decoration?l:0,o=t[0].yMin;return{x:0,y:o,height:t[t.length-1].yMax+s.lineHeight*(t.length-1)+e-o,width:i}}function O(t,s){const i=s.scale,e=new Array,{glyphs:o,isRightToLeft:h}=t,n=A(o,h,s),r=n.length?z(n,s):{x:0,y:0,height:0,width:0},a=f(s.horizontalAlignment),m=c(s.verticalAlignment),g=m===d.Baseline?1:0,l=g?0:m-1,u=(1-g)*-r.y+l*(r.height/2)+(g?1:0)*-_;for(let f=0;f<n.length;f++){const{start:h,end:r,width:c}=n[f];let d=-1*(a+1)*(c/2)-p;const m=(t.isRightToLeft?n.length-1-f:f)*s.lineHeight+u-p;n[f].startX=d,n[f].startY=m;for(let t=h;t<=r;t++){const s=o[t];if(v(s.code))continue;const h=new L(d+s.metrics.left,m-s.metrics.top,s,i);d+=s.metrics.advance,e.push(h)}}return new B(e,n,s)}export{L as ShapedGlyph,B as ShapingInfo,O as shapeGlyphs};
5
+ import{fromRotation as t,multiply as s,translate as i,rotate as e}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o,transformMany as h}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as f,getYAnchorDirection as c,VAlign as d}from"../../alignmentUtils.js";import m from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const _=22,l=4,u=_+l,x=_-6,p=3,b=Math.PI/180,y=8,w=1.5;class L{constructor(t,s,i,e){this._rotationT=o(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const h=i.rect,n=new Float32Array(8);t*=e,s*=e;const r=i.code?h.width*e:i.metrics.width,a=i.code?h.height*e:i.metrics.height;this.width=r,this.height=a,n[0]=t,n[1]=s,n[2]=t+r,n[3]=s,n[4]=t,n[5]=s+a,n[6]=t+r,n[7]=s+a,this._data=n,this._setTextureCoords(h),this._scale=e,this._mosaic=i,this.x=t,this.y=s,this.maxOffset=Math.max(t+r,s+a)}get mosaic(){return this._mosaic}set angle(s){this._angle=s,t(this._rotationT,-s),this._setOffsets()}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:i}=this._mosaic.metrics,e=i*this._scale,n=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+e,r[3]=this.y,r[4]=this.x,r[5]=this.y+n,r[6]=this.x+e,r[7]=this.y+n;const a=s(o(),this._rotationT,this._transform);h(r,r,a);let f=1/0,c=1/0,d=-1/0,m=-1/0;for(let s=0;s<4;s++){const t=r[2*s],i=r[2*s+1];f=Math.min(f,t),c=Math.min(c,i),d=Math.max(d,t),m=Math.max(m,i)}const _=d-f,l=m-c,u=f+_/2,x=c+l/2;this._bounds=new g(u,x,_,l)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(){this._offsets||(this._offsets={topLeft:[0,0],topRight:[0,0],bottomLeft:[0,0],bottomRight:[0,0]});const t=s(o(),this._rotationT,this._transform);this._offsets.topLeft[0]=this._data[0],this._offsets.topLeft[1]=this._data[1],this._offsets.topRight[0]=this._data[2],this._offsets.topRight[1]=this._data[3],this._offsets.bottomLeft[0]=this._data[4],this._offsets.bottomLeft[1]=this._data[5],this._offsets.bottomRight[0]=this._data[6],this._offsets.bottomRight[1]=this._data[7],n(this._offsets.topLeft,this._offsets.topLeft,t),n(this._offsets.topRight,this._offsets.topRight,t),n(this._offsets.bottomLeft,this._offsets.bottomLeft,t),n(this._offsets.bottomRight,this._offsets.bottomRight,t)}_setTextureCoords({x:t,y:s,width:i,height:e}){this._texcoords={topLeft:[t,s],topRight:[t+i,s],bottomLeft:[t,s+e],bottomRight:[t+i,s+e]}}}const M=(t,s)=>({code:0,page:0,sdf:!0,rect:new m(0,0,11,8),textureBinding:s,metrics:{advance:0,height:4,width:t,left:0,top:0}});function R(t,s){return t.forEach((t=>n(t,t,s))),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class B{constructor(t,s,i){this._rotation=0,this._decorate(t,s,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=s.length>1,this._hasRotation=0!==i.angle,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSizePx=i.borderLineSizePx,(i.borderLineSizePx||i.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const e of t)e.setTransform(this._transform)}setRotation(i){if(0===i&&0===this._rotation)return;this._rotation=i;const e=this._transform,h=t(o(),i);s(e,h,e);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,s,i){if(!i.decoration||"none"===i.decoration||!t.length)return;const e=i.scale,o="underline"===i.decoration?u:x,h=t[0].textureBinding;for(const n of s){const s=n.startX*e,i=n.startY*e,r=(n.width+n.glyphWidthEnd)*e;t.push(new L(s,i+o*e,M(r,h),1))}}shapeBackground(t){const s=this._borderLineSizePx||0,i=(w+s)/2,e=this._borderLineSizePx?i:0,{xmin:o,ymin:h,xmax:n,ymax:r,x:a,y:f,width:c,height:d}=this.bounds,m=[o-y,h-y],_=[n+y,h-y],l=[o-y,r+y],u=[n+y,r+y],x=R([[m[0]-i,m[1]-i],[_[0]+i,_[1]-i],[m[0]+e,m[1]+e],[_[0]-e,_[1]+e]],t),p=R([[l[0]+e,l[1]-e],[u[0]-e,u[1]-e],[l[0]-i,l[1]+i],[u[0]+i,u[1]+i]],t),b=R([[m[0]-i,m[1]-i],[m[0]+e,m[1]+e],[l[0]-i,l[1]+i],[l[0]+e,l[1]-e]],t),L=R([[_[0]-e,_[1]+e],[_[0]+i,_[1]-i],[u[0]-e,u[1]-e],[u[0]+i,u[1]+i]],t),M={main:R([m,_,l,u],t),top:x,bot:p,left:b,right:L};return[new g(a,f,c+2*i,d+2*i),M]}get boundsT(){const t=this.bounds,s=r(a(),t.x,t.y);if(n(s,s,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new g(s[0],s[1],i,i)}return new g(s[0],s[1],t.width,t.height)}_createBounds(t){let s=1/0,i=1/0,e=0,o=0;for(const r of t)s=Math.min(s,r.xTopLeft),i=Math.min(i,r.yTopLeft),e=Math.max(e,r.xBottomRight),o=Math.max(o,r.yBottomRight);const h=e-s,n=o-i;return new g(s+h/2,i+n/2,h,n)}_createGlyphTransform(t,s){const h=b*s.angle,n=o(),f=a();return i(n,n,r(f,s.xOffset,-s.yOffset)),s.useCIMAngleBehavior?e(n,n,h):(i(n,n,r(f,t.x,t.y)),e(n,n,h),i(n,n,r(f,-t.x,-t.y))),n}}class T{constructor(t,s,i,e,o,h){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(s,i)),this.end=Math.max(0,Math.max(s,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=e,this.yMin=o,this.yMax=h}}const v=t=>10===t,j=t=>32===t;function A(t,s,i){const e=new Array,o=1/i.scale,h=i.maxLineWidth*o,n=s?t.length-1:0,r=s?-1:t.length,a=s?-1:1;let f=n,c=0,d=0,m=f,g=m,_=0,l=1/0,u=0;for(;f!==r;){const{code:s,metrics:i}=t[f],o=Math.abs(i.top);if(v(s)||j(s)||(l=Math.min(l,o),u=Math.max(u,o+i.height)),v(s))f!==n&&(e.push(new T(t,m,f-a,c,l===1/0?0:l,u)),l=1/0,u=0),c=0,m=f+a,g=f+a,d=0;else if(j(s))g=f+a,d=0,_=i.advance,c+=i.advance;else if(c>h){if(g!==m){const s=g-2*a;c-=_,e.push(new T(t,m,s,c-d,l,u)),l=1/0,u=0,m=g,c=d}else e.push(new T(t,m,f-a,c,l,u)),l=1/0,u=0,m=f,g=f,c=0;c+=i.advance,d+=i.advance}else c+=i.advance,d+=i.advance;f+=a}const x=new T(t,m,f-a,c,l,u);return x.start>=0&&x.end<t.length&&e.push(x),e}function z(t,s){let i=0;for(let h=0;h<t.length;h++){const{width:s}=t[h];i=Math.max(s,i)}const e="underline"===s.decoration?l:0,o=t[0].yMin;return{x:0,y:o,height:t[t.length-1].yMax+s.lineHeight*(t.length-1)+e-o,width:i}}function O(t,s){const i=s.scale,e=new Array,{glyphs:o,isRightToLeft:h}=t,n=A(o,h,s),r=n.length?z(n,s):{x:0,y:0,height:0,width:0},a=f(s.horizontalAlignment),m=c(s.verticalAlignment),g=m===d.Baseline?1:0,_=g?0:m-1,l=(1-g)*-r.y+_*(r.height/2)+-22*(g?1:0);for(let f=0;f<n.length;f++){const{start:h,end:r,width:c}=n[f];let d=-1*(a+1)*(c/2)-p;const m=(t.isRightToLeft?n.length-1-f:f)*s.lineHeight+l-p;n[f].startX=d,n[f].startY=m;for(let t=h;t<=r;t++){const s=o[t];if(v(s.code))continue;const h=new L(d+s.metrics.left,m-s.metrics.top,s,i);d+=s.metrics.advance,e.push(h)}}return new B(e,n,s)}export{L as ShapedGlyph,B as ShapingInfo,O as shapeGlyphs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{dot as t,normalize as u,clamp as n,Float as r,length as i,distance as y,abs as s,step as l,Mat3 as c,Vec3 as e,and as a,greaterThan as o,lessThan as p,cond as x,min as m,not as b,equal as d}from"../../graph/glsl.js";import{epsilonHitTest as w}from"./constants.js";import{cross2 as f}from"./utils.js";function v(n,r){return t(n,u(r))}function j(t,u,s){const l=s.subtract(u),c=v(t.subtract(u),l),e=n(c.divide(i(l)),new r(0),new r(1));return y(t,u.add(e.multiply(s.subtract(u))))}function g(t){const u=s(t);return l(u.x.add(u.y).add(u.z),new r(1.05))}function h(t,u,n,i){const y=new c(n.x.multiply(i.y).subtract(i.x.multiply(n.y)),i.x.multiply(u.y).subtract(u.x.multiply(i.y)),u.x.multiply(n.y).subtract(n.x.multiply(u.y)),n.y.subtract(i.y),i.y.subtract(u.y),u.y.subtract(n.y),i.x.subtract(n.x),u.x.subtract(i.x),n.x.subtract(u.x)),s=u.x.multiply(n.y.subtract(i.y)),l=n.x.multiply(i.y.subtract(u.y)),a=i.x.multiply(u.y.subtract(n.y)),o=s.add(l).add(a);return new r(1).divide(o).multiply(y.multiply(new e(1,t)))}function M(t,u,n,i){return d(g(h(t,u,n,i)),new r(1))}function P(t,u,n,i){const y=n.subtract(u),s=i.subtract(u),l=f(y,s),c=a(p(l,new r(w)),o(l,new r(-w)));return x([a(b(c),M(t.xy,u,n,i)),new r(-1)],[!0,()=>{const r=j(t,u,n),y=j(t,n,i),s=j(t,i,u);return m(m(r,y),s)}])}function q(t){return t.distance.add(1)}function z(t,u,n){const{viewMat3:r,tileMat3:i}=t.view,y=r.multiply(i),s=y.multiply(new e(u.pos,1)),l=y.multiply(new e(n.nextPos1,1)),c=y.multiply(new e(n.nextPos2,1));return P(t.hittestRequest.position,s.xy,l.xy,c.xy)}function R(t,u,n){return y(t,n).subtract(u)}export{j as distPointSegment,P as distPointTriangle,q as failHittest,z as hittestFill,R as hittestMarker,g as inTriangle,v as projectScalar,h as xyToBarycentric};
5
+ import{dot as t,normalize as u,clamp as n,Float as r,length as i,distance as y,abs as s,step as l,Mat3 as c,Vec3 as e,and as a,greaterThan as o,lessThan as p,cond as x,min as m,not as b,equal as d}from"../../graph/glsl.js";import{epsilonHitTest as w}from"./constants.js";import{cross2 as f}from"./utils.js";function v(n,r){return t(n,u(r))}function j(t,u,s){const l=s.subtract(u),c=v(t.subtract(u),l),e=n(c.divide(i(l)),new r(0),new r(1));return y(t,u.add(e.multiply(s.subtract(u))))}function g(t){const u=s(t);return l(u.x.add(u.y).add(u.z),new r(1.05))}function h(t,u,n,i){const y=new c(n.x.multiply(i.y).subtract(i.x.multiply(n.y)),i.x.multiply(u.y).subtract(u.x.multiply(i.y)),u.x.multiply(n.y).subtract(n.x.multiply(u.y)),n.y.subtract(i.y),i.y.subtract(u.y),u.y.subtract(n.y),i.x.subtract(n.x),u.x.subtract(i.x),n.x.subtract(u.x)),s=u.x.multiply(n.y.subtract(i.y)),l=n.x.multiply(i.y.subtract(u.y)),a=i.x.multiply(u.y.subtract(n.y)),o=s.add(l).add(a);return new r(1).divide(o).multiply(y.multiply(new e(1,t)))}function M(t,u,n,i){return d(g(h(t,u,n,i)),new r(1))}function P(t,u,n,i){const y=n.subtract(u),s=i.subtract(u),l=f(y,s),c=a(p(l,new r(w)),o(l,new r(-.05)));return x([a(b(c),M(t.xy,u,n,i)),new r(-1)],[!0,()=>{const r=j(t,u,n),y=j(t,n,i),s=j(t,i,u);return m(m(r,y),s)}])}function q(t){return t.distance.add(1)}function z(t,u,n){const{viewMat3:r,tileMat3:i}=t.view,y=r.multiply(i),s=y.multiply(new e(u.pos,1)),l=y.multiply(new e(n.nextPos1,1)),c=y.multiply(new e(n.nextPos2,1));return P(t.hittestRequest.position,s.xy,l.xy,c.xy)}function R(t,u,n){return y(t,n).subtract(u)}export{j as distPointSegment,P as distPointTriangle,q as failHittest,z as hittestFill,R as hittestMarker,g as inTriangle,v as projectScalar,h as xyToBarycentric};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{GridCell as a}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{WithDisplayId as u}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as h}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilter.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as g}from"../support/FeatureSetReaderJSON.js";import _ from"../../../tiling/TileKey.js";const m=128;class y extends d{constructor(e){super(e),this.didSend=!1,this.done=!1}}class S{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new _(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=l(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const i=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null,c=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=u)if(1===u){const n=new s([],[e,i]),l=new t(n,o.inner.getAttributes(),null,c,h);l.geometry.coords[0]-=r,a.push(l);const d=new s([],[e,i]),u=new t(d,o.inner.getAttributes(),null,c,h);u.geometry.coords[0]+=r,a.push(u)}else e>r+r/2?e-=u*r:e<-r/2&&(e+=u*r);if(e<r+m&&e>=-m&&i<r+m&&i>=-m){const r=new s([],[e,i]),n=new t(r,o.inner.getAttributes(),null,c,h);a.push(n)}}return g.fromOptimizedFeatures(a,i,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count));const s=[];for(const a of this._clusters.values())s.push(a.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const l of t){if(n.has(l.id))continue;if(l.gridX<e.xMin||l.gridX>e.xMax||l.gridY<e.yMin||l.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(l.id),s=new u(l.clone(),t);n.add(l.id),this._clusters.set(l.id,s);const o=l.centroidXWorld,d=l.centroidYWorld;for(let e=l.gridY-r;e<=l.gridY+r;e++)for(let t=l.gridX-r;t<=l.gridX+r;t++){if(e===l.gridY&&t===l.gridX)continue;const r=this._cells.get(a.createId(t,e));if(!r||n.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),c=Math.abs(r.centroidYWorld-d);u<i&&c<i&&(s.inner.merge(r),n.add(r.id))}}for(const a of s)this._store.releaseDisplayIdForObjectId(a)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class x extends o{static async create(e,t,s,i,r,a){const l=new h({spatialReference:s}),o={type:"grid",fields:await Promise.all(t.fields.map((async e=>n.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await p.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:a};return new x(e,t.clusterRadius,o,t.fields,i,r)}constructor(e,t,s,r,n,a){super(n,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=f.createFeature({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new y(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const{firstObjectId:e}=a.inner,t=e?i.get(e):null;if(null!=t){const n=s(a.displayId,t,e);r.push(n),i.delete(e)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new S(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{y as ClusterState,x as ClusterStrategy};
5
+ import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{GridCell as a}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{WithDisplayId as u}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as h}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilter.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as g}from"../support/FeatureSetReaderJSON.js";import _ from"../../../tiling/TileKey.js";const m=128;class y extends d{constructor(e){super(e),this.didSend=!1,this.done=!1}}class S{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new _(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=l(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const i=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null,c=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=u)if(1===u){const n=new s([],[e,i]),l=new t(n,o.inner.getAttributes(),null,c,h);l.geometry.coords[0]-=r,a.push(l);const d=new s([],[e,i]),u=new t(d,o.inner.getAttributes(),null,c,h);u.geometry.coords[0]+=r,a.push(u)}else e>r+r/2?e-=u*r:e<-256&&(e+=u*r);if(e<r+m&&e>=-128&&i<r+m&&i>=-128){const r=new s([],[e,i]),n=new t(r,o.inner.getAttributes(),null,c,h);a.push(n)}}return g.fromOptimizedFeatures(a,i,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count));const s=[];for(const a of this._clusters.values())s.push(a.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const l of t){if(n.has(l.id))continue;if(l.gridX<e.xMin||l.gridX>e.xMax||l.gridY<e.yMin||l.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(l.id),s=new u(l.clone(),t);n.add(l.id),this._clusters.set(l.id,s);const o=l.centroidXWorld,d=l.centroidYWorld;for(let e=l.gridY-r;e<=l.gridY+r;e++)for(let t=l.gridX-r;t<=l.gridX+r;t++){if(e===l.gridY&&t===l.gridX)continue;const r=this._cells.get(a.createId(t,e));if(!r||n.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),c=Math.abs(r.centroidYWorld-d);u<i&&c<i&&(s.inner.merge(r),n.add(r.id))}}for(const a of s)this._store.releaseDisplayIdForObjectId(a)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class x extends o{static async create(e,t,s,i,r,a){const l=new h({spatialReference:s}),o={type:"grid",fields:await Promise.all(t.fields.map((async e=>n.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await p.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:a};return new x(e,t.clusterRadius,o,t.fields,i,r)}constructor(e,t,s,r,n,a){super(n,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=f.createFeature({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new y(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const{firstObjectId:e}=a.inner,t=e?i.get(e):null;if(null!=t){const n=s(a.displayId,t,e);r.push(n),i.delete(e)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new S(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{y as ClusterState,x as ClusterStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,generalizeOptimizedGeometry as i,quantizeOptimizedGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as h}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";class a extends u{static from(t,e,r){return new a(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new a(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}get usedMemory(){return this._current.usedMemory}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){let t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if("esriGeometryPolyline"===this.geometryType&&(t=i(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform.scale[0])),this._cachedGeometry=o(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(h,0),t.coords.push(2*-h,0),void t.lengths.push(3)):2===e?(t.coords.push(2*h,0),t.coords.push(4*-h,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-h*(s-2)?t[i]=o+h*s:o>h*(s-1)&&(t[i]=o-h*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new n([],t);return o(new n,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new n([],r);return o(new n,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{a as GraphicsReader};
5
+ import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,generalizeOptimizedGeometry as i,quantizeOptimizedGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as h}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";class a extends u{static from(t,e,r){return new a(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new a(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}get usedMemory(){return this._current.usedMemory}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){let t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if("esriGeometryPolyline"===this.geometryType&&(t=i(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform.scale[0])),this._cachedGeometry=o(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(h,0),t.coords.push(-1024,0),void t.lengths.push(3)):2===e?(t.coords.push(2*h,0),t.coords.push(-2048,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-h*(s-2)?t[i]=o+h*s:o>h*(s-1)&&(t[i]=o-h*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new n([],t);return o(new n,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new n([],r);return o(new n,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{a as GraphicsReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import i from"../../../Viewpoint.js";import o from"../../../core/Accessor.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Point.js";import{rotateBy as r,translateBy as c,padAndScaleAndRotateBy as m}from"../viewpointUtils.js";import{getGoToDuration as h}from"./duration.js";import p from"./ZoomBox.js";import u from"./actions/Pan.js";import l from"./actions/Pinch.js";import w from"./actions/Rotate.js";const v=10,g=1,d=new i({targetGeometry:new a}),_=[0,0],T=250;let f=class extends o{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new u({navigation:this}),this.rotate=new w({navigation:this}),this.pinch=new l({navigation:this}),this.zoomBox=new p({view:this.view,navigation:this})}destroy(){this.pan=n(this.pan),this.rotate=n(this.rotate),this.pinch=n(this.pinch),this.zoomBox=n(this.zoomBox),this.animationManager=null}begin(){this.stop(),this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(T)}async zoom(t,i=this._getDefaultAnchor()){if(this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(i):this.zoomOut(i);this.setViewpoint(i,t,0,[0,0])}async zoomIn(t){const i=this.view,o=i.constraints.snapToNextScale(i.scale);return this._zoomToScale(o,t)}async zoomOut(t){const i=this.view,o=i.constraints.snapToPreviousScale(i.scale);return this._zoomToScale(o,t)}setViewpoint(t,i,o,n){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,i,o,n),this.end()}setViewpointImmediate(t,i=0,o=[0,0],n=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,n,t,i,o)}continuousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,-g)}))}continuousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,g)}))}resetRotation(){this.view.constraints.rotationEnabled&&(this.view.rotation=0)}continuousPanLeft(){this._continuousPan([-v,0])}continuousPanRight(){this._continuousPan([v,0])}continuousPanUp(){this._continuousPan([0,v])}continuousPanDown(){this._continuousPan([0,-v])}continuousPanVector({x:t,y:i}){this._continuousPan([t*v,i*v])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),null!==this._endTimer&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const i=this.view.viewpoint;this.animationManager?.animateContinuous(i,(i=>{c(i,i,t),this.view.constraints.constrainByGeometry(i)}))}_startTimer(t){return null!==this._endTimer||(this._endTimer=setTimeout((()=>{this._endTimer=null;const t=performance.now()-(this._lastEventTimestamp??0);t<T?this._endTimer=this._startTimer(t):this._set("interacting",!1)}),t)),this._endTimer}_getDefaultAnchor(){const{size:t,padding:{left:i,right:o,top:n,bottom:e}}=this.view;return _[0]=.5*(t[0]-o+i),_[1]=.5*(t[1]-e+n),_}async _zoomToScale(t,i=this._getDefaultAnchor()){const{view:o}=this,{constraints:n,scale:e,viewpoint:s,size:a,padding:r}=o,c=n.canZoomInTo(t),p=n.canZoomOutTo(t);if(!(t<e&&!c||t>e&&!p))return m(d,s,t/e,0,i,a,r),n.constrainByGeometry(d),o.goTo(d,{animate:!0,animationMode:"always",duration:h(),pickClosestTarget:!1})}_scaleRotateTranslateViewpoint(t,i,o,n,e){const{view:s}=this,{size:a,padding:r,constraints:h,scale:p,viewpoint:u}=s,l=p*o,w=h.canZoomInTo(l),v=h.canZoomOutTo(l);return(o<1&&!w||o>1&&!v)&&(o=1),c(u,u,e),m(t,u,o,n,i,a,r),h.constrainByGeometry(t)}};t([e()],f.prototype,"animationManager",void 0),t([e({type:Boolean,readOnly:!0})],f.prototype,"interacting",void 0),t([e()],f.prototype,"pan",void 0),t([e()],f.prototype,"pinch",void 0),t([e()],f.prototype,"rotate",void 0),t([e()],f.prototype,"view",void 0),t([e()],f.prototype,"zoomBox",void 0),f=t([s("esri.views.2d.navigation.MapViewNavigation")],f);const y=f;export{y as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import i from"../../../Viewpoint.js";import o from"../../../core/Accessor.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Point.js";import{rotateBy as r,translateBy as c,padAndScaleAndRotateBy as m}from"../viewpointUtils.js";import{getGoToDuration as h}from"./duration.js";import p from"./ZoomBox.js";import u from"./actions/Pan.js";import l from"./actions/Pinch.js";import w from"./actions/Rotate.js";const v=10,g=1,d=new i({targetGeometry:new a}),_=[0,0],T=250;let f=class extends o{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new u({navigation:this}),this.rotate=new w({navigation:this}),this.pinch=new l({navigation:this}),this.zoomBox=new p({view:this.view,navigation:this})}destroy(){this.pan=n(this.pan),this.rotate=n(this.rotate),this.pinch=n(this.pinch),this.zoomBox=n(this.zoomBox),this.animationManager=null}begin(){this.stop(),this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(T)}async zoom(t,i=this._getDefaultAnchor()){if(this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(i):this.zoomOut(i);this.setViewpoint(i,t,0,[0,0])}async zoomIn(t){const i=this.view,o=i.constraints.snapToNextScale(i.scale);return this._zoomToScale(o,t)}async zoomOut(t){const i=this.view,o=i.constraints.snapToPreviousScale(i.scale);return this._zoomToScale(o,t)}setViewpoint(t,i,o,n){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,i,o,n),this.end()}setViewpointImmediate(t,i=0,o=[0,0],n=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,n,t,i,o)}continuousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,-1)}))}continuousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,g)}))}resetRotation(){this.view.constraints.rotationEnabled&&(this.view.rotation=0)}continuousPanLeft(){this._continuousPan([-10,0])}continuousPanRight(){this._continuousPan([v,0])}continuousPanUp(){this._continuousPan([0,v])}continuousPanDown(){this._continuousPan([0,-10])}continuousPanVector({x:t,y:i}){this._continuousPan([t*v,i*v])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),null!==this._endTimer&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const i=this.view.viewpoint;this.animationManager?.animateContinuous(i,(i=>{c(i,i,t),this.view.constraints.constrainByGeometry(i)}))}_startTimer(t){return null!==this._endTimer||(this._endTimer=setTimeout((()=>{this._endTimer=null;const t=performance.now()-(this._lastEventTimestamp??0);t<T?this._endTimer=this._startTimer(t):this._set("interacting",!1)}),t)),this._endTimer}_getDefaultAnchor(){const{size:t,padding:{left:i,right:o,top:n,bottom:e}}=this.view;return _[0]=.5*(t[0]-o+i),_[1]=.5*(t[1]-e+n),_}async _zoomToScale(t,i=this._getDefaultAnchor()){const{view:o}=this,{constraints:n,scale:e,viewpoint:s,size:a,padding:r}=o,c=n.canZoomInTo(t),p=n.canZoomOutTo(t);if(!(t<e&&!c||t>e&&!p))return m(d,s,t/e,0,i,a,r),n.constrainByGeometry(d),o.goTo(d,{animate:!0,animationMode:"always",duration:h(),pickClosestTarget:!1})}_scaleRotateTranslateViewpoint(t,i,o,n,e){const{view:s}=this,{size:a,padding:r,constraints:h,scale:p,viewpoint:u}=s,l=p*o,w=h.canZoomInTo(l),v=h.canZoomOutTo(l);return(o<1&&!w||o>1&&!v)&&(o=1),c(u,u,e),m(t,u,o,n,i,a,r),h.constrainByGeometry(t)}};t([e()],f.prototype,"animationManager",void 0),t([e({type:Boolean,readOnly:!0})],f.prototype,"interacting",void 0),t([e()],f.prototype,"pan",void 0),t([e()],f.prototype,"pinch",void 0),t([e()],f.prototype,"rotate",void 0),t([e()],f.prototype,"view",void 0),t([e()],f.prototype,"zoomBox",void 0),f=t([s("esri.views.2d.navigation.MapViewNavigation")],f);const y=f;export{y 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import e from"./HighlightOptions.js";var p;let i=p=class extends r{constructor(...o){super(...o),this.name="default",this.options=new e}clone(){return new p({name:this.name,options:this.options.clone()})}};o([s({type:String})],i.prototype,"name",void 0),o([s({type:e})],i.prototype,"options",void 0),i=p=o([t("esri.views.2d.support.HighlightGroup")],i);const c=i;export{c as default};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import t from"./HighlightOptions.js";import p from"../../support/HighlightGroup.js";var e;let i=e=class extends p{constructor(o){super(o),this.options=new t}clone(){return new e({name:this.name,options:this.options.clone()})}};o([r({type:t})],i.prototype,"options",void 0),i=e=o([s("esri.views.2d.support.HighlightGroup")],i);const c=i;export{c 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.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{identity as a,translate as n,scale as i,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as m}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{d as p,n as u,h as f,g as d,i as g}from"../../../../chunks/vec32.js";import{create as h,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as j,sm4d as O,sq4d as w}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as M,shiftRestartTipRadius as R,shiftRestartTipLength as v,shiftRestartArrowOutlineWidth as C,shiftRestartArrowLength as T,shiftRestartTubeRadius as U,shiftRestartTubeFocusMultiplier as _,shiftRestartTipFocusMultiplier as A}from"./sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as E,IsShiftEdgeOnScreenFlag as N}from"./sliceToolUtils.js";import{Manipulator3D as F}from"../../interactive/Manipulator3D.js";import{RenderObject as y}from"../../interactive/RenderObject.js";import{CullFaceOptions as B}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as D,createConeGeometry as L,createPathExtrusionGeometry as P}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as x}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as k}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as q}from"../../../interactive/interfaces.js";var H;!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(H||(H={}));class I extends F{constructor(a,n){const i=new G({width:1,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),s=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),c=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),l=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),m=new k({writeDepth:!1,cullFace:B.Front,renderOccluded:x.Transparent,isDecoration:!0});super({view:a,...S({offsetMode:n,tubeMaterial:s,tipMaterial:c,capMaterial:l,outlineMaterial:m,calloutMaterial:i})}),this._themeHandle=r((()=>a.effectiveTheme.accentColor),(r=>{const o=t(r),a=e.toUnitRGBA(r),n=e.toUnitRGBA(o),p=e.toUnitRGBA(e.blendColors(o,r,.4)),u=e.toUnitRGBA(e.blendColors(o,r,.14));i.setParameters({color:a}),s.setParameters({color:u}),c.setParameters({color:n}),l.setParameters({color:p}),m.setParameters({color:a})}),o)}destroy(){this._themeHandle.remove(),super.destroy()}}function S({offsetMode:e,tubeMaterial:t,tipMaterial:r,capMaterial:o,outlineMaterial:a,calloutMaterial:n}){const i=e===H.CENTER_ON_CALLOUT?M:0,s=[b(i,0,-T/2),b(i,0,T/2)],c=J(s),l=W({vertices:s,padding:0,materials:{tube:t,tip:r,cap:o}}),m=W({vertices:s,padding:C,materials:{tube:a,tip:a,cap:a}}),p=D(n,[[i,0,0],[i-M,0,0]]),u=D(n,[[i,0,0],[i-M,0,0]]);return{renderObjects:[...l.normal.map((e=>new y(e,q.Unfocused|E))),...m.normal.map((e=>new y(e,q.Unfocused|E))),new y(p,q.Unfocused|E|N),...l.focused.map((e=>new y(e,q.Focused|E))),...m.focused.map((e=>new y(e,q.Focused|E))),new y(u,q.Focused|E|N)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[c]},collisionPriority:1,radius:R,state:E}}function W({vertices:e,padding:t,materials:r}){const o=o=>{const M=e.slice(),C=p(j.get(),M[0],M[1]);u(C,C);const T=p(j.get(),M[M.length-1],M[M.length-2]);if(u(T,T),t>0){const e=f(h(),T,-t);M[M.length-1]=d(e,e,M[M.length-1]);const r=f(h(),C,-t);M[0]=d(r,r,M[0])}const E=o?A:1,N=v*E,F=R*E,y=a(O.get());if(t>0){const e=N/4,r=g(j.get(),0,e,0),o=1+t/e;n(y,y,r),i(y,y,g(j.get(),o,o,o)),n(y,y,f(r,r,-1/o))}const B=a(l()),D=b(0,1,0),P=s(l(),m(w.get(),D,T));P[12]=M[M.length-1][0],P[13]=M[M.length-1][1],P[14]=M[M.length-1][2],c(P,P,y);const x=r.tube,k=z(U*(o?_:1)+t,M,x);k.transformation=B;const G=[k],q=r.tip,H=L(q,N,F,24,!1,!1,!0);H.transformation=P,G.push(H);const I=r.cap,S=L(I,N,F,24,!1,!0,!1);S.transformation=P,G.push(S);const W=s(l(),m(w.get(),D,C));return W[12]=M[0][0],W[13]=M[0][1],W[14]=M[0][2],c(W,W,y),G.push(H.instantiate({transformation:W})),G.push(S.instantiate({transformation:W})),G};return{normal:o(!1),focused:o(!0)}}function z(e,t,r){const o=[],a=12;for(let n=0;n<a;n++){const t=n/a*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return P(r,o,t,[],[],!1)}function J(e,t){const r=p(h(),e[e.length-1],e[e.length-2]);u(r,r),f(r,r,v),d(r,r,e[e.length-1]);{const t=p(h(),e[0],e[1]);return u(t,t),f(t,t,v),d(t,t,e[0]),[t,...e,r]}}export{H as OffsetMode,I as ShiftManipulator};
5
+ import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{identity as a,translate as n,scale as i,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as m}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{d as p,n as u,h as f,g as d,i as g}from"../../../../chunks/vec32.js";import{create as h,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as j,sm4d as O,sq4d as w}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as M,shiftRestartTipRadius as R,shiftRestartTipLength as v,shiftRestartArrowOutlineWidth as C,shiftRestartArrowLength as T,shiftRestartTubeRadius as U,shiftRestartTubeFocusMultiplier as _,shiftRestartTipFocusMultiplier as A}from"./sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as E,IsShiftEdgeOnScreenFlag as N}from"./sliceToolUtils.js";import{Manipulator3D as F}from"../../interactive/Manipulator3D.js";import{RenderObject as y}from"../../interactive/RenderObject.js";import{CullFaceOptions as B}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as D,createConeGeometry as L,createPathExtrusionGeometry as P}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as x}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as k}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as q}from"../../../interactive/interfaces.js";var H;!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(H||(H={}));class I extends F{constructor(a,n){const i=new G({width:1,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),s=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),c=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),l=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),m=new k({writeDepth:!1,cullFace:B.Front,renderOccluded:x.Transparent,isDecoration:!0});super({view:a,...S({offsetMode:n,tubeMaterial:s,tipMaterial:c,capMaterial:l,outlineMaterial:m,calloutMaterial:i})}),this._themeHandle=r((()=>a.effectiveTheme.accentColor),(r=>{const o=t(r),a=e.toUnitRGBA(r),n=e.toUnitRGBA(o),p=e.toUnitRGBA(e.blendColors(o,r,.4)),u=e.toUnitRGBA(e.blendColors(o,r,.14));i.setParameters({color:a}),s.setParameters({color:u}),c.setParameters({color:n}),l.setParameters({color:p}),m.setParameters({color:a})}),o)}destroy(){this._themeHandle.remove(),super.destroy()}}function S({offsetMode:e,tubeMaterial:t,tipMaterial:r,capMaterial:o,outlineMaterial:a,calloutMaterial:n}){const i=e===H.CENTER_ON_CALLOUT?M:0,s=[b(i,0,-24),b(i,0,T/2)],c=J(s),l=W({vertices:s,padding:0,materials:{tube:t,tip:r,cap:o}}),m=W({vertices:s,padding:C,materials:{tube:a,tip:a,cap:a}}),p=D(n,[[i,0,0],[i-M,0,0]]),u=D(n,[[i,0,0],[i-M,0,0]]);return{renderObjects:[...l.normal.map((e=>new y(e,q.Unfocused|E))),...m.normal.map((e=>new y(e,q.Unfocused|E))),new y(p,q.Unfocused|E|N),...l.focused.map((e=>new y(e,q.Focused|E))),...m.focused.map((e=>new y(e,q.Focused|E))),new y(u,q.Focused|E|N)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[c]},collisionPriority:1,radius:R,state:E}}function W({vertices:e,padding:t,materials:r}){const o=o=>{const M=e.slice(),C=p(j.get(),M[0],M[1]);u(C,C);const T=p(j.get(),M[M.length-1],M[M.length-2]);if(u(T,T),t>0){const e=f(h(),T,-t);M[M.length-1]=d(e,e,M[M.length-1]);const r=f(h(),C,-t);M[0]=d(r,r,M[0])}const E=o?A:1,N=v*E,F=R*E,y=a(O.get());if(t>0){const e=N/4,r=g(j.get(),0,e,0),o=1+t/e;n(y,y,r),i(y,y,g(j.get(),o,o,o)),n(y,y,f(r,r,-1/o))}const B=a(l()),D=b(0,1,0),P=s(l(),m(w.get(),D,T));P[12]=M[M.length-1][0],P[13]=M[M.length-1][1],P[14]=M[M.length-1][2],c(P,P,y);const x=r.tube,k=z(U*(o?_:1)+t,M,x);k.transformation=B;const G=[k],q=r.tip,H=L(q,N,F,24,!1,!1,!0);H.transformation=P,G.push(H);const I=r.cap,S=L(I,N,F,24,!1,!0,!1);S.transformation=P,G.push(S);const W=s(l(),m(w.get(),D,C));return W[12]=M[0][0],W[13]=M[0][1],W[14]=M[0][2],c(W,W,y),G.push(H.instantiate({transformation:W})),G.push(S.instantiate({transformation:W})),G};return{normal:o(!1),focused:o(!0)}}function z(e,t,r){const o=[],a=12;for(let n=0;n<a;n++){const t=n/a*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return P(r,o,t,[],[],!1)}function J(e,t){const r=p(h(),e[e.length-1],e[e.length-2]);u(r,r),f(r,r,v),d(r,r,e[e.length-1]);{const t=p(h(),e[0],e[1]);return u(t,t),f(t,t,v),d(t,t,e[0]),[t,...e,r]}}export{H as OffsetMode,I as ShiftManipulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as i,clamp as a}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,h as _}from"../../../../chunks/vec32.js";import{fromValues as M,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{screenToCircleAngle as w,getViewshedRotationMatrix as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as E}from"../../interactive/RenderObject.js";import{ManipulatorType as O}from"../../interactive/editingTools/ManipulatorType.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as U}from"../../webgl-engine/lib/Material.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as x}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as P}from"../../../interactive/interfaces.js";class C extends T{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this._handles=o(this._handles),this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const i=Object.values(this._manipulators);return e(i.map((({manipulator:e,side:i})=>x(e,((e,a,o,n,s)=>{const l=k(i,r),c=a.next((t=>({...t,manipulatorType:O.SCALE,side:i}))),u=w(c,this._view,l,r);t(e,u,o)})))))}updateManipulatorsTransform(t){t.arcCentersPoints(J),this._forEachManipulatorInfo((r=>this._updateArcManipulatorTransform(r,t,J[r.side])))}updateManipulatorVisuals(t){this._forEachManipulatorInfo((r=>this._updateArcManipulatorVisuals(r,t)))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const i=[];if(null!=e){const[a,o]=F(r,e,this._unfocusedArcMaterial);i.push(new E(a,P.Unfocused),new E(a.instantiate({material:this._focusedArcMaterial}),P.Focused)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=i,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,a){const o=e.horizontalFieldOfView,n=i(e.verticalFieldOfView/2),s=i(o/2),g=z(r);t.renderLocation=a;const _=f(),M=t=>{h(_,t,_)};M(l(H,i(-90))),g||M(c(H,n));const b=e.farDistanceRenderSpace;let v,j;M(u(H,d(W,b,b,b))),M(p(H,L(r))),M(A(e,H)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const w=m(H,v,j);null!=w&&M(w),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),i=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:i};[[i.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach((([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}}))}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on("focus-changed",(t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))}))),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),i=new S({renderOccluded:U.OccludeAndTransparent,isDecoration:!0,width:e});return this._handles.add(n((()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor)),(t=>i.setParameters({color:t})),s)),i}forEachManipulator(t){Object.values(this._manipulators).forEach((({manipulator:r})=>t(r,O.SCALE)))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach((r=>t(r)))}get test(){return{manipulators:this._manipulators}}}function F(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=z(t),l=i(a((s?n:o)/2,0,15)),c=D(-l/2,l/2,s?1:Math.max(Math.sin(i(90-n/2)),.1));return[y(e,c),c]}function D(t,r,e,i=10){R(i>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const a=r-t;if(a<=0||e<=0){const t=.01;return[M(0,0,t),M(0,0,-t)]}const o=[],n=a/i;for(let s=0;s<i;s++){let a=t+s*n;s===i-1&&(a=r);const l=Math.cos(a)*e,c=Math.sin(a)*e,u=M(l-e,0,c);o.push(u)}return o}function I(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function L(t){return I(t)*B}function z(t){return"left"===t||"right"===t}function G(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function k(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}){const n=g(W,e,r),s=z(t)?a:i,l=_(q,s,o);return v(r,n,l)}const B=Math.PI/2,H=f(),W=b(),q=b(),J={top:b(),bottom:b(),left:b(),right:b()};export{C as FieldOfViewManipulation,D as createArcPolylineVertices,G as flipSide,z as isSideHorizontal,L as sideToRad};
5
+ import t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as i,clamp as a}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,h as _}from"../../../../chunks/vec32.js";import{fromValues as M,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{screenToCircleAngle as w,getViewshedRotationMatrix as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as E}from"../../interactive/RenderObject.js";import{ManipulatorType as O}from"../../interactive/editingTools/ManipulatorType.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as U}from"../../webgl-engine/lib/Material.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as x}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as P}from"../../../interactive/interfaces.js";class C extends T{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this._handles=o(this._handles),this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const i=Object.values(this._manipulators);return e(i.map((({manipulator:e,side:i})=>x(e,((e,a,o,n,s)=>{const l=k(i,r),c=a.next((t=>({...t,manipulatorType:O.SCALE,side:i}))),u=w(c,this._view,l,r);t(e,u,o)})))))}updateManipulatorsTransform(t){t.arcCentersPoints(J),this._forEachManipulatorInfo((r=>this._updateArcManipulatorTransform(r,t,J[r.side])))}updateManipulatorVisuals(t){this._forEachManipulatorInfo((r=>this._updateArcManipulatorVisuals(r,t)))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const i=[];if(null!=e){const[a,o]=F(r,e,this._unfocusedArcMaterial);i.push(new E(a,P.Unfocused),new E(a.instantiate({material:this._focusedArcMaterial}),P.Focused)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=i,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,a){const o=e.horizontalFieldOfView,n=i(e.verticalFieldOfView/2),s=i(o/2),g=z(r);t.renderLocation=a;const _=f(),M=t=>{h(_,t,_)};M(l(H,i(-90))),g||M(c(H,n));const b=e.farDistanceRenderSpace;let v,j;M(u(H,d(W,b,b,b))),M(p(H,L(r))),M(A(e,H)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const w=m(H,v,j);null!=w&&M(w),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),i=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:i};[[i.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach((([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}}))}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on("focus-changed",(t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))}))),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),i=new S({renderOccluded:U.OccludeAndTransparent,isDecoration:!0,width:e});return this._handles.add(n((()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor)),(t=>i.setParameters({color:t})),s)),i}forEachManipulator(t){Object.values(this._manipulators).forEach((({manipulator:r})=>t(r,O.SCALE)))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach((r=>t(r)))}get test(){return{manipulators:this._manipulators}}}function F(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=z(t),l=i(a((s?n:o)/2,0,15)),c=D(-l/2,l/2,s?1:Math.max(Math.sin(i(90-n/2)),.1));return[y(e,c),c]}function D(t,r,e,i=10){R(i>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const a=r-t;if(a<=0||e<=0){return[M(0,0,.01),M(0,0,-.01)]}const o=[],n=a/i;for(let s=0;s<i;s++){let a=t+s*n;s===i-1&&(a=r);const l=Math.cos(a)*e,c=Math.sin(a)*e,u=M(l-e,0,c);o.push(u)}return o}function I(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function L(t){return I(t)*B}function z(t){return"left"===t||"right"===t}function G(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function k(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}){const n=g(W,e,r),s=z(t)?a:i,l=_(q,s,o);return v(r,n,l)}const B=Math.PI/2,H=f(),W=b(),q=b(),J={top:b(),bottom:b(),left:b(),right:b()};export{C as FieldOfViewManipulation,D as createArcPolylineVertices,G as flipSide,z as isSideHorizontal,L as sideToRad};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{i as t,g as r,h as e,s as n,f as s,c as o,n as i,e as f}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../chunks/sphere.js";import{planeFromPoints as u}from"../../support/mathUtils.js";import{geodesicArea as c}from"../../../support/geodesicAreaMeasurementUtils.js";function h(s,o){const i=a(o);t(i,0,0,0);for(let t=0;t<s.length;++t)r(i,i,s[t]);e(i,i,1/s.length);let f=0;for(let t=0;t<s.length;++t)f=Math.max(f,n(i,s[t]));o[3]=Math.sqrt(f)}function g(t,r){if(t.length<3)throw new Error("need at least 3 points to fit a plane");u(t[0],t[1],t[2],r)}function p(t,r){return s(t,r)+t[3]}function m(t,r,e,n){const s=x;return o(s.rings[0][0],t),o(s.rings[0][1],r),o(s.rings[0][2],e),o(s.rings[0][3],t),s.spatialReference=n,c(s)}function j(e,n=null,l=!0){const a=1e-6,u=(t,r)=>{if(0===r[0]&&0===r[1]&&0===r[2])return!1;for(let e=0;e<t.length;++e)if(s(r,t[e])<-a)return!1;return!0};if(0===e.length)return!1;if(1===e.length)return n&&o(n,e[0]),!0;t(y,0,0,0);for(let t=0;t<e.length;++t)r(y,y,e[t]);if(i(y,y),u(e,y))return n&&o(n,y),!0;if(!l)return!1;for(let t=0;t<e.length;++t)for(let r=0;r<e.length;++r)if(t!==r&&(f(y,e[t],e[r]),i(y,y),u(e,y)))return n&&o(n,y),!0;return!1}function M(t){return"mouse"!==t.pointerType||0===t.button}const x={hasM:!1,hasZ:!0,rings:[[l(),l(),l(),l()]],spatialReference:null,type:"polygon"},y=l();export{g as bestFitPlane,h as boundingSphere,j as fitHemisphere,M as isPrimaryPointerAction,p as planePointDistance,m as triangleAreaGeodesic};
5
+ import{i as t,g as r,h as e,s as n,f as s,c as o,n as i,e as f}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../chunks/sphere.js";import{planeFromPoints as u}from"../../support/mathUtils.js";import{geodesicArea as c}from"../../../support/geodesicAreaMeasurementUtils.js";function h(s,o){const i=a(o);t(i,0,0,0);for(let t=0;t<s.length;++t)r(i,i,s[t]);e(i,i,1/s.length);let f=0;for(let t=0;t<s.length;++t)f=Math.max(f,n(i,s[t]));o[3]=Math.sqrt(f)}function g(t,r){if(t.length<3)throw new Error("need at least 3 points to fit a plane");u(t[0],t[1],t[2],r)}function p(t,r){return s(t,r)+t[3]}function m(t,r,e,n){const s=x;return o(s.rings[0][0],t),o(s.rings[0][1],r),o(s.rings[0][2],e),o(s.rings[0][3],t),s.spatialReference=n,c(s)}function j(e,n=null,l=!0){const a=(t,r)=>{if(0===r[0]&&0===r[1]&&0===r[2])return!1;for(let e=0;e<t.length;++e)if(s(r,t[e])<-1e-6)return!1;return!0};if(0===e.length)return!1;if(1===e.length)return n&&o(n,e[0]),!0;t(y,0,0,0);for(let t=0;t<e.length;++t)r(y,y,e[t]);if(i(y,y),a(e,y))return n&&o(n,y),!0;if(!l)return!1;for(let t=0;t<e.length;++t)for(let r=0;r<e.length;++r)if(t!==r&&(f(y,e[t],e[r]),i(y,y),a(e,y)))return n&&o(n,y),!0;return!1}function M(t){return"mouse"!==t.pointerType||0===t.button}const x={hasM:!1,hasZ:!0,rings:[[l(),l(),l(),l()]],spatialReference:null,type:"polygon"},y=l();export{g as bestFitPlane,h as boundingSphere,j as fitHemisphere,M as isPrimaryPointerAction,p as planePointDistance,m as triangleAreaGeodesic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as a}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{signal as e}from"../../../core/signal.js";import{rotate as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{k as h,n as o,h as n,c,l as d,d as l}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as F,fromPoints as f,axis as p}from"../../../geometry/support/axisAngleDegrees.js";import{earth as S}from"../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as m,ensureClouds as E,CubeMapState as D}from"./Clouds.js";import{heightLimit as P}from"./weather.js";class x{constructor(){this.startTime=0,this._data=e(null),this._readChannels=m.RG,this.parallax=new O,this.parallaxNew=new O,this._anchorPoint=_(),this._fadeState=e(A.HIDE),this._fadeFactor=e(1)}get data(){return this._data.value}set data(a){this._data.value=a}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case A.HIDE:return 0;case A.FADE_OUT:return 1-this.fadeFactor;case A.FADE_IN:return this.fadeFactor;case A.SHOW:case A.CROSS_FADE:return 1}}fade(a,e,s){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(H*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),this._updateParallax(a)}_evaluateState(a,t){const e=a.relativeElevation,s=this._updateAnchorPoint(a);(e>1.7*P||e<-P||s>I)&&this.opacity>0?this._startFade(A.HIDE,t):this.isFading||(e>P||e<-.35*P||s>w*I?this.opacity>0&&this._startFade(A.FADE_OUT,t):E(this.data)&&(0===this.opacity?this._startFade(A.FADE_IN,t):this.data.state===D.Ready&&(this.fadeState===A.SHOW?this._startFade(A.CROSS_FADE,t):this._startFade(A.SHOW,t))))}_updateParallax(a){const t=h(a.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-S.radius*S.radius,0))/Math.sqrt(t),f(C,this.parallax.anchorPoint,v),s(this.parallax.transform,i,v[3],p(v)),f(C,this.parallaxNew.anchorPoint,v),s(this.parallaxNew.transform,i,v[3],p(v))}_updateAnchorPoint(a){return o(this._anchorPoint,a.eye),n(this._anchorPoint,this._anchorPoint,S.radius),this.fadeState===A.HIDE&&this.data?.state===D.Ready?(c(this.parallax.anchorPoint,this._anchorPoint),0):d(l(g,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(a,t){switch(this._fadeState.value=a,this.startTime=t,a){case A.CROSS_FADE:this.requestFade(),this._switchReadChannels(),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_IN:this.requestFade(),this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_OUT:this.requestFade();break;case A.SHOW:this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case A.HIDE:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&this.data.state!==D.Ready&&(this.data.state=D.Idle),this.fadeState){case A.CROSS_FADE:c(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=A.SHOW;break;case A.FADE_IN:this._fadeState.value=A.SHOW;break;case A.FADE_OUT:this._fadeState.value=A.HIDE;break;case A.SHOW:case A.HIDE:break;default:a(this.fadeState)}}_switchReadChannels(){this.data?.state===D.Ready&&(this._readChannels=1-this._readChannels,this.data.state=D.Fading)}get isFading(){return this.fadeState===A.FADE_OUT||this.fadeState===A.FADE_IN||this.fadeState===A.CROSS_FADE}}var A;!function(a){a[a.HIDE=0]="HIDE",a[a.FADE_IN=1]="FADE_IN",a[a.SHOW=2]="SHOW",a[a.CROSS_FADE=3]="CROSS_FADE",a[a.FADE_OUT=4]="FADE_OUT"}(A||(A={}));class O{constructor(){this.anchorPoint=_(),this.radiusCurvatureCorrection=0,this.transform=r()}}const C=u(0,0,1),v=F(),g=_(),H=1.25,w=.5,I=2e5;export{x as CloudsParameters,A as FadeState};
5
+ import{neverReached as a}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{signal as e}from"../../../core/signal.js";import{rotate as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{k as h,n as o,h as n,c,l as d,d as l}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as F,fromPoints as f,axis as p}from"../../../geometry/support/axisAngleDegrees.js";import{earth as S}from"../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as m,ensureClouds as E,CubeMapState as D}from"./Clouds.js";import{heightLimit as P}from"./weather.js";class x{constructor(){this.startTime=0,this._data=e(null),this._readChannels=m.RG,this.parallax=new O,this.parallaxNew=new O,this._anchorPoint=_(),this._fadeState=e(A.HIDE),this._fadeFactor=e(1)}get data(){return this._data.value}set data(a){this._data.value=a}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case A.HIDE:return 0;case A.FADE_OUT:return 1-this.fadeFactor;case A.FADE_IN:return this.fadeFactor;case A.SHOW:case A.CROSS_FADE:return 1}}fade(a,e,s){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(H*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),this._updateParallax(a)}_evaluateState(a,t){const e=a.relativeElevation,s=this._updateAnchorPoint(a);(e>1.7*P||e<-1e4||s>I)&&this.opacity>0?this._startFade(A.HIDE,t):this.isFading||(e>P||e<-.35*P||s>w*I?this.opacity>0&&this._startFade(A.FADE_OUT,t):E(this.data)&&(0===this.opacity?this._startFade(A.FADE_IN,t):this.data.state===D.Ready&&(this.fadeState===A.SHOW?this._startFade(A.CROSS_FADE,t):this._startFade(A.SHOW,t))))}_updateParallax(a){const t=h(a.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-S.radius*S.radius,0))/Math.sqrt(t),f(C,this.parallax.anchorPoint,v),s(this.parallax.transform,i,v[3],p(v)),f(C,this.parallaxNew.anchorPoint,v),s(this.parallaxNew.transform,i,v[3],p(v))}_updateAnchorPoint(a){return o(this._anchorPoint,a.eye),n(this._anchorPoint,this._anchorPoint,S.radius),this.fadeState===A.HIDE&&this.data?.state===D.Ready?(c(this.parallax.anchorPoint,this._anchorPoint),0):d(l(g,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(a,t){switch(this._fadeState.value=a,this.startTime=t,a){case A.CROSS_FADE:this.requestFade(),this._switchReadChannels(),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_IN:this.requestFade(),this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_OUT:this.requestFade();break;case A.SHOW:this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case A.HIDE:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&this.data.state!==D.Ready&&(this.data.state=D.Idle),this.fadeState){case A.CROSS_FADE:c(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=A.SHOW;break;case A.FADE_IN:this._fadeState.value=A.SHOW;break;case A.FADE_OUT:this._fadeState.value=A.HIDE;break;case A.SHOW:case A.HIDE:break;default:a(this.fadeState)}}_switchReadChannels(){this.data?.state===D.Ready&&(this._readChannels=1-this._readChannels,this.data.state=D.Fading)}get isFading(){return this.fadeState===A.FADE_OUT||this.fadeState===A.FADE_IN||this.fadeState===A.CROSS_FADE}}var A;!function(a){a[a.HIDE=0]="HIDE",a[a.FADE_IN=1]="FADE_IN",a[a.SHOW=2]="SHOW",a[a.CROSS_FADE=3]="CROSS_FADE",a[a.FADE_OUT=4]="FADE_OUT"}(A||(A={}));class O{constructor(){this.anchorPoint=_(),this.radiusCurvatureCorrection=0,this.transform=r()}}const C=u(0,0,1),v=F(),g=_(),H=1.25,w=.5,I=2e5;export{x as CloudsParameters,A as FadeState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,h as c,g as u,j as l,e as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x,innerAtmosphereDepth as V}from"./atmosphereUtils.js";import{S as w}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as v}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as A,SimpleAtmosphereGeometry as P}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as R}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as y}from"../support/mathUtils.js";import{glLayout as S}from"../support/buffer/glUtil.js";import{newLayout as T}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as q}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as M}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as U}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as F}from"../webgl-engine/lib/glUtil3D.js";import{project as C}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as E}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as O}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as I}from"../../webgl/BufferObject.js";import{TextureWrapMode as D,PrimitiveType as L,Usage as N}from"../../webgl/enums.js";import{Texture as W}from"../../webgl/Texture.js";import{TextureDescriptor as k}from"../../webgl/TextureDescriptor.js";import{vertexCount as G}from"../../webgl/Util.js";const B=128,z=-V,H=0,Q=50,J=()=>1-511/512,K=y([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let X=class extends q{constructor(e){super(e),this._passParameters=new w,this._configuration=new A,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const{view:t,techniques:r}=e,s=g(t.spatialReference),{outerAtmosphereRimWidth:i,radius:o}=s;this._planetRadius=o,this._innerRimFactor=1+z/o,this._middleRimFactor=1+H/o,this._outerRimFactor=1+i/o,this._texV0=H/i,this._texVScale=this._texV1-this._texV0,r.precompile(v,this._configuration),this._configuration.geometry=P.Underground,r.precompile(v,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new k;e.wrapMode=D.CLAMP_TO_EDGE,e.flipped=!0,e.width=1,e.height=512,this._passParameters.texture=new W(r,e,R)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=G(this._vao,"geometry")),this._configuration.geometry=P.Cone;const e=this.techniques.acquire(v,this._configuration);if(!e.compiled)return e.release(),this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(L.TRIANGLES,0,this._vaoCount),e.release()}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=F(r),this._fadeVaoCount=G(this._fadeVao,"geometry")),this._configuration.geometry=P.Underground;const e=this.techniques.acquire(v,this._configuration);if(!e.compiled)return e.release(),this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(L.TRIANGLE_STRIP,0,this._fadeVaoCount),e.release()}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(Q,a),m=i+z;this._passParameters.innerScale=te(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+Q)/o),Y(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=J(),f=K(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>Q){Y(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*B*3),r=new Uint32Array(3*B*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<B;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===B-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=re.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new E(e,U,new Map([["geometry",S(re)]]),new Map([["geometry",I.createVertex(e,N.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u($,s.center,s.v2),c(ee,$,this._outerRimFactor),n(Z,t,$,r),C($,Z,e.projectionMatrix,e.viewport,$),C(ee,Z,e.projectionMatrix,e.viewport,ee),l($,ee)/e.height}};function Y(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}X=e([a("esri.views.3d.environment.MarsAtmosphere")],X);const Z=m(),$=d(),ee=d();function te(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const re=T().vec3f(O.POSITION),se=X;export{se as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,h as c,g as u,j as l,e as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x}from"./atmosphereUtils.js";import{S as V}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as v,SimpleAtmosphereGeometry as A}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as P}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as R}from"../support/mathUtils.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as S}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as T}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as q}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as M}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as U}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as C}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as E}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as O}from"../../webgl/BufferObject.js";import{TextureWrapMode as I,PrimitiveType as D,Usage as L}from"../../webgl/enums.js";import{Texture as N}from"../../webgl/Texture.js";import{TextureDescriptor as W}from"../../webgl/TextureDescriptor.js";import{vertexCount as k}from"../../webgl/Util.js";const G=128,B=-1e4,z=0,H=50,Q=()=>1-511/512,J=R([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let K=class extends T{constructor(e){super(e),this._passParameters=new V,this._configuration=new v,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const{view:t,techniques:r}=e,s=g(t.spatialReference),{outerAtmosphereRimWidth:i,radius:o}=s;this._planetRadius=o,this._innerRimFactor=1+B/o,this._middleRimFactor=1+z/o,this._outerRimFactor=1+i/o,this._texV0=z/i,this._texVScale=this._texV1-this._texV0,r.precompile(w,this._configuration),this._configuration.geometry=A.Underground,r.precompile(w,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new W;e.wrapMode=I.CLAMP_TO_EDGE,e.flipped=!0,e.width=1,e.height=512,this._passParameters.texture=new N(r,e,P)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=k(this._vao,"geometry")),this._configuration.geometry=A.Cone;const e=this.techniques.acquire(w,this._configuration);if(!e.compiled)return e.release(),this.requestRender(q.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLES,0,this._vaoCount),e.release()}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=U(r),this._fadeVaoCount=k(this._fadeVao,"geometry")),this._configuration.geometry=A.Underground;const e=this.techniques.acquire(w,this._configuration);if(!e.compiled)return e.release(),this.requestRender(q.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(D.TRIANGLE_STRIP,0,this._fadeVaoCount),e.release()}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(H,a),m=i+B;this._passParameters.innerScale=ee(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+H)/o),X(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=Q(),f=J(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>H){X(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*G*3),r=new Uint32Array(3*G*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<G;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===G-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=te.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new C(e,M,new Map([["geometry",y(te)]]),new Map([["geometry",O.createVertex(e,L.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u(Z,s.center,s.v2),c($,Z,this._outerRimFactor),n(Y,t,Z,r),F(Z,Y,e.projectionMatrix,e.viewport,Z),F($,Y,e.projectionMatrix,e.viewport,$),l(Z,$)/e.height}};function X(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}K=e([a("esri.views.3d.environment.MarsAtmosphere")],K);const Y=m(),Z=d(),$=d();function ee(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const te=S().vec3f(E.POSITION),re=K;export{re 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as r,rad2deg as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as c}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as h}from"../../../../../core/screenUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as m,fromScaling as g,multiply as f,scale as _,rotate as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as v,d as M,l as b,s as j,e as y,g as R}from"../../../../../chunks/vec32.js";import{clone as w,fromValues as A}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as T,create as I,getNormal as O}from"../../../../../geometry/support/plane.js";import{wrap as C,distance2 as E}from"../../../../../geometry/support/ray.js";import{sv3d as k,sm4d as F}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{ringIndicatorDelayMs as H,rotateIndicatorDirectionBuffer as G,scaleIndicatorDirectionBuffer as z,rotateIndicatorArrowPlacementPercentage as B,ringThickness as q,dragThresholdPx as J,ringRadius as K,innerIndicatorRadius as Q,outerIndicatorRadius as V,ringHeight as W,rotateIndicatorArrowTipRadius as X,rotateIndicatorArrowTipLength as Y,scaleIndicatorOffset1 as Z,scaleIndicatorOffset2 as $,indicatorThickness as tt,geometrySegments as et,rotateIndicatorArcLength as at,ringResetAnimationSpeedFactor as ot,scaleIndicatorArcLength as it}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as st,transformInPlace as nt,createPathExtrusionGeometry as lt}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ct}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as dt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ht}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ut,ManipulatorStateFlags as pt}from"../../../../interactive/interfaces.js";var mt;!function(t){t.ScaleIn=ut.Custom2,t.ScaleOut=ut.Custom3,t.RotateLeft=ut.Custom4,t.RotateRight=ut.Custom5,t.Unlocked=ut.Custom7,t.DelayedFocused=ut.Custom8,t.TouchInput=ut.Custom12}(mt||(mt={}));let gt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}constructor(t){super(t),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([l((()=>{const{adapter:t}=this;return[t.angle,t.scale]}),(()=>this._updateManipulatorTransform()))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=n(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=ht(t,((t,a,i)=>{this._scaleRotateDragData=null;const n=this.adapter.startInteraction(),l={mode:"none",origin:w(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=k.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(x(this.tool.view,T(t.renderLocation,c,I()))).next((t=>{const a=O(t.plane),i=U(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=r(l.angleDir+c,-G,G),l.angle=i;const d=ft(l,t),h=d-this.adapter.scale;if(l.scaleDir=r(l.scaleDir+h,-z,z),this._onScaleChanged(),"none"===l.mode){const a=this.mode||_t(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":n.state.angle=l.initialAngle+i;break;case"scale":n.state.scale=d,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:d,yScale:d})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:d,yScale:d})}}return"end"===t.action&&(this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),n.done()),t})),i.next((()=>{if(n.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(Mt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),l((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),c)])}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(mt.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(mt.RotateLeft|mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut|mt.RotateLeft|mt.RotateRight,!1)}_updateManipulatorTransform(){const t=m(F.get(),this.adapter.angle,A(0,0,1));if(null==t)return;const e=this.getScale(),a=g(F.get(),v(k.get(),e,e,e));this._ringManipulator.modelTransform=f(F.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(et*(e-t)/(2*Math.PI));for(let r=0;r<i+1;r++){const s=t+r*(e-t)/i;o.push(A(a*Math.cos(s),a*Math.sin(s),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,W/2],[-t/2,W/2]],o=this._createMaterial(1),i=(t,e,i=o)=>lt(i,a(e),t,[],[],!1),r=e(K),s=i(r,q),n={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-at,r=e+a,s=e+Math.PI/2-a,c=t(r,s,Q),d=i(c,tt);l.push(c),l.push(t(r,s,V-q/2)),n.left.push(d),n.right.push(d.instantiate());for(let t=0;t<2;t++){const e=0===t,a=S();if(e){_(a,a,[1,-1,1]),D(a,a,-r,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=st(o,Y,0,X,W);nt(i,a),(e?n.left:n.right).push(i)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-it,o=e+a,r=e+Math.PI/2-a,s=t(o,r,V);c.push(i(s,tt))}const d=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),p=e(K+Z),m=e(K+$),g=i(p,tt,d),f=i(m,tt,u),v=e(K-Z),M=e(K-$),b=i(v,tt,d),j=i(M,tt,u);let y=[new L(s,mt.DelayedFocused),new L(s.instantiate({material:h}),pt.None)];this.mode&&"scale"!==this.mode||(y=y.concat([...c.map((t=>new L(t,mt.DelayedFocused|mt.Unlocked))),new L(g,mt.DelayedFocused|mt.ScaleIn),new L(f,mt.DelayedFocused|mt.ScaleIn),new L(b,mt.DelayedFocused|mt.ScaleOut),new L(j,mt.DelayedFocused|mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(y=y.concat([...n.right.map((t=>new L(t.instantiate(),mt.DelayedFocused|mt.Unlocked))),...n.left.map((t=>new L(t,mt.DelayedFocused|mt.RotateLeft))),...n.right.map((t=>new L(t,mt.DelayedFocused|mt.RotateRight)))]));const R=[r,...l];return new P({view:this.tool.view,renderObjects:y,autoScaleRenderObjects:!1,worldOriented:!0,radius:q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:R,direction:A(0,0,1)}})}_createMaterial(t){const e=new dt({cullFace:rt.Back,renderOccluded:ct.Transparent,isDecoration:!0});return this.addHandles(l((()=>a(this.tool.view.effectiveTheme.accentColor,t)),(t=>e.setParameters({color:t})),c)),e}get test(){}};function ft(t,e){const a=M(k.get(),e.renderStart,t.origin),o=M(k.get(),e.renderEnd,t.origin),i=b(a),r=b(o);return 0===i?0:r/i}function _t(t,e,a,o){const{renderStart:i,renderEnd:r}=t,s=Dt(i,o,k.get()),n=Dt(r,o,k.get());if(j(s,n)<J*J)return null;const l=M(k.get(),i,a),c=y(k.get(),l,O(e)),d=i,h=R(k.get(),d,c),u=Dt(a,o,k.get()),p=s,m=Dt(h,o,k.get()),g=M(k.get(),m,p),f=M(k.get(),s,u),_=C(p,g),D=C(u,f);return E(_,n)<E(D,n)?"rotate":"scale"}function Dt(t,e,a){return e.projectToScreen(t,bt),v(a,bt[0],bt[1],0)}var St;function vt(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*ot,1),e(),Math.abs(o-1)<.01?St.STOP:St.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function Mt(t,e,a){let o=0,i=null;const r=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=r,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?St.STOP:St.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}t([u({constructOnly:!0})],gt.prototype,"tool",void 0),t([u({constructOnly:!0})],gt.prototype,"adapter",void 0),t([u({constructOnly:!0})],gt.prototype,"sketchOptions",void 0),t([u()],gt.prototype,"mode",void 0),t([u()],gt.prototype,"_activeAnimation",void 0),t([u()],gt.prototype,"updating",null),gt=t([p("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],gt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(St||(St={}));const bt=h();export{gt as ScaleRotateTransform};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as r,rad2deg as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as c}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as h}from"../../../../../core/screenUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as m,fromScaling as g,multiply as f,scale as _,rotate as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as v,d as M,l as b,s as j,e as y,g as R}from"../../../../../chunks/vec32.js";import{clone as w,fromValues as A}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as T,create as I,getNormal as O}from"../../../../../geometry/support/plane.js";import{wrap as C,distance2 as E}from"../../../../../geometry/support/ray.js";import{sv3d as k,sm4d as F}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{ringIndicatorDelayMs as H,rotateIndicatorDirectionBuffer as G,scaleIndicatorDirectionBuffer as z,rotateIndicatorArrowPlacementPercentage as B,ringThickness as q,dragThresholdPx as J,ringRadius as K,innerIndicatorRadius as Q,outerIndicatorRadius as V,ringHeight as W,rotateIndicatorArrowTipRadius as X,rotateIndicatorArrowTipLength as Y,scaleIndicatorOffset1 as Z,scaleIndicatorOffset2 as $,indicatorThickness as tt,geometrySegments as et,rotateIndicatorArcLength as at,ringResetAnimationSpeedFactor as ot,scaleIndicatorArcLength as it}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as st,transformInPlace as nt,createPathExtrusionGeometry as lt}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ct}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as dt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ht}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ut,ManipulatorStateFlags as pt}from"../../../../interactive/interfaces.js";var mt;!function(t){t.ScaleIn=ut.Custom2,t.ScaleOut=ut.Custom3,t.RotateLeft=ut.Custom4,t.RotateRight=ut.Custom5,t.Unlocked=ut.Custom7,t.DelayedFocused=ut.Custom8,t.TouchInput=ut.Custom12}(mt||(mt={}));let gt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}constructor(t){super(t),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([l((()=>{const{adapter:t}=this;return[t.angle,t.scale]}),(()=>this._updateManipulatorTransform()))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=n(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=ht(t,((t,a,i)=>{this._scaleRotateDragData=null;const n=this.adapter.startInteraction(),l={mode:"none",origin:w(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=k.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(x(this.tool.view,T(t.renderLocation,c,I()))).next((t=>{const a=O(t.plane),i=U(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=r(l.angleDir+c,-.3,G),l.angle=i;const d=ft(l,t),h=d-this.adapter.scale;if(l.scaleDir=r(l.scaleDir+h,-.2,z),this._onScaleChanged(),"none"===l.mode){const a=this.mode||_t(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":n.state.angle=l.initialAngle+i;break;case"scale":n.state.scale=d,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:d,yScale:d})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:d,yScale:d})}}return"end"===t.action&&(this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),n.done()),t})),i.next((()=>{if(n.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(Mt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),l((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),c)])}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(mt.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(mt.RotateLeft|mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut|mt.RotateLeft|mt.RotateRight,!1)}_updateManipulatorTransform(){const t=m(F.get(),this.adapter.angle,A(0,0,1));if(null==t)return;const e=this.getScale(),a=g(F.get(),v(k.get(),e,e,e));this._ringManipulator.modelTransform=f(F.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(et*(e-t)/(2*Math.PI));for(let r=0;r<i+1;r++){const s=t+r*(e-t)/i;o.push(A(a*Math.cos(s),a*Math.sin(s),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,W/2],[-t/2,W/2]],o=this._createMaterial(1),i=(t,e,i=o)=>lt(i,a(e),t,[],[],!1),r=e(K),s=i(r,q),n={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-at,r=e+a,s=e+Math.PI/2-a,c=t(r,s,Q),d=i(c,tt);l.push(c),l.push(t(r,s,V-q/2)),n.left.push(d),n.right.push(d.instantiate());for(let t=0;t<2;t++){const e=0===t,a=S();if(e){_(a,a,[1,-1,1]),D(a,a,-r,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=st(o,Y,0,X,W);nt(i,a),(e?n.left:n.right).push(i)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-it,o=e+a,r=e+Math.PI/2-a,s=t(o,r,V);c.push(i(s,tt))}const d=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),p=e(K+Z),m=e(K+$),g=i(p,tt,d),f=i(m,tt,u),v=e(K-Z),M=e(K-$),b=i(v,tt,d),j=i(M,tt,u);let y=[new L(s,mt.DelayedFocused),new L(s.instantiate({material:h}),pt.None)];this.mode&&"scale"!==this.mode||(y=y.concat([...c.map((t=>new L(t,mt.DelayedFocused|mt.Unlocked))),new L(g,mt.DelayedFocused|mt.ScaleIn),new L(f,mt.DelayedFocused|mt.ScaleIn),new L(b,mt.DelayedFocused|mt.ScaleOut),new L(j,mt.DelayedFocused|mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(y=y.concat([...n.right.map((t=>new L(t.instantiate(),mt.DelayedFocused|mt.Unlocked))),...n.left.map((t=>new L(t,mt.DelayedFocused|mt.RotateLeft))),...n.right.map((t=>new L(t,mt.DelayedFocused|mt.RotateRight)))]));const R=[r,...l];return new P({view:this.tool.view,renderObjects:y,autoScaleRenderObjects:!1,worldOriented:!0,radius:q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:R,direction:A(0,0,1)}})}_createMaterial(t){const e=new dt({cullFace:rt.Back,renderOccluded:ct.Transparent,isDecoration:!0});return this.addHandles(l((()=>a(this.tool.view.effectiveTheme.accentColor,t)),(t=>e.setParameters({color:t})),c)),e}get test(){}};function ft(t,e){const a=M(k.get(),e.renderStart,t.origin),o=M(k.get(),e.renderEnd,t.origin),i=b(a),r=b(o);return 0===i?0:r/i}function _t(t,e,a,o){const{renderStart:i,renderEnd:r}=t,s=Dt(i,o,k.get()),n=Dt(r,o,k.get());if(j(s,n)<J*J)return null;const l=M(k.get(),i,a),c=y(k.get(),l,O(e)),d=i,h=R(k.get(),d,c),u=Dt(a,o,k.get()),p=s,m=Dt(h,o,k.get()),g=M(k.get(),m,p),f=M(k.get(),s,u),_=C(p,g),D=C(u,f);return E(_,n)<E(D,n)?"rotate":"scale"}function Dt(t,e,a){return e.projectToScreen(t,bt),v(a,bt[0],bt[1],0)}var St;function vt(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*ot,1),e(),Math.abs(o-1)<.01?St.STOP:St.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function Mt(t,e,a){let o=0,i=null;const r=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=r,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?St.STOP:St.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}t([u({constructOnly:!0})],gt.prototype,"tool",void 0),t([u({constructOnly:!0})],gt.prototype,"adapter",void 0),t([u({constructOnly:!0})],gt.prototype,"sketchOptions",void 0),t([u()],gt.prototype,"mode",void 0),t([u()],gt.prototype,"_activeAnimation",void 0),t([u()],gt.prototype,"updating",null),gt=t([p("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],gt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(St||(St={}));const bt=h();export{gt as ScaleRotateTransform};