@arcgis/core 4.24.1 → 4.24.4

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 (33) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{1872276fb7f434c41c09.js → 1d6f79eae87228ba21c9.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{dd51b8f77fd9472c2e54.js → 48576ac3dd2efaa25141.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{b780228a520e1a0b100b.js → 8706454ab4002d4b60f6.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{de5c5c216a804becdaf6.js → a68428fde8bc960da276.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{ed1bb19480397d388fe9.js → d1bc85b78d6f217b022a.js} +1 -1
  7. package/assets/esri/themes/base/widgets/_Editor.scss +6 -0
  8. package/assets/esri/themes/dark/main.css +1 -1
  9. package/assets/esri/themes/light/main.css +1 -1
  10. package/assets/esri/themes/light/view.css +1 -1
  11. package/chunks/BlendLayers.glsl.js +4 -4
  12. package/config.js +1 -1
  13. package/interfaces.d.ts +68 -2
  14. package/layers/support/FeatureReductionBinning.js +1 -1
  15. package/package.json +1 -1
  16. package/support/revision.js +1 -1
  17. package/symbols/support/previewSymbol2D.js +1 -1
  18. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  19. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  20. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  21. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  22. package/views/3d/state/utils/navigationUtils.js +1 -1
  23. package/views/3d/terrain/TerrainSurface.js +1 -1
  24. package/views/3d/terrain/Tile.js +1 -1
  25. package/views/3d/terrain/tileUtils.js +1 -1
  26. package/views/webgl/context-util.js +1 -1
  27. package/widgets/Editor.js +1 -1
  28. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  29. package/widgets/FeatureForm/InputField.js +1 -1
  30. package/widgets/FeatureForm/InputFieldGroup.js +1 -1
  31. package/widgets/FeatureForm.js +1 -1
  32. package/widgets/Legend/LegendViewModel.js +1 -1
  33. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
@@ -6,10 +6,10 @@ import{isSome as e}from"../core/maybe.js";import{LayerBlendMode as o}from"../vie
6
6
  void main() {
7
7
  gl_FragColor = ${y?l`vec4(backgroundColor, 1.0)`:l`gridColor(uv)`};
8
8
  }
9
- `),u;const w=m.blendMode!==o.Normal,x=m.baseOpacityMode===g.OnBaseLayer,L=m.baseOpacityMode===g.OnBackground||m.baseOpacityMode===g.OnBaseLayer;return u.fragment.uniforms.add(new s("tex",(e=>e.texture))),u.fragment.uniforms.add(new n("opacity",(e=>e.opacity))),(w||x)&&(u.fragment.uniforms.add(new s("fboColor",(e=>e.fboTexture))),u.fragment.uniforms.add(new n("tileSize",(o=>e(o.fboTexture)?o.fboTexture.descriptor.width:1)))),u.fragment.include(i,m),u.fragment.code.add(l`
9
+ `),u;const w=m.blendMode!==o.Normal,x=m.baseOpacityMode===g.OnBaseLayer,L=m.baseOpacityMode===g.OnBackground||m.baseOpacityMode===g.OnBaseLayer,T=m.premultipliedSource;return u.fragment.uniforms.add(new s("tex",(e=>e.texture))),u.fragment.uniforms.add(new n("opacity",(e=>e.opacity))),(w||x||T)&&(u.fragment.uniforms.add(new s("fboColor",(e=>e.fboTexture))),u.fragment.uniforms.add(new n("tileSize",(o=>e(o.fboTexture)?o.fboTexture.descriptor.width:1)))),u.fragment.include(i,m),u.fragment.code.add(l`
10
10
  void main() {
11
- ${v||x?l`
12
- vec4 bgColor = ${x?l`texture2D(fboColor, gl_FragCoord.xy / tileSize)`:C?l`vec4(backgroundColor, 1.0)`:l`gridColor(uv)`};
11
+ ${v||x||T?l`
12
+ vec4 bgColor = ${C?l`vec4(backgroundColor, 1.0)`:b?l`gridColor(uv)`:l`texture2D(fboColor, gl_FragCoord.xy / tileSize)`};
13
13
  ${L?l`bgColor *= baseOpacity;`:""}`:""}
14
14
  vec4 colorLayer = texture2D(tex, uv);
15
15
  ${w?l`
@@ -18,6 +18,6 @@ import{isSome as e}from"../core/maybe.js";import{LayerBlendMode as o}from"../vie
18
18
  gl_FragColor = applyBlendMode(colorLayer.rgb, colorLayer.a * opacity, Cb, fboTex.a);`:l`
19
19
  vec4 pmColorLayer = vec4(colorLayer.xyz, 1.0);
20
20
  float composeAlpha = colorLayer.a * opacity;
21
- gl_FragColor = ${v||x?m.premultipliedSource?l`bgColor * (1.0 - composeAlpha) + colorLayer * opacity;`:l`mix(bgColor, pmColorLayer, composeAlpha);`:l`pmColorLayer * composeAlpha;`}`}
21
+ gl_FragColor = ${T?l`bgColor * (1.0 - composeAlpha) + colorLayer * opacity;`:v||x?l`mix(bgColor, pmColorLayer, composeAlpha);`:l`pmColorLayer * composeAlpha;`}`}
22
22
  }
23
23
  `),u}!function(e){e[e.Composite=0]="Composite",e[e.ColorOnly=1]="ColorOnly",e[e.GridOnly=2]="GridOnly",e[e.ColorComposite=3]="ColorComposite",e[e.GridComposite=4]="GridComposite",e[e.COUNT=5]="COUNT"}(c||(c={})),function(e){e[e.One=0]="One",e[e.OnBackground=1]="OnBackground",e[e.OnBaseLayer=2]="OnBaseLayer",e[e.COUNT=3]="COUNT"}(g||(g={}));const u=Object.freeze(Object.defineProperty({__proto__:null,get BlendLayersOutput(){return c},get BaseOpacityMode(){return g},build:m},Symbol.toStringTag,{value:"Module"}));export{c as B,g as a,u as b,m as c};
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const r={apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(r,globalThis.esriConfig,!0),delete r.has),!r.assetsPath){const e="4.24.1";r.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}r.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(r,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),r.request.corsEnabledServers=[],r.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{r as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const r={apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(r,globalThis.esriConfig,!0),delete r.has),!r.assetsPath){const e="4.24.4";r.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}r.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(r,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),r.request.corsEnabledServers=[],r.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{r as default};
package/interfaces.d.ts CHANGED
@@ -20255,6 +20255,12 @@ declare namespace __esri {
20255
20255
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionBinning.html#popupTemplate)
20256
20256
  */
20257
20257
  popupTemplate: PopupTemplate;
20258
+ /**
20259
+ * The renderer used to style the bins.
20260
+ *
20261
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionBinning.html#renderer)
20262
+ */
20263
+ renderer: Renderer;
20258
20264
  /**
20259
20265
  * The feature reduction type.
20260
20266
  *
@@ -20324,6 +20330,12 @@ declare namespace __esri {
20324
20330
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionBinning.html#popupTemplate)
20325
20331
  */
20326
20332
  popupTemplate?: PopupTemplateProperties;
20333
+ /**
20334
+ * The renderer used to style the bins.
20335
+ *
20336
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionBinning.html#renderer)
20337
+ */
20338
+ renderer?: RendererProperties;
20327
20339
  /**
20328
20340
  * The feature reduction type.
20329
20341
  *
@@ -69038,6 +69050,33 @@ declare namespace __esri {
69038
69050
  mapPoint: Point;
69039
69051
  }
69040
69052
 
69053
+ /**
69054
+ * Object specification for the route hit results returned from [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html) in [HitTestResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#HitTestResult) of the [hitTest()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest) method.
69055
+ *
69056
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#RouteHit)
69057
+ */
69058
+ export interface RouteHit extends Object {
69059
+ type: "route";
69060
+ /**
69061
+ * The route layer that contains the element.
69062
+ *
69063
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#RouteHit)
69064
+ */
69065
+ layer: RouteLayer;
69066
+ /**
69067
+ * The point geometry in the spatial reference of the view corresponding with the input screen coordinates.
69068
+ *
69069
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#RouteHit)
69070
+ */
69071
+ mapPoint: Point;
69072
+ /**
69073
+ * The route hit test will contain all intersecting network elements which may include one or more of the following: DirectionLine, DirectionPoint, PointBarrier, PolylineBarrier, PolygonBarrier, Stop, or RouteInfo.
69074
+ *
69075
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#RouteHit)
69076
+ */
69077
+ networkFeature: DirectionLine | DirectionPoint | PointBarrier | PolygonBarrier | PolygonBarrier | RouteInfo | Stop;
69078
+ }
69079
+
69041
69080
  /**
69042
69081
  * An object representing a point on the screen.
69043
69082
  *
@@ -69083,7 +69122,7 @@ declare namespace __esri {
69083
69122
  *
69084
69123
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#ViewHit)
69085
69124
  */
69086
- export type ViewHit = GraphicHit | MediaHit;
69125
+ export type ViewHit = GraphicHit | MediaHit | RouteHit;
69087
69126
 
69088
69127
  interface gamepadGamepadSettings extends Accessor {
69089
69128
  /**
@@ -69709,6 +69748,33 @@ declare namespace __esri {
69709
69748
  mapPoint: Point;
69710
69749
  }
69711
69750
 
69751
+ /**
69752
+ * Object specification for the route hit results returned from [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html) in [HitTestResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#HitTestResult) of the [hitTest()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#hitTest) method.
69753
+ *
69754
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#RouteHit)
69755
+ */
69756
+ export interface SceneViewRouteHit extends Object {
69757
+ type: "route";
69758
+ /**
69759
+ * The route layer that contains the element.
69760
+ *
69761
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#RouteHit)
69762
+ */
69763
+ layer: RouteLayer;
69764
+ /**
69765
+ * The point geometry in the spatial reference of the view corresponding with the input screen coordinates.
69766
+ *
69767
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#RouteHit)
69768
+ */
69769
+ mapPoint: Point;
69770
+ /**
69771
+ * The route hit test will contain all intersecting network elements which may include one or more of the following: DirectionLine, DirectionPoint, PointBarrier, PolylineBarrier, PolygonBarrier, Stop, or RouteInfo.
69772
+ *
69773
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#RouteHit)
69774
+ */
69775
+ networkFeature: DirectionLine | DirectionPoint | PointBarrier | PolygonBarrier | PolygonBarrier | RouteInfo | Stop;
69776
+ }
69777
+
69712
69778
  export interface SceneViewConstraintsProperties extends Object {
69713
69779
  /**
69714
69780
  * Specifies a constraint on the minimum and maximum allowed camera altitude.
@@ -70256,7 +70322,7 @@ declare namespace __esri {
70256
70322
  *
70257
70323
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#ViewHit)
70258
70324
  */
70259
- export type SceneViewViewHit = SceneViewGraphicHit | SceneViewMediaHit;
70325
+ export type SceneViewViewHit = SceneViewGraphicHit | SceneViewMediaHit | SceneViewRouteHit;
70260
70326
 
70261
70327
  export interface HitTestResultGround extends Object {
70262
70328
  /**
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as t}from"../../core/lang.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./AggregateField.js";import{labelsVisible as l,popupEnabled as a}from"./commonProperties.js";import{FeatureReduction as d}from"./FeatureReduction.js";import m from"./LabelClass.js";var u;let c=u=class extends d{constructor(e){super(e),this.type="binning",this.fixedBinLevel=3,this.labelingInfo=null,this.labelsVisible=!0,this.popupEnabled=!0,this.popupTemplate=null,this.fields=[]}clone(){return new u({fields:t(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:t(this.labelingInfo),labelsVisible:this.labelsVisible,popupEnabled:this.popupEnabled,popupTemplate:t(this.popupTemplate),renderer:t(this.renderer)})}};e([i({binning:"binning"})],c.prototype,"type",void 0),e([s({type:Number,json:{write:!0}})],c.prototype,"fixedBinLevel",void 0),e([s({type:[m],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],c.prototype,"labelingInfo",void 0),e([s(l)],c.prototype,"labelsVisible",void 0),e([s(a)],c.prototype,"popupEnabled",void 0),e([s({type:r,json:{name:"popupInfo",write:!0}})],c.prototype,"popupTemplate",void 0),e([s({type:[n],json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],c.prototype,"fields",void 0),e([s({types:o,json:{write:!0}})],c.prototype,"renderer",void 0),c=u=e([p("esri.layers.support.FeatureReductionBinning")],c);const f=c;export{f as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as t}from"../../core/lang.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./AggregateField.js";import{labelsVisible as l,popupEnabled as d}from"./commonProperties.js";import{FeatureReduction as a}from"./FeatureReduction.js";import m from"./LabelClass.js";var u;let c=u=class extends a{constructor(e){super(e),this.type="binning",this.fixedBinLevel=3,this.labelingInfo=null,this.labelsVisible=!0,this.popupEnabled=!0,this.popupTemplate=null,this.fields=[],this.renderer=null}clone(){return new u({fields:t(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:t(this.labelingInfo),labelsVisible:this.labelsVisible,popupEnabled:this.popupEnabled,popupTemplate:t(this.popupTemplate),renderer:t(this.renderer)})}};e([i({binning:"binning"})],c.prototype,"type",void 0),e([s({type:Number,json:{write:!0}})],c.prototype,"fixedBinLevel",void 0),e([s({type:[m],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],c.prototype,"labelingInfo",void 0),e([s(l)],c.prototype,"labelsVisible",void 0),e([s(d)],c.prototype,"popupEnabled",void 0),e([s({type:r,json:{name:"popupInfo",write:!0}})],c.prototype,"popupTemplate",void 0),e([s({type:[n],json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],c.prototype,"fields",void 0),e([s({types:o,json:{write:!0}})],c.prototype,"renderer",void 0),c=u=e([p("esri.layers.support.FeatureReductionBinning")],c);const f=c;export{f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.24.1",
3
+ "version": "4.24.4",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- const b="20220623",c="8e53b079c0bc89b3df424a4c52ba69e6403a5507";export{b as buildDate,c as commitHash};
5
+ const c="20220629",f="424f75793a8d4dbd3ac1b1c1476f478c61e1ff6e";export{c as buildDate,f as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import t from"../../core/Error.js";import{pt2px as a,px2pt as n}from"../../core/screenUtils.js";import{getFill as l,getStroke as s,getPatternUrlWithColor as o}from"./gfxUtils.js";import{SymbolSizeDefaults as i,shapes as c,adjustColorBrightness as r}from"./previewUtils.js";import{renderSymbol as m}from"./renderUtils.js";import{getColorLuminance as u}from"../../views/support/colorUtils.js";const h="picture-fill",p="picture-marker",d="simple-fill",f="simple-line",y="simple-marker",v="text",w="Aa",g=i.size,b=i.maxSize,M=i.maxOutlineSize,k=i.lineWidth,x=225,z=document.createElement("canvas");function L(e,t){const a=z.getContext("2d"),n=[];return t&&(t.weight&&n.push(t.weight),t.size&&n.push(t.size+"px"),t.family&&n.push(t.family)),a.font=n.join(" "),a.measureText(e).width}const j=7.2/2.54,C=72/2.54;function S(e){if(0===e.length)return 0;if(e.length>2){const t=n(1),a=parseFloat(e);switch(e.slice(-2)){case"px":return a;case"pt":return a*t;case"in":return 72*a*t;case"pc":return 12*a*t;case"mm":return a*j*t;case"cm":return a*C*t}}return parseFloat(e)}function F(e){const t=e?.size;return{width:null!=t&&"object"==typeof t&&"width"in t?a(t.width):null,height:null!=t&&"object"==typeof t&&"height"in t?a(t.height):null}}async function U(e,t){const a=t.fill,n=e.color;if("pattern"===a?.type&&n&&e.type!==h){const e=await o(a.src,n.toCss(!0));a.src=e,t.fill=a}}function E(e,t){return e>t?"dark":"light"}function Z(e,t){const n="number"==typeof t?.size?t?.size:null,o=null!=n?a(n):null,i=null!=t?.maxSize?a(t.maxSize):null,r=null!=t?.rotation?t.rotation:"angle"in e?e.angle:null,m=l(e);let u=s(e);"dark"!==D(e,245)||t?.ignoreWhiteSymbols||(u={color:"#bdc3c7",width:.75});const x={shape:null,fill:m,stroke:u,offset:[0,0]};u?.width&&(u.width=Math.min(u.width,M));const z=u?.width||0;let j=null!=t?.size&&(null==t?.scale||t?.scale),C=0,U=0,E=!1;switch(e.type){case y:{const t=e.style,n=Math.min(null!=o?o:a(e.size),i||b);switch(C=n,U=n,t){case"circle":x.shape={type:"circle",cx:0,cy:0,r:.5*n},j||(C+=z,U+=z);break;case"cross":x.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[C,.5*U]},{command:"M",values:[.5*C,0]},{command:"L",values:[.5*C,U]}]};break;case"diamond":x.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*C,0]},{command:"L",values:[C,.5*U]},{command:"L",values:[.5*C,U]},{command:"Z",values:[]}]},j||(C+=z,U+=z);break;case"square":x.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,0]},{command:"L",values:[C,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(C+=z,U+=z),r&&(E=!0);break;case"triangle":x.shape={type:"path",path:[{command:"M",values:[.5*C,0]},{command:"L",values:[C,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(C+=z,U+=z),r&&(E=!0);break;case"x":x.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,U]},{command:"M",values:[C,0]},{command:"L",values:[0,U]}]},r&&(E=!0);break;case"path":x.shape={type:"path",path:e.path||""},j||(C+=z,U+=z),r&&(E=!0),j=!0}break}case f:{const{width:e,height:a}=F(t),n=null!=a?a:Math.min(null!=o?o:z,i||M),l=null!=e?e:k;u.width=n,C=l,U=n;const s=x?.stroke?.cap||"butt",c="round"===s;j=!0,x.stroke.cap="butt"===s?"square":s,x.shape={type:"path",path:[{command:"M",values:[c?n/2:0,U/2]},{command:"L",values:[c?C-n/2:C,U/2]}]};break}case h:case d:{const e="object"==typeof t?.symbolConfig&&t?.symbolConfig.isSquareFill,{width:a,height:n}=F(t);C=e&&null!=a?a:null!=o?o:g,U=e&&null!=n?n:C,j||(C+=z,U+=z),j=!0,x.shape=e?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,0]},{command:"L",values:[C,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:c.fill[0];break}case p:{let t=a(e.width),n=a(e.height);const l=null!=o?o:Math.max(t,n),s=t/n;t=s<=1?Math.ceil(l*s):l,n=s<=1?l:Math.ceil(l/s),C=Math.min(t,i||b),U=Math.min(n,i||b),x.shape={type:"image",x:-Math.round(C/2),y:-Math.round(U/2),width:C,height:U,src:e.url||""},r&&(E=!0);break}case v:{const t=e,n=t.text||w,l=t.font,s=Math.min(null!=o?o:a(l.size),i||b),c=L(n,{weight:l.weight,size:s,family:l.family}),r=/[\uE600-\uE6FF]/.test(n);C=r?s:c,U=s;let m=.25*S((l?s:0).toString());r&&(m+=5),x.shape={type:"text",text:n,x:t.xoffset||0,y:t.yoffset||m,align:"middle",alignBaseline:t.verticalAlignment,decoration:l&&l.decoration,rotated:t.rotated,kerning:t.kerning},x.font=l&&{size:s,style:l.style,decoration:l.decoration,weight:l.weight,family:l.family};break}}return{shapeDescriptor:x,size:[C,U],renderOptions:{node:t?.node,scale:j,opacity:t?.opacity,rotation:r,useRotationSize:E,effectView:t?.effectView}}}async function q(e,a){const{shapeDescriptor:n,size:l,renderOptions:s}=Z(e,a);if(!n.shape)throw new t("symbolPreview: renderPreviewHTML2D","symbol not supported.");await U(e,n);const o=[[n]];if("object"==typeof a?.symbolConfig&&a?.symbolConfig.applyColorModulation){const e=.6*l[0];o.unshift([{...n,offset:[-e,0],fill:r(n.fill,-.3)}]),o.push([{...n,offset:[e,0],fill:r(n.fill,.3)}]),l[0]+=2*e,s.scale=!1}return m(o,l,s)}function D(t,a=x){const n=l(t),o=s(t),i=!n||"type"in n?null:new e(n),c=o?.color?new e(o?.color):null,r=i?E(u(i),a):null,m=c?E(u(c),a):null;return m?r?r===m?r:a>=x?"light":"dark":m:r}export{D as getContrastingBackgroundTheme,Z as getRenderSymbolParameters,q as previewSymbol2D};
5
+ import e from"../../Color.js";import t from"../../core/Error.js";import{pt2px as a,px2pt as n}from"../../core/screenUtils.js";import{getFill as l,getStroke as s,getPatternUrlWithColor as o}from"./gfxUtils.js";import{SymbolSizeDefaults as i,shapes as c,adjustColorBrightness as r}from"./previewUtils.js";import{renderSymbol as m}from"./renderUtils.js";import{getColorLuminance as u}from"../../views/support/colorUtils.js";const h="picture-fill",p="picture-marker",d="simple-fill",f="simple-line",y="simple-marker",v="text",w="Aa",g=i.size,b=i.maxSize,M=i.maxOutlineSize,k=i.lineWidth,x=225,z=document.createElement("canvas");function L(e,t){const a=z.getContext("2d"),n=[];return t&&(t.weight&&n.push(t.weight),t.size&&n.push(t.size+"px"),t.family&&n.push(t.family)),a.font=n.join(" "),a.measureText(e).width}const j=7.2/2.54,C=72/2.54;function S(e){if(0===e.length)return 0;if(e.length>2){const t=n(1),a=parseFloat(e);switch(e.slice(-2)){case"px":return a;case"pt":return a*t;case"in":return 72*a*t;case"pc":return 12*a*t;case"mm":return a*j*t;case"cm":return a*C*t}}return parseFloat(e)}function F(e){const t=e?.size;return{width:null!=t&&"object"==typeof t&&"width"in t?a(t.width):null,height:null!=t&&"object"==typeof t&&"height"in t?a(t.height):null}}async function U(e,t){const a=t.fill,n=e.color;if("pattern"===a?.type&&n&&e.type!==h){const e=await o(a.src,n.toCss(!0));a.src=e,t.fill=a}}function E(e,t){return e>t?"dark":"light"}function Z(e,t){const n="number"==typeof t?.size?t?.size:null,o=null!=n?a(n):null,i=null!=t?.maxSize?a(t.maxSize):null,r=null!=t?.rotation?t.rotation:"angle"in e?e.angle:null,m=l(e);let u=s(e);"dark"!==D(e,245)||t?.ignoreWhiteSymbols||(u={width:.75,...u,color:"#bdc3c7"});const x={shape:null,fill:m,stroke:u,offset:[0,0]};u?.width&&(u.width=Math.min(u.width,M));const z=u?.width||0;let j=null!=t?.size&&(null==t?.scale||t?.scale),C=0,U=0,E=!1;switch(e.type){case y:{const t=e.style,n=Math.min(null!=o?o:a(e.size),i||b);switch(C=n,U=n,t){case"circle":x.shape={type:"circle",cx:0,cy:0,r:.5*n},j||(C+=z,U+=z);break;case"cross":x.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[C,.5*U]},{command:"M",values:[.5*C,0]},{command:"L",values:[.5*C,U]}]};break;case"diamond":x.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*C,0]},{command:"L",values:[C,.5*U]},{command:"L",values:[.5*C,U]},{command:"Z",values:[]}]},j||(C+=z,U+=z);break;case"square":x.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,0]},{command:"L",values:[C,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(C+=z,U+=z),r&&(E=!0);break;case"triangle":x.shape={type:"path",path:[{command:"M",values:[.5*C,0]},{command:"L",values:[C,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(C+=z,U+=z),r&&(E=!0);break;case"x":x.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,U]},{command:"M",values:[C,0]},{command:"L",values:[0,U]}]},r&&(E=!0);break;case"path":x.shape={type:"path",path:e.path||""},j||(C+=z,U+=z),r&&(E=!0),j=!0}break}case f:{const{width:e,height:a}=F(t),n=null!=a?a:Math.min(null!=o?o:z,i||M),l=null!=e?e:k;u.width=n,C=l,U=n;const s=x?.stroke?.cap||"butt",c="round"===s;j=!0,x.stroke.cap="butt"===s?"square":s,x.shape={type:"path",path:[{command:"M",values:[c?n/2:0,U/2]},{command:"L",values:[c?C-n/2:C,U/2]}]};break}case h:case d:{const e="object"==typeof t?.symbolConfig&&t?.symbolConfig.isSquareFill,{width:a,height:n}=F(t);C=e&&null!=a?a:null!=o?o:g,U=e&&null!=n?n:C,j||(C+=z,U+=z),j=!0,x.shape=e?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,0]},{command:"L",values:[C,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:c.fill[0];break}case p:{let t=a(e.width),n=a(e.height);const l=null!=o?o:Math.max(t,n),s=t/n;t=s<=1?Math.ceil(l*s):l,n=s<=1?l:Math.ceil(l/s),C=Math.min(t,i||b),U=Math.min(n,i||b),x.shape={type:"image",x:-Math.round(C/2),y:-Math.round(U/2),width:C,height:U,src:e.url||""},r&&(E=!0);break}case v:{const t=e,n=t.text||w,l=t.font,s=Math.min(null!=o?o:a(l.size),i||b),c=L(n,{weight:l.weight,size:s,family:l.family}),r=/[\uE600-\uE6FF]/.test(n);C=r?s:c,U=s;let m=.25*S((l?s:0).toString());r&&(m+=5),x.shape={type:"text",text:n,x:t.xoffset||0,y:t.yoffset||m,align:"middle",alignBaseline:t.verticalAlignment,decoration:l&&l.decoration,rotated:t.rotated,kerning:t.kerning},x.font=l&&{size:s,style:l.style,decoration:l.decoration,weight:l.weight,family:l.family};break}}return{shapeDescriptor:x,size:[C,U],renderOptions:{node:t?.node,scale:j,opacity:t?.opacity,rotation:r,useRotationSize:E,effectView:t?.effectView}}}async function q(e,a){const{shapeDescriptor:n,size:l,renderOptions:s}=Z(e,a);if(!n.shape)throw new t("symbolPreview: renderPreviewHTML2D","symbol not supported.");await U(e,n);const o=[[n]];if("object"==typeof a?.symbolConfig&&a?.symbolConfig.applyColorModulation){const e=.6*l[0];o.unshift([{...n,offset:[-e,0],fill:r(n.fill,-.3)}]),o.push([{...n,offset:[e,0],fill:r(n.fill,.3)}]),l[0]+=2*e,s.scale=!1}return m(o,l,s)}function D(t,a=x){const n=l(t),o=s(t),i=!n||"type"in n?null:new e(n),c=o?.color?new e(o?.color):null,r=i?E(u(i),a):null,m=c?E(u(c),a):null;return m?r?r===m?r:a>=x?"light":"dark":m:r}export{D as getContrastingBackgroundTheme,Z as getRenderSymbolParameters,q as previewSymbol2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{bidiText as t}from"../../../../../core/BidiText.js";import"../../../../../core/Error.js";import"../../../../../core/has.js";import s from"../../../../../core/Logger.js";import{applySome as r,isNone as i,isSome as a,unwrapOrThrow as o,unwrap as n}from"../../../../../core/maybe.js";import{throwIfAborted as l,isAbortError as c}from"../../../../../core/promiseUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/set.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{diff as h,hasDiff as f}from"../../../../../core/accessorSupport/diffUtils.js";import m from"../../../../../geometry/SpatialReference.js";import{isAggregateId as u}from"../../../engine/webgl/DisplayId.js";import{MeshData as p}from"../../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as g}from"../../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as y}from"../../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as _}from"../../../engine/webgl/util/Matcher.js";import{codepoints as b}from"../textUtils.js";import S from"./BaseProcessor.js";import w from"../support/ResourceManagerProxy.js";function I(e,t){return(!e.minScale||e.minScale>=t)&&(!e.maxScale||e.maxScale<=t)}function v(e){const t=e.message,s={message:{data:{},tileKey:t.tileKey,tileKeyOrigin:t.tileKeyOrigin,version:t.version},transferList:new Array};for(const i in t.data){const e=t.data[i];if(s.message.data[i]=null,a(e)){const t=e.stride,a=e.indices.slice(0),o=e.vertices.slice(0),n=e.records.slice(0),l={stride:t,indices:a,vertices:o,records:n,metrics:r(e.metrics,(e=>e.slice(0)))};s.transferList.push(a,o,n),s.message.data[i]=l}}return s}s.getLogger("esri.views.2d.layers.features.processors.SymbolProcessor");let M=class extends S{constructor(){super(...arguments),this.type="symbol",this._matchers={feature:null,aggregate:null},this._bufferData=new Map,this._bufferIds=new Map}initialize(){this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this))]),this._resourceManagerProxy=new w(this.remoteClient)}destroy(){this._resourceManagerProxy.destroy()}get supportsTileUpdates(){return!0}forEachBufferId(e){this._bufferIds.forEach((t=>{t.forEach(e)}))}async update(e,t){const s=t.schema.processors[0];if("symbol"!==s.type)return;const r=h(this._schema,s);f(r,"mesh")&&(e.mesh=!0,e.why.mesh.push("Symbology changed"),this._schema=s,this._factory=this._createFactory(s),this._factory.update(s,this.tileStore.tileScheme.tileInfo))}onTileMessage(e,t,s,r){return l(r),this._onTileData(e,t,s,r)}onTileClear(e){const t={clear:!0};return this._bufferData.delete(e.key.id),this._bufferIds.delete(e.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t})}onTileError(e,t,s){const r=s.signal,i={tileKey:e.id,error:t};return this.remoteClient.invoke("tileRenderer.onTileError",i,{signal:r})}onTileUpdate(e){for(const t of e.removed)this._bufferData.has(t.key.id)&&this._bufferData.delete(t.key.id),this._bufferIds.has(t.key.id)&&this._bufferIds.delete(t.key.id);for(const t of e.added)this._bufferData.forEach((e=>{for(const s of e)s.message.tileKey===t.id&&this._updateTileMesh("append",t,v(s),[],!1,!1,null)}))}_addBufferData(e,t){this._bufferData.has(e)||this._bufferData.set(e,[]),this._bufferData.get(e).push(v(t))}_createFactory(e){const{geometryType:t,objectIdField:s,fields:i}=this.service,a=(e,t)=>this.remoteClient.invoke("tileRenderer.getMaterialItems",e,t),o={geometryType:t,fields:i,spatialReference:m.fromJSON(this.spatialReference)},n=new y(a,this.tileStore.tileScheme.tileInfo),{matcher:l,aggregateMatcher:c}=e.mesh;return this._store=n,this._matchers.feature=_(l,n,o,this._resourceManagerProxy),this._matchers.aggregate=r(c,(e=>_(e,n,o,this._resourceManagerProxy))),new g(t,s,n)}async _onTileData(e,t,s,r){l(r);const{type:o,addOrUpdate:n,remove:c}=t,d=t.end,h=!!this._schema.mesh.sortKey;if(!n){const t={type:o,addOrUpdate:null,remove:c,clear:!1,end:d,sort:h};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t},r)}const f=this._processFeatures(e,n,s,r,t.status.version);try{const s=await f;if(i(s)){const t={type:o,addOrUpdate:null,remove:c,clear:!1,end:d,sort:h};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t},r)}const n=[];for(const t of s){let s=!1;const r=t.message.bufferIds,i=e.key.id,o=t.message.tileKey;if(i!==o&&a(r)){if(!this.tileStore.get(o)){this._addBufferData(i,t),n.push(t);continue}let e=this._bufferIds.get(o);e||(e=new Set,this._bufferIds.set(o,e));const a=Array.from(r);for(const t of a){if(e.has(t)){s=!0;break}e.add(t)}}s||(this._addBufferData(i,t),n.push(t))}await Promise.all(n.map((s=>{const i=e.key.id===s.message.tileKey,a=i?t.remove:[],n=i&&t.end;return this._updateTileMesh(o,e,s,a,n,t.clear,r.signal)})))}catch(m){this._handleError(e,m,r)}}async _updateTileMesh(e,t,s,i,a,o,c){const d=e,h=s.message.tileKey,f=!!this._schema.mesh.sortKey;h!==t.key.id&&(a=!1);const m=r(s,(e=>e.message)),u=r(s,(e=>e.transferList))||[],p={type:d,addOrUpdate:m,remove:i,clear:o,end:a,sort:f},g={transferList:n(u)||[],signal:c};return l(g),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:h,data:p},g)}async _processFeatures(e,t,s,r,a){if(i(t)||!t.hasFeatures)return null;const o={transform:e.transform,hasZ:!1,hasM:!1},n=this._factory,c={viewingMode:"",scale:e.scale},d=await this._matchers.feature,h=await this._matchers.aggregate;l(r);const f=this._getLabelInfos(e,t);return await n.analyze(t.getCursor(),this._resourceManagerProxy,d,h,o,c),l(r),this._writeFeatureSet(e,t,o,f,n,s,a)}_writeFeatureSet(e,t,s,r,i,o,n){const l=t.getSize(),c=new p(e.key.id,{features:l,records:l,metrics:0},this._schema.mesh.matcher.symbologyType,o,!0,n),d={viewingMode:"",scale:e.scale},h=t.getCursor();for(;h.next();)try{const t=h.getDisplayId(),o=a(r)?r.get(t):null;i.writeCursor(c,h,s,d,e.level,o,this._resourceManagerProxy)}catch(m){}const f=e.tileInfoView.tileInfo.isWrappable;return c.serialize(f)}_handleError(e,t,s){if(!c(t)){const r={tileKey:e.id,error:t.message};return this.remoteClient.invoke("tileRenderer.onTileError",r,{signal:s.signal})}}_getLabelingSchemaForScale(e){const t=this._schema.mesh.labels;if(i(t))return null;if("subtype"===t.type){const s={type:"subtype",classes:{}};let r=!1;for(const i in t.classes){const a=t.classes[i].filter((t=>I(t,e.scale)));r=r||!!a.length,s.classes[i]=a}return r?s:null}const s=t.classes.filter((t=>I(t,e.scale)));return s.length?{type:"simple",classes:s}:null}_getLabels(e,t){if("subtype"===t.type){const s=this.service.subtypeField,r=o(s,"Expected to find subtype Field"),i=e.readAttribute(r);return null==i?[]:t.classes[i]??[]}return t.classes}_getLabelInfos(e,s){const r=this._getLabelingSchemaForScale(e);if(i(r))return null;const a=new Map,o=s.getCursor();for(;o.next();){const e=o.getDisplayId(),s=[],i=u(e),n=i&&1!==o.readAttribute("cluster_count")?"aggregate":"feature",l=this._getLabels(o,r);for(const r of l){if(r.target!==n)continue;const a=o.getStorage(),l=i&&"feature"===n?a.getComputedStringAtIndex(o.readAttribute("referenceId"),r.fieldIndex):a.getComputedStringAtIndex(e,r.fieldIndex);if(!l)continue;const c=t(l.toString()),d=c[0],h=c[1];this._store.getMosaicItem(r.symbol,b(d)).then((e=>{s[r.index]={glyphs:e.glyphMosaicItems,rtl:h,index:r.index}}))}a.set(e,s)}return a}};M=e([d("esri.views.2d.layers.features.processors.SymbolProcessor")],M);const x=M;export{x as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{bidiText as t}from"../../../../../core/BidiText.js";import"../../../../../core/Error.js";import"../../../../../core/has.js";import s from"../../../../../core/Logger.js";import{applySome as r,isNone as i,isSome as a,unwrapOrThrow as o,unwrap as n}from"../../../../../core/maybe.js";import{throwIfAborted as l,isAbortError as c}from"../../../../../core/promiseUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/set.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{diff as h,hasDiff as f}from"../../../../../core/accessorSupport/diffUtils.js";import m from"../../../../../geometry/SpatialReference.js";import{isAggregateId as u}from"../../../engine/webgl/DisplayId.js";import{MeshData as p}from"../../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as g}from"../../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as y}from"../../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as _}from"../../../engine/webgl/util/Matcher.js";import{codepoints as b}from"../textUtils.js";import S from"./BaseProcessor.js";import w from"../support/ResourceManagerProxy.js";function I(e,t){return(!e.minScale||e.minScale>=t)&&(!e.maxScale||e.maxScale<=t)}function v(e){const t=e.message,s={message:{data:{},tileKey:t.tileKey,tileKeyOrigin:t.tileKeyOrigin,version:t.version},transferList:new Array};for(const i in t.data){const e=t.data[i];if(s.message.data[i]=null,a(e)){const t=e.stride,a=e.indices.slice(0),o=e.vertices.slice(0),n=e.records.slice(0),l={stride:t,indices:a,vertices:o,records:n,metrics:r(e.metrics,(e=>e.slice(0)))};s.transferList.push(a,o,n),s.message.data[i]=l}}return s}s.getLogger("esri.views.2d.layers.features.processors.SymbolProcessor");let M=class extends S{constructor(){super(...arguments),this.type="symbol",this._matchers={feature:null,aggregate:null},this._bufferData=new Map,this._bufferIds=new Map}initialize(){this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this))]),this._resourceManagerProxy=new w(this.remoteClient)}destroy(){this._resourceManagerProxy.destroy()}get supportsTileUpdates(){return!0}forEachBufferId(e){this._bufferIds.forEach((t=>{t.forEach(e)}))}async update(e,t){const s=t.schema.processors[0];if("symbol"!==s.type)return;const r=h(this._schema,s);f(r,"mesh")&&(e.mesh=!0,e.why.mesh.push("Symbology changed"),this._schema=s,this._factory=this._createFactory(s),this._factory.update(s,this.tileStore.tileScheme.tileInfo))}onTileMessage(e,t,s,r){return l(r),this._onTileData(e,t,s,r)}onTileClear(e){const t={clear:!0};return this._bufferData.delete(e.key.id),this._bufferIds.delete(e.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t})}onTileError(e,t,s){const r=s.signal,i={tileKey:e.id,error:t};return this.remoteClient.invoke("tileRenderer.onTileError",i,{signal:r})}onTileUpdate(e){for(const t of e.removed)this._bufferData.has(t.key.id)&&this._bufferData.delete(t.key.id),this._bufferIds.has(t.key.id)&&this._bufferIds.delete(t.key.id);for(const t of e.added)this._bufferData.forEach((e=>{for(const s of e)s.message.tileKey===t.id&&this._updateTileMesh("append",t,v(s),[],!1,!1,null)}))}_addBufferData(e,t){this._bufferData.has(e)||this._bufferData.set(e,[]),this._bufferData.get(e).push(v(t))}_createFactory(e){const{geometryType:t,objectIdField:s,fields:i}=this.service,a=(e,t)=>this.remoteClient.invoke("tileRenderer.getMaterialItems",e,t),o={geometryType:t,fields:i,spatialReference:m.fromJSON(this.spatialReference)},n=new y(a,this.tileStore.tileScheme.tileInfo),{matcher:l,aggregateMatcher:c}=e.mesh;return this._store=n,this._matchers.feature=_(l,n,o,this._resourceManagerProxy),this._matchers.aggregate=r(c,(e=>_(e,n,o,this._resourceManagerProxy))),new g(t,s,n)}async _onTileData(e,t,s,r){l(r);const{type:o,addOrUpdate:n,remove:c,clear:d,end:h}=t,f=!!this._schema.mesh.sortKey;if(!n){const t={type:o,addOrUpdate:null,remove:c,clear:d,end:h,sort:f};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t},r)}const m=this._processFeatures(e,n,s,r,t.status.version);try{const s=await m;if(i(s)){const t={type:o,addOrUpdate:null,remove:c,clear:d,end:h,sort:f};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:e.id,data:t},r)}const n=[];for(const t of s){let s=!1;const r=t.message.bufferIds,i=e.key.id,o=t.message.tileKey;if(i!==o&&a(r)){if(!this.tileStore.get(o)){this._addBufferData(i,t),n.push(t);continue}let e=this._bufferIds.get(o);e||(e=new Set,this._bufferIds.set(o,e));const a=Array.from(r);for(const t of a){if(e.has(t)){s=!0;break}e.add(t)}}s||(this._addBufferData(i,t),n.push(t))}await Promise.all(n.map((s=>{const i=e.key.id===s.message.tileKey,a=i?t.remove:[],n=i&&t.end;return this._updateTileMesh(o,e,s,a,n,t.clear,r.signal)})))}catch(u){this._handleError(e,u,r)}}async _updateTileMesh(e,t,s,i,a,o,c){const d=e,h=s.message.tileKey,f=!!this._schema.mesh.sortKey;h!==t.key.id&&(a=!1);const m=r(s,(e=>e.message)),u=r(s,(e=>e.transferList))||[],p={type:d,addOrUpdate:m,remove:i,clear:o,end:a,sort:f},g={transferList:n(u)||[],signal:c};return l(g),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:h,data:p},g)}async _processFeatures(e,t,s,r,a){if(i(t)||!t.hasFeatures)return null;const o={transform:e.transform,hasZ:!1,hasM:!1},n=this._factory,c={viewingMode:"",scale:e.scale},d=await this._matchers.feature,h=await this._matchers.aggregate;l(r);const f=this._getLabelInfos(e,t);return await n.analyze(t.getCursor(),this._resourceManagerProxy,d,h,o,c),l(r),this._writeFeatureSet(e,t,o,f,n,s,a)}_writeFeatureSet(e,t,s,r,i,o,n){const l=t.getSize(),c=new p(e.key.id,{features:l,records:l,metrics:0},this._schema.mesh.matcher.symbologyType,o,!0,n),d={viewingMode:"",scale:e.scale},h=t.getCursor();for(;h.next();)try{const t=h.getDisplayId(),o=a(r)?r.get(t):null;i.writeCursor(c,h,s,d,e.level,o,this._resourceManagerProxy)}catch(m){}const f=e.tileInfoView.tileInfo.isWrappable;return c.serialize(f)}_handleError(e,t,s){if(!c(t)){const r={tileKey:e.id,error:t.message};return this.remoteClient.invoke("tileRenderer.onTileError",r,{signal:s.signal})}}_getLabelingSchemaForScale(e){const t=this._schema.mesh.labels;if(i(t))return null;if("subtype"===t.type){const s={type:"subtype",classes:{}};let r=!1;for(const i in t.classes){const a=t.classes[i].filter((t=>I(t,e.scale)));r=r||!!a.length,s.classes[i]=a}return r?s:null}const s=t.classes.filter((t=>I(t,e.scale)));return s.length?{type:"simple",classes:s}:null}_getLabels(e,t){if("subtype"===t.type){const s=this.service.subtypeField,r=o(s,"Expected to find subtype Field"),i=e.readAttribute(r);return null==i?[]:t.classes[i]??[]}return t.classes}_getLabelInfos(e,s){const r=this._getLabelingSchemaForScale(e);if(i(r))return null;const a=new Map,o=s.getCursor();for(;o.next();){const e=o.getDisplayId(),s=[],i=u(e),n=i&&1!==o.readAttribute("cluster_count")?"aggregate":"feature",l=this._getLabels(o,r);for(const r of l){if(r.target!==n)continue;const a=o.getStorage(),l=i&&"feature"===n?a.getComputedStringAtIndex(o.readAttribute("referenceId"),r.fieldIndex):a.getComputedStringAtIndex(e,r.fieldIndex);if(!l)continue;const c=t(l.toString()),d=c[0],h=c[1];this._store.getMosaicItem(r.symbol,b(d)).then((e=>{s[r.index]={glyphs:e.glyphMosaicItems,rtl:h,index:r.index}}))}a.set(e,s)}return a}};M=e([d("esri.views.2d.layers.features.processors.SymbolProcessor")],M);const x=M;export{x 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import a from"../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,isSome as r,isNone as l,removeMaybe as o}from"../../../../core/maybe.js";import{watch as h,sync as p,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{createScreenPoint as d,screenPointObjectToArray as _,createScreenPointArray as v}from"../../../../core/screenUtils.js";import{property as P}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as m,u as g,m as w}from"../../../../chunks/mat4.js";import{e as f,l as M,c as D,g as T,a as V,m as b,n as k,s as E}from"../../../../chunks/vec3.js";import{a as S,c as H}from"../../../../chunks/vec3f64.js";import{c as x,a as I,n as R,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as O,create as C,intersectRay as z,normal as G}from"../../../../geometry/support/plane.js";import{create as U}from"../../../../geometry/support/ray.js";import{sv3d as L,sm4d as K,sv2d as A}from"../../../../geometry/support/vectorStacks.js";import{POINTER_MOVE_TIMER_MS as B,PLANE_PREVIEW_OUTLINE_WIDTH as F,forceVerticalModifier as N,forceHorizontalModifier as q,PREVIEW_FADE_DURATION_SECONDS as Z,PLANE_OUTLINE_COLOR as J,PLANE_BACKGROUND_COLOR as Q,PREVIEW_FADE_DOT_THRESHOLD as W,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,createRotateManipulator as $,createResizeManipulator as tt,createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as yt,getTiltRotateTexture as mt}from"./images/Factory.js";import{calculateInputRotationTransform as gt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as ft}from"../../support/geometryUtils/ray.js";import{newIntersector as Mt}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as Dt}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as Tt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Vt}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as bt}from"../../../support/screenUtils.js";var kt;let Et=kt=class extends Tt{constructor(t){super(t),this.clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=B,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=x(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=d(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode),this._intersector.options.store=Dt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this.rotateHeadingImage=yt(this.view.toolViewManager.textures),this.rotateTiltImage=mt(this.view.toolViewManager.textures);const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(r(this.analysisViewData.plane)&&I(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(e=>{this._onShiftGrab(e),t(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=$(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=$(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=tt(this.view,e);return a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=F,this._handles.add(h((()=>this.analysisViewData.plane),(()=>this._updateManipulators()),p));const e=h((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),u);this._handles.add([e,h((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this.rotateHeadingImage=s(this.rotateHeadingImage),this.rotateTiltImage=s(this.rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":r(this._creatingPointerId)?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=r(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return r(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.shiftManipulator&&(this._updateManipulators(),t||this._clearPointerMoveTimeout())}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Ht(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Ht(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Ht(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.editable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&r(e)&&"shift"===e.type){const i=bt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(bt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&r(this.analysisViewData.plane)){const e=bt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),I(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=bt(t),a=x();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(I(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=St(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(bt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===N||t.key===q)&&(this._activeKeyModifiers[t.key]=!0,r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==N&&t.key!==q||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);I(this.analysisViewData.plane,this._startPlane),this.inputState=St(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"shift"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=.001,a=Math.min((1-Math.abs(f(R(this.analysisViewData.plane),e.ray.direction)/M(e.ray.direction)))/i,1),s=-O(this._startPlane.plane,e.renderEnd),n=-O(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(l(this.analysisViewData.plane))return;const e=D(L.get(),this._startPlane.origin),i=D(L.get(),R(this._startPlane));T(i,i,-t.depth),V(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,x());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=G(t.rotatePlane),a=gt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(l(this.analysisViewData.plane))return;const e=m(K.get(),t.rotateAngle,t.rotateAxis),i=b(L.get(),this._startPlane.basis1,e),a=b(L.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,x());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||l(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),a=L.get();z(this.analysisViewData.plane.plane,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:S(a)})}_createResizeDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"resize"!==a.type||l(this.analysisViewData.plane))return;const s=I(this.analysisViewData.plane,x());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(l(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,I(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!r(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,l(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=r(i)?i:x();if(i=r(i)?I(i,xt):null,this._pickPlane(t,!0,e,a)){const t=W;let e=!1;r(i)&&(e=f(i.plane,a.plane)<t||f(k(L.get(),i.basis1),k(L.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}r(this._previewPlane)&&l(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=c({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*Z),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):l(this._previewPlane)&&r(this._frameTask)?this._removeFrameTask():r(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=o(this._frameTask)}_calculatePickRay(t){const e=U(),i=_(t,It);return ft(this.view.state.camera,i,e),k(e.direction,e.direction),e}_pickMinResult(t){const e=_(t,A.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=L.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(L.get()),l=this.view.state.camera;f(r,l.viewForward)>0&&T(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*X,p=T(L.get(),r,h);V(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[N]?ot.VERTICAL:i[q]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=o(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(kt.disableEngineLayers)return;let t=null,e=!1;if(r(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!r(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,K.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=E(L.get(),M(t.basis1),M(t.basis2),1),s=g(K.get(),a),n=w(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[J[0],J[1],J[2],J[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[Q[0],Q[1],Q[2],Q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function St(t,e,i,a){const s=Pt(i,R(a),t.direction,C()),n=H();return z(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Ht(t){return"mouse"!==t.pointerType||0===t.button}Et.disableEngineLayers=!1,t([P()],Et.prototype,"clock",void 0),t([P({constructOnly:!0})],Et.prototype,"view",void 0),t([P()],Et.prototype,"analysisViewData",void 0),t([P({readOnly:!0})],Et.prototype,"state",null),t([P({readOnly:!0})],Et.prototype,"cursor",null),t([P()],Et.prototype,"analysis",null),t([P()],Et.prototype,"removeIncompleteOnCancel",void 0),t([P({readOnly:!0})],Et.prototype,"layersMode",void 0),t([P({value:null})],Et.prototype,"inputState",null),t([P()],Et.prototype,"_isPlacingSlicePlane",null),t([P()],Et.prototype,"_creatingPointerId",null),Et=kt=t([y("esri.views.3d.analysis.Slice.SliceTool")],Et);const xt=x(),It=v(),Rt=Et;export{Rt as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import a from"../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,isSome as r,isNone as l,removeMaybe as o}from"../../../../core/maybe.js";import{watch as h,sync as p,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{createScreenPoint as d,screenPointObjectToArray as _,createScreenPointArray as v}from"../../../../core/screenUtils.js";import{property as P}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as m,u as g,m as w}from"../../../../chunks/mat4.js";import{e as f,l as M,c as D,g as T,a as V,m as b,n as k,s as E}from"../../../../chunks/vec3.js";import{a as S,c as H}from"../../../../chunks/vec3f64.js";import{c as x,a as I,n as R,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as O,create as C,intersectRay as z,normal as G}from"../../../../geometry/support/plane.js";import{create as U}from"../../../../geometry/support/ray.js";import{sv3d as L,sm4d as K,sv2d as A}from"../../../../geometry/support/vectorStacks.js";import{POINTER_MOVE_TIMER_MS as B,PLANE_PREVIEW_OUTLINE_WIDTH as F,forceVerticalModifier as N,forceHorizontalModifier as q,PREVIEW_FADE_DURATION_SECONDS as Z,PLANE_OUTLINE_COLOR as J,PLANE_BACKGROUND_COLOR as Q,PREVIEW_FADE_DOT_THRESHOLD as W,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,createRotateManipulator as $,createResizeManipulator as tt,createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as yt,getTiltRotateTexture as mt}from"./images/Factory.js";import{calculateInputRotationTransform as gt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as ft}from"../../support/geometryUtils/ray.js";import{newIntersector as Mt}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as Dt}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as Tt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Vt}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as bt}from"../../../support/screenUtils.js";var kt;let Et=kt=class extends Tt{constructor(t){super(t),this.clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=B,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=x(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=d(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode),this._intersector.options.store=Dt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this.rotateHeadingImage=yt(this.view.toolViewManager.textures),this.rotateTiltImage=mt(this.view.toolViewManager.textures);const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(r(this.analysisViewData.plane)&&I(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(e=>{this._onShiftGrab(e),t(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=$(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=$(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=tt(this.view,e);return a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=F,this._handles.add(h((()=>this.analysisViewData.plane),(()=>this._updateManipulators()),p));const e=h((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),u);this._handles.add([e,h((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this.rotateHeadingImage=s(this.rotateHeadingImage),this.rotateTiltImage=s(this.rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":r(this._creatingPointerId)?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=r(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return r(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.shiftManipulator&&(this._updateManipulators(),t||this._clearPointerMoveTimeout())}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Ht(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Ht(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Ht(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.editable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&r(e)&&"shift"===e.type){const i=bt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(bt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&r(this.analysisViewData.plane)){const e=bt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),I(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=bt(t),a=x();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(I(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=St(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(bt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===N||t.key===q)&&(this._activeKeyModifiers[t.key]=!0,r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==N&&t.key!==q||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);I(this.analysisViewData.plane,this._startPlane),this.inputState=St(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"shift"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=.001,a=Math.min((1-Math.abs(f(R(this.analysisViewData.plane),e.ray.direction)/M(e.ray.direction)))/i,1),s=-O(this._startPlane.plane,e.renderEnd),n=-O(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(l(this.analysisViewData.plane))return;const e=D(L.get(),this._startPlane.origin),i=D(L.get(),R(this._startPlane));T(i,i,-t.depth),V(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,x());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=G(t.rotatePlane),a=gt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(l(this.analysisViewData.plane))return;const e=m(K.get(),t.rotateAngle,t.rotateAxis);if(l(e))return;const i=b(L.get(),this._startPlane.basis1,e),a=b(L.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,x());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||l(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),a=L.get();z(this.analysisViewData.plane.plane,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:S(a)})}_createResizeDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"resize"!==a.type||l(this.analysisViewData.plane))return;const s=I(this.analysisViewData.plane,x());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(l(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,I(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!r(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,l(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=r(i)?i:x();if(i=r(i)?I(i,xt):null,this._pickPlane(t,!0,e,a)){const t=W;let e=!1;r(i)&&(e=f(i.plane,a.plane)<t||f(k(L.get(),i.basis1),k(L.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}r(this._previewPlane)&&l(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=c({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*Z),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):l(this._previewPlane)&&r(this._frameTask)?this._removeFrameTask():r(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=o(this._frameTask)}_calculatePickRay(t){const e=U(),i=_(t,It);return ft(this.view.state.camera,i,e),k(e.direction,e.direction),e}_pickMinResult(t){const e=_(t,A.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=L.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(L.get()),l=this.view.state.camera;f(r,l.viewForward)>0&&T(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*X,p=T(L.get(),r,h);V(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[N]?ot.VERTICAL:i[q]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=o(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(kt.disableEngineLayers)return;let t=null,e=!1;if(r(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!r(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,K.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=E(L.get(),M(t.basis1),M(t.basis2),1),s=g(K.get(),a),n=w(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[J[0],J[1],J[2],J[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[Q[0],Q[1],Q[2],Q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function St(t,e,i,a){const s=Pt(i,R(a),t.direction,C()),n=H();return z(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Ht(t){return"mouse"!==t.pointerType||0===t.button}Et.disableEngineLayers=!1,t([P()],Et.prototype,"clock",void 0),t([P({constructOnly:!0})],Et.prototype,"view",void 0),t([P()],Et.prototype,"analysisViewData",void 0),t([P({readOnly:!0})],Et.prototype,"state",null),t([P({readOnly:!0})],Et.prototype,"cursor",null),t([P()],Et.prototype,"analysis",null),t([P()],Et.prototype,"removeIncompleteOnCancel",void 0),t([P({readOnly:!0})],Et.prototype,"layersMode",void 0),t([P({value:null})],Et.prototype,"inputState",null),t([P()],Et.prototype,"_isPlacingSlicePlane",null),t([P()],Et.prototype,"_creatingPointerId",null),Et=kt=t([y("esri.views.3d.analysis.Slice.SliceTool")],Et);const xt=x(),It=v(),Rt=Et;export{Rt 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.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../Color.js";import a from"../../../../../core/Evented.js";import r from"../../../../../core/Handles.js";import{handlesGroup as e}from"../../../../../core/handleUtils.js";import{destroyMaybe as i,unwrap as o}from"../../../../../core/maybe.js";import{f as s,b as n,m as l,d as p,u}from"../../../../../chunks/mat4.js";import{c as h}from"../../../../../chunks/mat4f64.js";import{s as m}from"../../../../../chunks/vec3.js";import{f as c}from"../../../../../chunks/vec3f64.js";import{sv3d as f,sm4d as d}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as _}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as g}from"../../Manipulator3D.js";import{screenToMapXYAtLocation as M}from"../dragEventPipeline3D.js";import{ManipulatorType as w}from"../ManipulatorType.js";import{colors as v}from"../settings.js";import{DISC_RADIUS as j,DISC_HEIGHT as y,DISC_TRANSLATE_ARROW_OFFSET as A,DISC_TRANSLATE_ARROW_SIZE as I}from"./config.js";import{Manipulation as T}from"./Manipulation.js";import{createGraphicMoveDragPipeline as b}from"./moveUtils.js";import{CullFaceOptions as D}from"../../../webgl-engine/lib/basicInterfaces.js";import E from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as S}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as k}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as x,dragAtLocation as P,constrainToMapAxis as U,addScreenDelta as R}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as L}from"../../../../interactive/interfaces.js";class O extends T{constructor(t){super(),this._handles=new r,this._arrowManipulatorInfos=new Array,this._opaqueMaterial=this._createMaterial(),this._transparentMaterial=this._createMaterial(.5),this._angle=0,this._scale=1,this._radius=j,this._updateAfterDrag=!1,this.events=new a,this._tool=t.tool,this._view=t.view,null!=t.radius&&(this._radius=t.radius),this._createManipulators(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}set orthogonalAvailable(t){this._arrowManipulatorInfos[1].manipulator.available=t,this._arrowManipulatorInfos[3].manipulator.available=t}destroy(){this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._handles=i(this._handles),this._tool=null,this._view=null,this._arrowManipulatorInfos.length=0}forEachManipulator(t){for(const{manipulator:a}of this._arrowManipulatorInfos)t(a,w.TRANSLATE_XY)}createGraphicDragPipeline(t,a,r){const e=a.graphic,i=_(e),s=o(e.geometry).spatialReference;return b(a,r,(a=>this.createDragPipeline(((r,e,i,o,s)=>a(r,t(r,e,i,o,s),i)),i,s,e)),this._view.state.viewingMode)}createDragPipeline(t,a,r,i){return e(this._arrowManipulatorInfos.map((({manipulator:e},o)=>x(e,((e,s,n,l,p)=>{const u=s.next((t=>({...t,manipulatorType:w.TRANSLATE_XY}))).next(P(this._view,e.elevationAlignedLocation)).next(M(this._view,e.elevationAlignedLocation,a,r,i)).next(U(e.location,this.angle+(o+1)*Math.PI*.5)).next(R());t(e,u,n,l,p)})))))}get angle(){return this._angle}set angle(t){this._angle=t,this.dragging?this._updateAfterDrag=!0:this._updateManipulatorTransform()}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get radius(){return this._radius}set radius(t){this._radius!==t&&(this._radius=t,this._updateManipulators())}_updateManipulators(){for(let t=0;t<this._arrowManipulatorInfos.length;t++)this._updateArrowManipulator(this._arrowManipulatorInfos[t],t);this._updateManipulatorTransform()}_updateArrowManipulator({manipulator:t,transform:a},r){const e=this._radius/j,i=I*e,o=i*Math.sqrt(3)/2,p=E.createExtrudedTriangle(o,i/2,i/2,y);E.transformInPlace(p,s(d.get(),m(f.get(),0,-o/3,0))),t.renderObjects=[{geometry:p,material:this._opaqueMaterial,stateMask:L.Focused},{geometry:p,material:this._transparentMaterial,stateMask:L.Unfocused}],t.radius=o/3*2*1.2;const u=n(d.get(),r*Math.PI/2),h=s(d.get(),m(f.get(),0,A*e,0));l(a,u,h)}_createManipulators(){for(let t=0;t<4;t++){const a=this._createArrowManipulator(t);this._arrowManipulatorInfos.push(a)}this._updateManipulatorTransform()}_updateManipulatorTransform(){const t=this.angle,a=p(d.get(),t,c(0,0,1)),r=u(d.get(),m(f.get(),this.displayScale,this.displayScale,this.displayScale)),e=l(d.get(),r,a);for(const i of this._arrowManipulatorInfos){const t=l(d.get(),e,i.transform);i.manipulator.modelTransform=t}}_createArrowManipulator(t){const a=new g({view:this._view,autoScaleRenderObjects:!1,worldOriented:!0,focusMultiplier:1,touchMultiplier:1,collisionType:{type:"disc",direction:c(0,0,1)}}),r={manipulator:a,transform:h()};return this._updateArrowManipulator(r,t),this._handles.add(a.events.on("drag",(t=>{this._updateAfterDrag&&"end"===t.action&&!this.dragging&&(this._updateManipulatorTransform(),this._updateAfterDrag=!1)}))),r}_createMaterial(a=1){const r=t.toUnitRGBA(v.main);return r[3]*=a,new k({color:r,transparent:1!==a,cullFace:D.Back,renderOccluded:S.Transparent})}get test(){return{arrowManipulators:this._arrowManipulatorInfos.map((({manipulator:t})=>t))}}}export{O as MoveXYAxisManipulation};
5
+ import t from"../../../../../Color.js";import a from"../../../../../core/Evented.js";import r from"../../../../../core/Handles.js";import{handlesGroup as e}from"../../../../../core/handleUtils.js";import{destroyMaybe as i,unwrap as o,isNone as s}from"../../../../../core/maybe.js";import{f as n,b as l,m as p,d as u,u as h}from"../../../../../chunks/mat4.js";import{c as m}from"../../../../../chunks/mat4f64.js";import{s as c}from"../../../../../chunks/vec3.js";import{f}from"../../../../../chunks/vec3f64.js";import{sv3d as d,sm4d as _}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as g}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as M}from"../../Manipulator3D.js";import{screenToMapXYAtLocation as w}from"../dragEventPipeline3D.js";import{ManipulatorType as v}from"../ManipulatorType.js";import{colors as j}from"../settings.js";import{DISC_RADIUS as y,DISC_HEIGHT as A,DISC_TRANSLATE_ARROW_OFFSET as I,DISC_TRANSLATE_ARROW_SIZE as T}from"./config.js";import{Manipulation as b}from"./Manipulation.js";import{createGraphicMoveDragPipeline as D}from"./moveUtils.js";import{CullFaceOptions as E}from"../../../webgl-engine/lib/basicInterfaces.js";import S from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as k}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as x}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as P,dragAtLocation as U,constrainToMapAxis as R,addScreenDelta as L}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as O}from"../../../../interactive/interfaces.js";class q extends b{constructor(t){super(),this._handles=new r,this._arrowManipulatorInfos=new Array,this._opaqueMaterial=this._createMaterial(),this._transparentMaterial=this._createMaterial(.5),this._angle=0,this._scale=1,this._radius=y,this._updateAfterDrag=!1,this.events=new a,this._tool=t.tool,this._view=t.view,null!=t.radius&&(this._radius=t.radius),this._createManipulators(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}set orthogonalAvailable(t){this._arrowManipulatorInfos[1].manipulator.available=t,this._arrowManipulatorInfos[3].manipulator.available=t}destroy(){this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._handles=i(this._handles),this._tool=null,this._view=null,this._arrowManipulatorInfos.length=0}forEachManipulator(t){for(const{manipulator:a}of this._arrowManipulatorInfos)t(a,v.TRANSLATE_XY)}createGraphicDragPipeline(t,a,r){const e=a.graphic,i=g(e),s=o(e.geometry).spatialReference;return D(a,r,(a=>this.createDragPipeline(((r,e,i,o,s)=>a(r,t(r,e,i,o,s),i)),i,s,e)),this._view.state.viewingMode)}createDragPipeline(t,a,r,i){return e(this._arrowManipulatorInfos.map((({manipulator:e},o)=>P(e,((e,s,n,l,p)=>{const u=s.next((t=>({...t,manipulatorType:v.TRANSLATE_XY}))).next(U(this._view,e.elevationAlignedLocation)).next(w(this._view,e.elevationAlignedLocation,a,r,i)).next(R(e.location,this.angle+(o+1)*Math.PI*.5)).next(L());t(e,u,n,l,p)})))))}get angle(){return this._angle}set angle(t){this._angle=t,this.dragging?this._updateAfterDrag=!0:this._updateManipulatorTransform()}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get radius(){return this._radius}set radius(t){this._radius!==t&&(this._radius=t,this._updateManipulators())}_updateManipulators(){for(let t=0;t<this._arrowManipulatorInfos.length;t++)this._updateArrowManipulator(this._arrowManipulatorInfos[t],t);this._updateManipulatorTransform()}_updateArrowManipulator({manipulator:t,transform:a},r){const e=this._radius/y,i=T*e,o=i*Math.sqrt(3)/2,s=S.createExtrudedTriangle(o,i/2,i/2,A);S.transformInPlace(s,n(_.get(),c(d.get(),0,-o/3,0))),t.renderObjects=[{geometry:s,material:this._opaqueMaterial,stateMask:O.Focused},{geometry:s,material:this._transparentMaterial,stateMask:O.Unfocused}],t.radius=o/3*2*1.2;const u=l(_.get(),r*Math.PI/2),h=n(_.get(),c(d.get(),0,I*e,0));p(a,u,h)}_createManipulators(){for(let t=0;t<4;t++){const a=this._createArrowManipulator(t);this._arrowManipulatorInfos.push(a)}this._updateManipulatorTransform()}_updateManipulatorTransform(){const t=this.angle,a=u(_.get(),t,f(0,0,1));if(s(a))return;const r=h(_.get(),c(d.get(),this.displayScale,this.displayScale,this.displayScale)),e=p(_.get(),r,a);for(const i of this._arrowManipulatorInfos){const t=p(_.get(),e,i.transform);i.manipulator.modelTransform=t}}_createArrowManipulator(t){const a=new M({view:this._view,autoScaleRenderObjects:!1,worldOriented:!0,focusMultiplier:1,touchMultiplier:1,collisionType:{type:"disc",direction:f(0,0,1)}}),r={manipulator:a,transform:m()};return this._updateArrowManipulator(r,t),this._handles.add(a.events.on("drag",(t=>{this._updateAfterDrag&&"end"===t.action&&!this.dragging&&(this._updateManipulatorTransform(),this._updateAfterDrag=!1)}))),r}_createMaterial(a=1){const r=t.toUnitRGBA(j.main);return r[3]*=a,new x({color:r,transparent:1!==a,cullFace:E.Back,renderOccluded:k.Transparent})}get test(){return{arrowManipulators:this._arrowManipulatorInfos.map((({manipulator:t})=>t))}}}export{q as MoveXYAxisManipulation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../../core/Cyclical.js";import e from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{clamp as i,rad2deg as o}from"../../../../../core/mathUtils.js";import{isSome as s,destroyMaybe as r,unwrapOr as n}from"../../../../../core/maybe.js";import{createAngle as l,createLength as c}from"../../../../../core/quantityUtils.js";import{when as h,initial as p,watch as u}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{d as m,u as _,m as f,h as M,e as D}from"../../../../../chunks/mat4.js";import{c as S}from"../../../../../chunks/mat4f64.js";import{s as v,b as y,l as b,d as T,f as R,a as j}from"../../../../../chunks/vec3.js";import{a as k,f as w}from"../../../../../chunks/vec3f64.js";import{b as O}from"../../../../../chunks/vec4f64.js";import{fromPositionAndNormal as A,create as I,normal as P}from"../../../../../geometry/support/plane.js";import{wrap as E,distance2 as F}from"../../../../../geometry/support/ray.js";import{sv3d as C,sm4d as U}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as x}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as L}from"../../manipulatorUtils.js";import{screenToRenderPlane as N}from"../dragEventPipeline3D.js";import{ManipulatorType as G}from"../ManipulatorType.js";import{ROTATE_INDICATOR_DIRECTION_BUFFER as H,SCALE_INDICATOR_DIRECTION_BUFFER as V,RING_HEIGHT as q,ROTATE_INDICATOR_ARROW_PLACEMENT_PERCENTAGE as B,ROTATE_INDICATOR_ARROW_TIP_LENGTH as J,ROTATE_INDICATOR_ARROW_TIP_RADIUS as K,RING_THICKNESS as Q,HANDLE_COLOR as W,DRAG_THRESHOLD_PX as X,RING_INDICATOR_DELAY_MS as Y,RING_RADIUS as Z,INNER_INDICATOR_RADIUS as $,INDICATOR_THICKNESS as tt,OUTER_INDICATOR_RADIUS as et,SCALE_INDICATOR_OFFSET1 as at,SCALE_INDICATOR_OFFSET2 as it,RING_RESET_ANIMATION_SPEED_FACTOR as ot,GEOMETRY_SEGMENTS as st,ROTATE_INDICATOR_ARC_LENGTH as rt,SCALE_INDICATOR_ARC_LENGTH as nt}from"../manipulations/config.js";import{CullFaceOptions as lt}from"../../../webgl-engine/lib/basicInterfaces.js";import ct from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ht}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as pt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ut}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as dt,ManipulatorStateFlags as gt}from"../../../../interactive/interfaces.js";import{Tooltip as mt}from"../../../../interactive/tooltip/Tooltip.js";import{TransformRotateTooltipInfo as _t,TransformScaleTooltipInfo as ft,TransformAbsoluteTooltipInfo as Mt}from"../../../../interactive/tooltip/TransformTooltipInfos.js";var Dt,St;!function(t){t.ScaleIn=dt.Custom2,t.ScaleOut=dt.Custom3,t.RotateLeft=dt.Custom4,t.RotateRight=dt.Custom5,t.Unlocked=dt.Custom7,t.DelayedFocused=dt.Custom8,t.TouchInput=dt.Custom12}(Dt||(Dt={}));class vt{constructor({adapter:t,tooltipOptions:i,mode:o,tool:r}){this.mode=null,this._handles=new a,this._scaleRotateDragData=null,this._activeAnimation=null,this.events=new e,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>s(this._scaleRotateDragData)&&"scale"===this._scaleRotateDragData.mode?this.adapter.scale:1,this.tool=r,this.mode=o,this.adapter=t,this._tooltipOptions=i,this._tooltip=new mt({view:r.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this._handles.add(h((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),p))}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}destroy(){s(this._activeAnimation)&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=null),this._handles=r(this._handles),this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=r(this._tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){s(this._activeAnimation)&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=r(this._activeAnimation))}forEachManipulator(t){t(this._ringManipulator,G.SCALE_ROTATE)}_createManipulator(){const e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);const a=this.tool.graphicState.graphic,r=ut(e,((e,r,n)=>{this._scaleRotateDragData=null;const l=this.adapter.startInteraction(),c={mode:"none",origin:k(e.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=c,this._updateDragState();const h=C.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,h),r.next(N(this.tool.view,A(e.renderLocation,h,I()))).next((e=>{const r=P(e.plane),n=L(e.renderStart,e.renderEnd,c.origin,r),h=t.shortestSignedDiff(c.angle,n);c.angleDir=i(c.angleDir+h,-H,H),c.angle=n;const p=yt(c,e),u=p-this.adapter.scale;if(c.scaleDir=i(c.scaleDir+u,-V,V),this._onScaleChanged(),"none"===c.mode){const t=this.mode||bt(e,e.plane,c.origin,this.tool.view.state.camera);if(s(t)){switch(t){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:a,angle:0}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()})}c.mode=t}}switch(c.mode){case"rotate":l.state.angle=c.initialAngle+n;break;case"scale":l.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case"start":case"update":switch(c.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:a,angle:o(c.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:a,xScale:p,yScale:p})}break;case"end":switch(c.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:o(c.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:p,yScale:p})}}return"end"===e.action&&(this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),l.done()),e})).next(this._updateTooltipPipelineStep(c)),n.next((()=>{if(l.cancel(),s(this._scaleRotateDragData)){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1})}this.startAnimation(Rt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this._handles.add([r,e.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(jt(this,(()=>this._updateDelayedFocusedState()))):this._updateDelayedFocusedState()})),e.events.on("immediate-click",(t=>{t.stopPropagation()})),u((()=>this.tool.graphicState?.displaying),(t=>this._ringManipulator.available=t),p)])}_updateTooltipPipelineStep(t){return e=>{const a=this._tooltipOptions;if(!a.enabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const i=this._tooltip,o=this._tooltipOptions.visualVariables,r=s(o)?o.size:null,h=s(o)?o.rotation:null;switch(t.mode){case"scale":i.info=new ft({tooltipOptions:a,scale:{value:this.adapter.scale},size:c(n(this.adapter.size,-1),"meters"),sizeUnit:s(r)?r.unit:null,sizePrecision:s(r)?kt(r.valueType):null});break;case"rotate":{const t=s(h)?kt(h.valueType):null,e=s(h)?h.rotationType:"geographic";i.info=new _t({tooltipOptions:a,rotation:l(n(-this.adapter.relativeAngle,0),"radians","geographic"),rotationPrecision:t,orientation:l(-this.adapter.angle,"radians","geographic"),orientationPrecision:t,rotationType:e})}}return e}}_updateFocusTooltip(){if(!this._tooltipOptions.enabled)return;if(this.getFocused()){const t=this._tooltipOptions.visualVariables,e=s(t)?t.rotation:null,a=s(t)?t.size:null;this._tooltip.info=new Mt({tooltipOptions:this._tooltipOptions,orientation:l(-this.adapter.angle,"radians","geographic"),orientationEnabled:null==this.mode||"rotate"===this.mode,orientationPrecision:s(e)?kt(e.valueType):null,rotationType:s(e)?e.rotationType:"geographic",size:c(n(this.adapter.size,-1),"meters"),sizeUnit:s(a)?a.unit:null,sizeEnabled:null==this.mode||"scale"===this.mode,sizePrecision:s(a)?kt(a.valueType):null})}else this._tooltip.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Dt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Dt.Unlocked,!(s(this._scaleRotateDragData)&&"none"!==this._scaleRotateDragData.mode)),s(this._scaleRotateDragData))switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Dt.ScaleIn|Dt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Dt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Dt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Dt.RotateLeft|Dt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Dt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Dt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Dt.ScaleIn|Dt.ScaleOut|Dt.RotateLeft|Dt.RotateRight,!1)}_updateManipulatorTransform(){const t=m(U.get(),this.adapter.angle,w(0,0,1)),e=this.getScale(),a=_(U.get(),v(C.get(),e,e,e));this._ringManipulator.modelTransform=f(U.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<o+1;s++){const r=t+s*(e-t)/o;i.push(w(a*Math.cos(r),a*Math.sin(r),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,q/2],[-t/2,q/2]],i=(t,e)=>ct.createPathExtrusionGeometry(a(e),t,[],[],!1),o=e(Z),s=i(o,Q),r={left:[],right:[]},n=[];for(let j=0;j<2;j++){const e=j*Math.PI-Math.PI/4,a=Math.PI/2-rt,o=e+a,s=e+Math.PI/2-a,l=t(o,s,$),c=i(l,tt);n.push(l),n.push(t(o,s,et-Q/2)),r.left.push(c),r.right.push(c);for(let t=0;t<2;t++){const e=0===t,a=S();if(e){M(a,a,[1,-1,1]),D(a,a,-o,[0,0,1]);const t=Math.round(B*(l.length-1));a[12]=l[t][0],a[13]=l[t][1],a[14]=l[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-B)*(l.length-1));a[12]=l[t][0],a[13]=l[t][1],a[14]=l[t][2]}const i=ct.createExtrudedTriangle(J,0,K,q);ct.transformInPlace(i,a),(e?r.left:r.right).push(i)}}const l=[];for(let M=0;M<2;M++){const e=M*Math.PI-Math.PI/4,a=Math.PI/2-nt,o=e+a,s=e+Math.PI/2-a,r=t(o,s,et);l.push(i(r,tt))}const c=e(Z+at),h=e(Z+it),p=i(c,tt),u=i(h,tt),d=e(Z-at),g=e(Z-it),m=i(d,tt),_=i(g,tt),f=this._createMaterial(),v=this._createMaterial(.66),y=this._createMaterial(.5),b=this._createMaterial(.33);let T=[{geometry:s,material:f,stateMask:Dt.DelayedFocused},{geometry:s,material:y,stateMask:gt.None}];this.mode&&"scale"!==this.mode||(T=T.concat([{geometry:l,material:f,stateMask:Dt.DelayedFocused|Dt.Unlocked},{geometry:p,material:v,stateMask:Dt.DelayedFocused|Dt.ScaleIn},{geometry:u,material:b,stateMask:Dt.DelayedFocused|Dt.ScaleIn},{geometry:m,material:v,stateMask:Dt.DelayedFocused|Dt.ScaleOut},{geometry:_,material:b,stateMask:Dt.DelayedFocused|Dt.ScaleOut}])),this.mode&&"rotate"!==this.mode||(T=T.concat([{geometry:r.right,material:f,stateMask:Dt.DelayedFocused|Dt.Unlocked},{geometry:r.left,material:f,stateMask:Dt.DelayedFocused|Dt.RotateLeft},{geometry:r.right,material:f,stateMask:Dt.DelayedFocused|Dt.RotateRight}]));const R=[o,...n];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:x(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:R,direction:w(0,0,1)}})}_createMaterial(t=1){const e=O([...W,t]);return new pt({color:e,transparent:1!==t,cullFace:lt.Back,renderOccluded:ht.Transparent})}get test(){return{ringManipulator:this._ringManipulator,tooltip:this._tooltip}}}function yt(t,e){const a=y(C.get(),e.renderStart,t.origin),i=y(C.get(),e.renderEnd,t.origin),o=b(a),s=b(i);return 0===o?0:s/o}function bt(t,e,a,i){const{renderStart:o,renderEnd:s}=t,r=Tt(o,i,C.get()),n=Tt(s,i,C.get());if(T(r,n)<X*X)return null;const l=y(C.get(),o,a),c=R(C.get(),l,P(e)),h=o,p=j(C.get(),h,c),u=Tt(a,i,C.get()),d=r,g=Tt(p,i,C.get()),m=y(C.get(),g,d),_=y(C.get(),r,u),f=E(d,m),M=E(u,_);return F(f,n)<F(M,n)?"rotate":"scale"}function Tt(t,e,a){return e.projectToScreen(t,wt),v(a,wt[0],wt[1],0)}function Rt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*ot,1),e(),Math.abs(i-1)<.01?St.STOP:St.CONTINUE),destroy:()=>{t.getScale=a,e()}}}function jt(t,e){let a=0,i=null;const o=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=o,a=0,e()},update:t=>(a+=t,!i()||a>Y?St.STOP:St.CONTINUE),destroy:()=>{t.getFocused=i,e()}}}function kt(t){switch(t){case"integer":case"long":return 0;default:return null}}!function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(St||(St={}));const wt=g();export{vt as GraphicScaleRotateTransform};
5
+ import{cyclicalPI as t}from"../../../../../core/Cyclical.js";import e from"../../../../../core/Evented.js";import a from"../../../../../core/Handles.js";import{clamp as i,rad2deg as o}from"../../../../../core/mathUtils.js";import{isSome as s,destroyMaybe as r,unwrapOr as n,isNone as l}from"../../../../../core/maybe.js";import{createAngle as c,createLength as h}from"../../../../../core/quantityUtils.js";import{when as p,initial as u,watch as d}from"../../../../../core/reactiveUtils.js";import{addFrameTask as g}from"../../../../../core/scheduling.js";import{createScreenPointArray as m}from"../../../../../core/screenUtils.js";import{d as _,u as f,m as M,h as D,e as S}from"../../../../../chunks/mat4.js";import{c as v}from"../../../../../chunks/mat4f64.js";import{s as y,b,l as T,d as R,f as j,a as k}from"../../../../../chunks/vec3.js";import{a as w,f as O}from"../../../../../chunks/vec3f64.js";import{b as A}from"../../../../../chunks/vec4f64.js";import{fromPositionAndNormal as I,create as P,normal as E}from"../../../../../geometry/support/plane.js";import{wrap as F,distance2 as C}from"../../../../../geometry/support/ray.js";import{sv3d as U,sm4d as x}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as z}from"../../../../../support/elevationInfoUtils.js";import{Manipulator3D as L}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as H}from"../ManipulatorType.js";import{ROTATE_INDICATOR_DIRECTION_BUFFER as V,SCALE_INDICATOR_DIRECTION_BUFFER as q,RING_HEIGHT as B,ROTATE_INDICATOR_ARROW_PLACEMENT_PERCENTAGE as J,ROTATE_INDICATOR_ARROW_TIP_LENGTH as K,ROTATE_INDICATOR_ARROW_TIP_RADIUS as Q,RING_THICKNESS as W,HANDLE_COLOR as X,DRAG_THRESHOLD_PX as Y,RING_INDICATOR_DELAY_MS as Z,RING_RADIUS as $,INNER_INDICATOR_RADIUS as tt,INDICATOR_THICKNESS as et,OUTER_INDICATOR_RADIUS as at,SCALE_INDICATOR_OFFSET1 as it,SCALE_INDICATOR_OFFSET2 as ot,RING_RESET_ANIMATION_SPEED_FACTOR as st,GEOMETRY_SEGMENTS as rt,ROTATE_INDICATOR_ARC_LENGTH as nt,SCALE_INDICATOR_ARC_LENGTH as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import ht from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as pt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as ut}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as dt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as gt,ManipulatorStateFlags as mt}from"../../../../interactive/interfaces.js";import{Tooltip as _t}from"../../../../interactive/tooltip/Tooltip.js";import{TransformRotateTooltipInfo as ft,TransformScaleTooltipInfo as Mt,TransformAbsoluteTooltipInfo as Dt}from"../../../../interactive/tooltip/TransformTooltipInfos.js";var St,vt;!function(t){t.ScaleIn=gt.Custom2,t.ScaleOut=gt.Custom3,t.RotateLeft=gt.Custom4,t.RotateRight=gt.Custom5,t.Unlocked=gt.Custom7,t.DelayedFocused=gt.Custom8,t.TouchInput=gt.Custom12}(St||(St={}));class yt{constructor({adapter:t,tooltipOptions:i,mode:o,tool:r}){this.mode=null,this._handles=new a,this._scaleRotateDragData=null,this._activeAnimation=null,this.events=new e,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>s(this._scaleRotateDragData)&&"scale"===this._scaleRotateDragData.mode?this.adapter.scale:1,this.tool=r,this.mode=o,this.adapter=t,this._tooltipOptions=i,this._tooltip=new _t({view:r.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this._handles.add(p((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),u))}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}destroy(){s(this._activeAnimation)&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=null),this._handles=r(this._handles),this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=r(this._tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=g({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){s(this._activeAnimation)&&(this._activeAnimation.frameTask.remove(),this._activeAnimation=r(this._activeAnimation))}forEachManipulator(t){t(this._ringManipulator,H.SCALE_ROTATE)}_createManipulator(){const e=this._createRingManipulator();this._ringManipulator=e,this.tool.manipulators.add(e);const a=this.tool.graphicState.graphic,r=dt(e,((e,r,n)=>{this._scaleRotateDragData=null;const l=this.adapter.startInteraction(),c={mode:"none",origin:w(e.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=c,this._updateDragState();const h=U.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(e.renderLocation,h),r.next(G(this.tool.view,I(e.renderLocation,h,P()))).next((e=>{const r=E(e.plane),n=N(e.renderStart,e.renderEnd,c.origin,r),h=t.shortestSignedDiff(c.angle,n);c.angleDir=i(c.angleDir+h,-V,V),c.angle=n;const p=bt(c,e),u=p-this.adapter.scale;if(c.scaleDir=i(c.scaleDir+u,-q,q),this._onScaleChanged(),"none"===c.mode){const t=this.mode||Tt(e,e.plane,c.origin,this.tool.view.state.camera);if(s(t)){switch(t){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:a,angle:0}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()})}c.mode=t}}switch(c.mode){case"rotate":l.state.angle=c.initialAngle+n;break;case"scale":l.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),e.action){case"start":case"update":switch(c.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:a,angle:o(c.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:a,xScale:p,yScale:p})}break;case"end":switch(c.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:o(c.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:p,yScale:p})}}return"end"===e.action&&(this.startAnimation(jt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),l.done()),e})).next(this._updateTooltipPipelineStep(c)),n.next((()=>{if(l.cancel(),s(this._scaleRotateDragData)){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:a,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1})}this.startAnimation(jt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this._handles.add([r,e.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(kt(this,(()=>this._updateDelayedFocusedState()))):this._updateDelayedFocusedState()})),e.events.on("immediate-click",(t=>{t.stopPropagation()})),d((()=>this.tool.graphicState?.displaying),(t=>this._ringManipulator.available=t),u)])}_updateTooltipPipelineStep(t){return e=>{const a=this._tooltipOptions;if(!a.enabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const i=this._tooltip,o=this._tooltipOptions.visualVariables,r=s(o)?o.size:null,l=s(o)?o.rotation:null;switch(t.mode){case"scale":i.info=new Mt({tooltipOptions:a,scale:{value:this.adapter.scale},size:h(n(this.adapter.size,-1),"meters"),sizeUnit:s(r)?r.unit:null,sizePrecision:s(r)?wt(r.valueType):null});break;case"rotate":{const t=s(l)?wt(l.valueType):null,e=s(l)?l.rotationType:"geographic";i.info=new ft({tooltipOptions:a,rotation:c(n(-this.adapter.relativeAngle,0),"radians","geographic"),rotationPrecision:t,orientation:c(-this.adapter.angle,"radians","geographic"),orientationPrecision:t,rotationType:e})}}return e}}_updateFocusTooltip(){if(!this._tooltipOptions.enabled)return;if(this.getFocused()){const t=this._tooltipOptions.visualVariables,e=s(t)?t.rotation:null,a=s(t)?t.size:null;this._tooltip.info=new Dt({tooltipOptions:this._tooltipOptions,orientation:c(-this.adapter.angle,"radians","geographic"),orientationEnabled:null==this.mode||"rotate"===this.mode,orientationPrecision:s(e)?wt(e.valueType):null,rotationType:s(e)?e.rotationType:"geographic",size:h(n(this.adapter.size,-1),"meters"),sizeUnit:s(a)?a.unit:null,sizeEnabled:null==this.mode||"scale"===this.mode,sizePrecision:s(a)?wt(a.valueType):null})}else this._tooltip.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(St.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(St.Unlocked,!(s(this._scaleRotateDragData)&&"none"!==this._scaleRotateDragData.mode)),s(this._scaleRotateDragData))switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(St.ScaleIn|St.ScaleOut,!1),this._ringManipulator.updateStateEnabled(St.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(St.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(St.RotateLeft|St.RotateRight,!1),this._ringManipulator.updateStateEnabled(St.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(St.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(St.ScaleIn|St.ScaleOut|St.RotateLeft|St.RotateRight,!1)}_updateManipulatorTransform(){const t=_(x.get(),this.adapter.angle,O(0,0,1));if(l(t))return;const e=this.getScale(),a=f(x.get(),y(U.get(),e,e,e));this._ringManipulator.modelTransform=M(x.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const i=[],o=Math.ceil(rt*(e-t)/(2*Math.PI));for(let s=0;s<o+1;s++){const r=t+s*(e-t)/o;i.push(O(a*Math.cos(r),a*Math.sin(r),0))}return i},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,B/2],[-t/2,B/2]],i=(t,e)=>ht.createPathExtrusionGeometry(a(e),t,[],[],!1),o=e($),s=i(o,W),r={left:[],right:[]},n=[];for(let j=0;j<2;j++){const e=j*Math.PI-Math.PI/4,a=Math.PI/2-nt,o=e+a,s=e+Math.PI/2-a,l=t(o,s,tt),c=i(l,et);n.push(l),n.push(t(o,s,at-W/2)),r.left.push(c),r.right.push(c);for(let t=0;t<2;t++){const e=0===t,a=v();if(e){D(a,a,[1,-1,1]),S(a,a,-o,[0,0,1]);const t=Math.round(J*(l.length-1));a[12]=l[t][0],a[13]=l[t][1],a[14]=l[t][2]}else{S(a,a,s,[0,0,1]);const t=Math.round((1-J)*(l.length-1));a[12]=l[t][0],a[13]=l[t][1],a[14]=l[t][2]}const i=ht.createExtrudedTriangle(K,0,Q,B);ht.transformInPlace(i,a),(e?r.left:r.right).push(i)}}const l=[];for(let D=0;D<2;D++){const e=D*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,r=t(o,s,at);l.push(i(r,et))}const c=e($+it),h=e($+ot),p=i(c,et),u=i(h,et),d=e($-it),g=e($-ot),m=i(d,et),_=i(g,et),f=this._createMaterial(),M=this._createMaterial(.66),y=this._createMaterial(.5),b=this._createMaterial(.33);let T=[{geometry:s,material:f,stateMask:St.DelayedFocused},{geometry:s,material:y,stateMask:mt.None}];this.mode&&"scale"!==this.mode||(T=T.concat([{geometry:l,material:f,stateMask:St.DelayedFocused|St.Unlocked},{geometry:p,material:M,stateMask:St.DelayedFocused|St.ScaleIn},{geometry:u,material:b,stateMask:St.DelayedFocused|St.ScaleIn},{geometry:m,material:M,stateMask:St.DelayedFocused|St.ScaleOut},{geometry:_,material:b,stateMask:St.DelayedFocused|St.ScaleOut}])),this.mode&&"rotate"!==this.mode||(T=T.concat([{geometry:r.right,material:f,stateMask:St.DelayedFocused|St.Unlocked},{geometry:r.left,material:f,stateMask:St.DelayedFocused|St.RotateLeft},{geometry:r.right,material:f,stateMask:St.DelayedFocused|St.RotateRight}]));const R=[o,...n];return new L({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:W,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:z(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:R,direction:O(0,0,1)}})}_createMaterial(t=1){const e=A([...X,t]);return new ut({color:e,transparent:1!==t,cullFace:ct.Back,renderOccluded:pt.Transparent})}get test(){return{ringManipulator:this._ringManipulator,tooltip:this._tooltip}}}function bt(t,e){const a=b(U.get(),e.renderStart,t.origin),i=b(U.get(),e.renderEnd,t.origin),o=T(a),s=T(i);return 0===o?0:s/o}function Tt(t,e,a,i){const{renderStart:o,renderEnd:s}=t,r=Rt(o,i,U.get()),n=Rt(s,i,U.get());if(R(r,n)<Y*Y)return null;const l=b(U.get(),o,a),c=j(U.get(),l,E(e)),h=o,p=k(U.get(),h,c),u=Rt(a,i,U.get()),d=r,g=Rt(p,i,U.get()),m=b(U.get(),g,d),_=b(U.get(),r,u),f=F(d,m),M=F(u,_);return C(f,n)<C(M,n)?"rotate":"scale"}function Rt(t,e,a){return e.projectToScreen(t,Ot),y(a,Ot[0],Ot[1],0)}function jt(t,e){let a=null,i=1;const o=()=>i;return{start:()=>{i=t.getScale(),a=t.getScale,t.getScale=o,e()},update:t=>(i+=((i+1)/2-i)*Math.min(t*st,1),e(),Math.abs(i-1)<.01?vt.STOP:vt.CONTINUE),destroy:()=>{t.getScale=a,e()}}}function kt(t,e){let a=0,i=null;const o=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=o,a=0,e()},update:t=>(a+=t,!i()||a>Z?vt.STOP:vt.CONTINUE),destroy:()=>{t.getFocused=i,e()}}}function wt(t){switch(t){case"integer":case"long":return 0;default:return null}}!function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(vt||(vt={}));const Ot=m();export{yt as GraphicScaleRotateTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o}from"../../../../core/mathUtils.js";import{isNone as r}from"../../../../core/maybe.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{d as i,m as s,e as c}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as u}from"../../../../chunks/vec2.js";import{a as l}from"../../../../chunks/vec2f64.js";import{c as p,e as f,g as h,b as M,n as y,f as g,m as d,a as b,l as j,h as v,s as z,d as x}from"../../../../chunks/vec3.js";import{c as P}from"../../../../chunks/vec3f64.js";import{create as k,axis as I,fromPoints as w,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as S,vectorCoordinates as A}from"../../../../geometry/support/coordinateSystem.js";import{create as H,intersectRay as G,fromNormalAndOffset as U}from"../../../../geometry/support/plane.js";import{j as V,h as q,c as C}from"../../../../chunks/sphere.js";import{angle as F}from"../../../../geometry/support/vector.js";import{sv3d as R,sm4d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as W,fromScreenAtEye as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import{Camera as J}from"../../webgl-engine/lib/Camera.js";var K;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(K||(K={}));const L=30,N=[1,3e8],O=70;function Q(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function X(t,e,n){const o=R.get(),r=R.get(),a=R.get();p(r,t),p(a,e);const i=f(r,n),s=f(a,n);h(o,n,i),M(r,r,o),y(r,r),h(o,n,s),M(a,a,o),y(a,a);const c=f(r,a);g(o,n,r);const m=f(a,o);return Math.atan2(m,c)}function Y(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function Z(t,e,n){const o=i(T.get(),n[3],I(n));M(Ot,t.eye,e),d(Ot,Ot,o),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,o),t.center=b(Ot,Ot,e),t.up=d(Ot,t.up,o)}function $(t,e,n,o){return G(t,W(e,n,$t),o)}function _(t,e,n,o){return G(t,B(e,n,$t),o)}function tt(t,e,n,o){const r=R.get();let a=1-n;M(r,e,t.eye);const i=j(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(h(r,r,a),t.eye=b(Ot,t.eye,r),t.center=v(Ot,t.center,e,a))}function et(t,e,n){e.getScreenCenter(nt),D(t,e,nt,Ot)&&(e.center=Ot);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=h(R.get(),e.viewForward,r);e.eye=M(Ot,e.center,a)}const nt=a();function ot(t,e,n){rt(e,n),y(n,n),h(n,n,t)}function rt(t,e){z(e,0,0,0);for(const n of t)b(e,e,n);h(e,e,1/t.length)}function at(t,e,n,o){return Math.sin(t/j(e))*(n+o.radius)}function it(t,e,n,o){return at(Math.PI/2,e,n,o)+(t-Math.PI/2)}var st;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(st||(st={}));const ct={Elevation:3e4,Angle:e(6)},mt={Pole:.95,Angle:e(18),Tilt:45},ut=e(80);function lt(t,e,n,o,r,a){const i=P(),s=C();let c=!0,m=!0;return t.intersectScreen(n,i,a)?s[3]=j(i):(m=!1,e.aboveGround&&r!==K.Ellipsoid?s[3]=Math.max(j(e.center),.9*o.radius):s[3]=j(e.eye)-e.relativeElevation,r===K.Silhouette?Mt(s,e,n,i):c=D(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:m}}function pt(t,e,n,o){if(j(t.eye)-o.radius>ct.Elevation)return st.Horizontal;if(!n)return st.Vertical;B(t,e,_t);return-Math.sign(t.relativeElevation)*(.5*Math.PI+F(t.eye,_t.direction))<ct.Angle?st.Vertical:st.Horizontal}function ft(t,e,n){M(ht,n,e),t.eye=M(Ot,t.eye,ht),t.center=M(Ot,t.center,ht)}const ht=P();function Mt(t,e,n,o){const a=B(e,n,$t);return!r(a)&&(V(t,a,yt),q(t,a,o)?!(x(yt,a.origin)<x(o,a.origin))||(p(o,yt),!1):(M(gt,e.eye,e.center),y(gt,gt),U(gt,-f(y(gt,gt),yt),dt),G(dt,a,o),!1))}const yt=P(),gt=P(),dt=H();function bt(r,a,i,s,c,m){let u;if(g(Yt,r,a),M(Qt,r,a),j(r)<=c||!s.aboveGround){g(i,Qt,s.eye);const l=f(r,a)/(j(r)*j(a)),p=Math.cos(n(t.normalize(e(m)),0,ut));u=-o(l)-Math.max(0,j(a)-c)/(p*c)}else M(jt,s.eye,s.center),g(i,Qt,jt),u=-j(Qt)/c;return y(i,i),h(i,i,j(Yt)),u}const jt=P();function vt(r,a,i,s){let c,m;const u=Math.cos(n(t.normalize(e(s)),0,ut));return c=a>i?-(a-i)/(u*i):a<-i?Math.PI-(a+i)/(u*i):o(a/i),m=r>i?-(r-i)/(u*i):r<-i?Math.PI-(r+i)/(u*i):o(r/i),(m-c)*i}function zt(t,e,n,o,r,a,i,s,c,m){const l=vt(t[2],e[2],i[3],c),p=m?vt(t[0],e[0],i[3],180):e[0]-t[0],h=Math.sin(s)*p-Math.cos(s)*l,M=Math.cos(s)*p+Math.sin(s)*l;y(Ot,r);const g=m?h/Math.sqrt(Math.abs(i[3]**2-f(n,Ot)**2)):h/i[3],d=M/Math.sqrt(Math.abs(i[3]**2-f(n,o)**2));u(a,g,d)}function xt(t,e,n,o,r,a,i,s,c,m){g(Yt,t,e),S(a.up,a.eye,Ct,Ft,Rt),S([0,0,1],a.eye,Ut,Vt,qt),p(n,Vt),p(o,Ut),y(n,n),h(n,n,j(Yt)),A(t,y(Ft,Ft),y(Rt,Rt),y(Ct,Ct),Tt),A(e,Ft,Rt,Ct,Wt),zt(Tt,Wt,t,Ut,Vt,r,i,s,c,m)}function Pt(t,e,n,o,r,a,c){i(Jt,r,o),i(Kt,c,a),s(Lt,Jt,Kt),M(e,t,n),d(e,e,Lt),b(e,e,n)}function kt(t,e,n,o,r,a){i(Jt,o,n),i(Kt,a,r),s(Lt,Jt,Kt),M(Ot,t.eye,e),d(Ot,Ot,Lt),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,Lt),t.center=b(Ot,Ot,e),M(Ot,t.up,e),d(Ot,Ot,Lt),t.up=b(Ot,Ot,e)}function It(t,e,n,o,r,a,i=mt.Pole,s=mt.Angle){const c=Math.abs(o)>Math.PI-s||Math.abs(o)<s,m=Math.abs(t[2])<n*i||Math.abs(e)>n;return!!(c&&m&&a.aboveGround&&r<mt.Tilt)}function wt(t,e,n,o,r,a){if(a)w(n,o,Dt),Z(e,t,Dt);else{const a=bt(n,o,Zt,e,t[3],r);Z(e,t,E(Zt,a))}}function Et(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let m,u;p(Nt,o),Xt.copyFrom(e);for(let l=0;l<s&&x(n,Nt)>c&&(m=x(n,Nt),xt(n,Nt,Vt,Ut,Bt,Xt,t,r,a,i),kt(Xt,t,Ut,Bt[1],Vt,Bt[0]),Pt(Nt,Nt,t,Ut,Bt[1],Vt,Bt[0]),u=x(n,Nt),u<m||0===l);l++)e.copyFrom(Xt)}function St(n,o,r,a,i,s,c){It(r,f(o.up,r),n[3],-t.normalize(e(i)),s,o,mt.Pole,mt.Angle)?Et(n,o,r,a,-t.normalize(e(i)),s,c):wt(n,o,r,a,s,c)}function At(t,e,n,o,r,a){const{eye:i}=t;S([0,0,1],i,Ut,Vt,qt);const s=e.translation[0]*n.pan,m="zoom"===r.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-f(t.center,Ut)**2/j(t.center)**2)),.5),l=(Math.sin(a)*m+Math.cos(a)*s)/u,p=-Math.cos(a)*m+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,l,Ut),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,p,Vt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ht(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=g(R.get(),i,a),m=e.translation[0]*n.pan;switch(0!==m&&(c(o.pan.matrix,o.pan.matrix,-m,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Gt(n,o,r,a,i,s,c,m,u){It(n.center,f(n.up,n.center),j(n.center),-t.normalize(e(s)),c,o)?At(o,r,a,m,u,-t.normalize(e(i))):Ht(o,r,a,m,u)}const Ut=P(),Vt=P(),qt=P(),Ct=P(),Ft=P(),Rt=P(),Tt=P(),Wt=P(),Bt=l(),Dt=k(),Jt=m(),Kt=m(),Lt=m(),Nt=P(),Ot=P(),Qt=P(),Xt=new J,Yt=P(),Zt=P(),$t={origin:P(),direction:P()},_t={origin:P(),direction:P()};export{N as DISTANCE_CLAMP_VALUES,st as NavigationMode,L as PIVOT_DISTANCE_MODIFIER,mt as PreservingHeadingThreshold,O as SCREEN_PIXEL_AREA,K as SpherePickPointFallback,ut as TiltThresholdPanningSpeed,ct as VerticalPanTresholds,ft as applyPanPlanar,wt as applyPanSphericalDirectRotation,Et as applyPanSphericalPreserveHeading,Z as applyRotation,kt as applyRotationWithTwoAxes,et as applyZoomOnSphere,tt as applyZoomToPoint,rt as centroid,ot as centroidOnSphere,pt as decideNavigationMode,$ as intersectPlaneFromScreenPoint,_ as intersectPlaneFromScreenPointAtEye,vt as lengthFromPoints,Q as normalizeCoordinate,Y as normalizeRotationDelta,it as offSurfaceTiltToEyeTiltGlobal,at as onSurfaceTiltToEyeTiltGlobal,Gt as panMotionToRotationMatrix,St as panToPosition,lt as pickPointAndInitSphere,It as preserveHeadingThreshold,Pt as rotatePointAroundTwoAxes,bt as rotationAngleAndAxisDirectRotation,xt as rotationAnglesAndAxesHeadingPreserving,zt as rotationAnglesHeadingPreserving,X as rotationFromPointsAroundAxis,Mt as sphereOrPlanePointFromScreenPoint};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o}from"../../../../core/mathUtils.js";import{isNone as r}from"../../../../core/maybe.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{d as i,m as s,e as c}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{a as u}from"../../../../chunks/vec2.js";import{a as l}from"../../../../chunks/vec2f64.js";import{c as p,e as f,g as h,b as M,n as y,f as g,m as d,a as b,l as j,h as v,s as z,d as x}from"../../../../chunks/vec3.js";import{c as P}from"../../../../chunks/vec3f64.js";import{create as k,axis as I,fromPoints as w,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as S,vectorCoordinates as A}from"../../../../geometry/support/coordinateSystem.js";import{create as H,intersectRay as G,fromNormalAndOffset as U}from"../../../../geometry/support/plane.js";import{j as V,h as q,c as C}from"../../../../chunks/sphere.js";import{angle as F}from"../../../../geometry/support/vector.js";import{sv3d as R,sm4d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as W,fromScreenAtEye as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import{Camera as J}from"../../webgl-engine/lib/Camera.js";var K;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(K||(K={}));const L=30,N=[1,3e8],O=70;function Q(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function X(t,e,n){const o=R.get(),r=R.get(),a=R.get();p(r,t),p(a,e);const i=f(r,n),s=f(a,n);h(o,n,i),M(r,r,o),y(r,r),h(o,n,s),M(a,a,o),y(a,a);const c=f(r,a);g(o,n,r);const m=f(a,o);return Math.atan2(m,c)}function Y(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function Z(t,e,n){const o=i(T.get(),n[3],I(n));r(o)||(M(Ot,t.eye,e),d(Ot,Ot,o),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,o),t.center=b(Ot,Ot,e),t.up=d(Ot,t.up,o))}function $(t,e,n,o){return G(t,W(e,n,$t),o)}function _(t,e,n,o){return G(t,B(e,n,$t),o)}function tt(t,e,n,o){const r=R.get();let a=1-n;M(r,e,t.eye);const i=j(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(h(r,r,a),t.eye=b(Ot,t.eye,r),t.center=v(Ot,t.center,e,a))}function et(t,e,n){e.getScreenCenter(nt),D(t,e,nt,Ot)&&(e.center=Ot);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=h(R.get(),e.viewForward,r);e.eye=M(Ot,e.center,a)}const nt=a();function ot(t,e,n){rt(e,n),y(n,n),h(n,n,t)}function rt(t,e){z(e,0,0,0);for(const n of t)b(e,e,n);h(e,e,1/t.length)}function at(t,e,n,o){return Math.sin(t/j(e))*(n+o.radius)}function it(t,e,n,o){return at(Math.PI/2,e,n,o)+(t-Math.PI/2)}var st;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(st||(st={}));const ct={Elevation:3e4,Angle:e(6)},mt={Pole:.95,Angle:e(18),Tilt:45},ut=e(80);function lt(t,e,n,o,r,a){const i=P(),s=C();let c=!0,m=!0;return t.intersectScreen(n,i,a)?s[3]=j(i):(m=!1,e.aboveGround&&r!==K.Ellipsoid?s[3]=Math.max(j(e.center),.9*o.radius):s[3]=j(e.eye)-e.relativeElevation,r===K.Silhouette?Mt(s,e,n,i):c=D(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:m}}function pt(t,e,n,o){if(j(t.eye)-o.radius>ct.Elevation)return st.Horizontal;if(!n)return st.Vertical;B(t,e,_t);return-Math.sign(t.relativeElevation)*(.5*Math.PI+F(t.eye,_t.direction))<ct.Angle?st.Vertical:st.Horizontal}function ft(t,e,n){M(ht,n,e),t.eye=M(Ot,t.eye,ht),t.center=M(Ot,t.center,ht)}const ht=P();function Mt(t,e,n,o){const a=B(e,n,$t);return!r(a)&&(V(t,a,yt),q(t,a,o)?!(x(yt,a.origin)<x(o,a.origin))||(p(o,yt),!1):(M(gt,e.eye,e.center),y(gt,gt),U(gt,-f(y(gt,gt),yt),dt),G(dt,a,o),!1))}const yt=P(),gt=P(),dt=H();function bt(r,a,i,s,c,m){let u;if(g(Yt,r,a),M(Qt,r,a),j(r)<=c||!s.aboveGround){g(i,Qt,s.eye);const l=f(r,a)/(j(r)*j(a)),p=Math.cos(n(t.normalize(e(m)),0,ut));u=-o(l)-Math.max(0,j(a)-c)/(p*c)}else M(jt,s.eye,s.center),g(i,Qt,jt),u=-j(Qt)/c;return y(i,i),h(i,i,j(Yt)),u}const jt=P();function vt(r,a,i,s){let c,m;const u=Math.cos(n(t.normalize(e(s)),0,ut));return c=a>i?-(a-i)/(u*i):a<-i?Math.PI-(a+i)/(u*i):o(a/i),m=r>i?-(r-i)/(u*i):r<-i?Math.PI-(r+i)/(u*i):o(r/i),(m-c)*i}function zt(t,e,n,o,r,a,i,s,c,m){const l=vt(t[2],e[2],i[3],c),p=m?vt(t[0],e[0],i[3],180):e[0]-t[0],h=Math.sin(s)*p-Math.cos(s)*l,M=Math.cos(s)*p+Math.sin(s)*l;y(Ot,r);const g=m?h/Math.sqrt(Math.abs(i[3]**2-f(n,Ot)**2)):h/i[3],d=M/Math.sqrt(Math.abs(i[3]**2-f(n,o)**2));u(a,g,d)}function xt(t,e,n,o,r,a,i,s,c,m){g(Yt,t,e),S(a.up,a.eye,Ct,Ft,Rt),S([0,0,1],a.eye,Ut,Vt,qt),p(n,Vt),p(o,Ut),y(n,n),h(n,n,j(Yt)),A(t,y(Ft,Ft),y(Rt,Rt),y(Ct,Ct),Tt),A(e,Ft,Rt,Ct,Wt),zt(Tt,Wt,t,Ut,Vt,r,i,s,c,m)}function Pt(t,e,n,o,r,a,c){i(Jt,r,o),i(Kt,c,a),s(Lt,Jt,Kt),M(e,t,n),d(e,e,Lt),b(e,e,n)}function kt(t,e,n,o,r,a){i(Jt,o,n),i(Kt,a,r),s(Lt,Jt,Kt),M(Ot,t.eye,e),d(Ot,Ot,Lt),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,Lt),t.center=b(Ot,Ot,e),M(Ot,t.up,e),d(Ot,Ot,Lt),t.up=b(Ot,Ot,e)}function It(t,e,n,o,r,a,i=mt.Pole,s=mt.Angle){const c=Math.abs(o)>Math.PI-s||Math.abs(o)<s,m=Math.abs(t[2])<n*i||Math.abs(e)>n;return!!(c&&m&&a.aboveGround&&r<mt.Tilt)}function wt(t,e,n,o,r,a){if(a)w(n,o,Dt),Z(e,t,Dt);else{const a=bt(n,o,Zt,e,t[3],r);Z(e,t,E(Zt,a))}}function Et(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let m,u;p(Nt,o),Xt.copyFrom(e);for(let l=0;l<s&&x(n,Nt)>c&&(m=x(n,Nt),xt(n,Nt,Vt,Ut,Bt,Xt,t,r,a,i),kt(Xt,t,Ut,Bt[1],Vt,Bt[0]),Pt(Nt,Nt,t,Ut,Bt[1],Vt,Bt[0]),u=x(n,Nt),u<m||0===l);l++)e.copyFrom(Xt)}function St(n,o,r,a,i,s,c){It(r,f(o.up,r),n[3],-t.normalize(e(i)),s,o,mt.Pole,mt.Angle)?Et(n,o,r,a,-t.normalize(e(i)),s,c):wt(n,o,r,a,s,c)}function At(t,e,n,o,r,a){const{eye:i}=t;S([0,0,1],i,Ut,Vt,qt);const s=e.translation[0]*n.pan,m="zoom"===r.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-f(t.center,Ut)**2/j(t.center)**2)),.5),l=(Math.sin(a)*m+Math.cos(a)*s)/u,p=-Math.cos(a)*m+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,l,Ut),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,p,Vt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ht(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=g(R.get(),i,a),m=e.translation[0]*n.pan;switch(0!==m&&(c(o.pan.matrix,o.pan.matrix,-m,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Gt(n,o,r,a,i,s,c,m,u){It(n.center,f(n.up,n.center),j(n.center),-t.normalize(e(s)),c,o)?At(o,r,a,m,u,-t.normalize(e(i))):Ht(o,r,a,m,u)}const Ut=P(),Vt=P(),qt=P(),Ct=P(),Ft=P(),Rt=P(),Tt=P(),Wt=P(),Bt=l(),Dt=k(),Jt=m(),Kt=m(),Lt=m(),Nt=P(),Ot=P(),Qt=P(),Xt=new J,Yt=P(),Zt=P(),$t={origin:P(),direction:P()},_t={origin:P(),direction:P()};export{N as DISTANCE_CLAMP_VALUES,st as NavigationMode,L as PIVOT_DISTANCE_MODIFIER,mt as PreservingHeadingThreshold,O as SCREEN_PIXEL_AREA,K as SpherePickPointFallback,ut as TiltThresholdPanningSpeed,ct as VerticalPanTresholds,ft as applyPanPlanar,wt as applyPanSphericalDirectRotation,Et as applyPanSphericalPreserveHeading,Z as applyRotation,kt as applyRotationWithTwoAxes,et as applyZoomOnSphere,tt as applyZoomToPoint,rt as centroid,ot as centroidOnSphere,pt as decideNavigationMode,$ as intersectPlaneFromScreenPoint,_ as intersectPlaneFromScreenPointAtEye,vt as lengthFromPoints,Q as normalizeCoordinate,Y as normalizeRotationDelta,it as offSurfaceTiltToEyeTiltGlobal,at as onSurfaceTiltToEyeTiltGlobal,Gt as panMotionToRotationMatrix,St as panToPosition,lt as pickPointAndInitSphere,It as preserveHeadingThreshold,Pt as rotatePointAroundTwoAxes,bt as rotationAngleAndAxisDirectRotation,xt as rotationAnglesAndAxesHeadingPreserving,zt as rotationAnglesHeadingPreserving,X as rotationFromPointsAroundAxis,Mt as sphereOrPlanePointFromScreenPoint};