@arcgis/core 4.24.0 → 4.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{aa14e999e03ccb770455.js → 48576ac3dd2efaa25141.js} +1 -1
- package/assets/esri/core/workers/chunks/{6a02a75e935af0fc2b2b.js → a68428fde8bc960da276.js} +1 -1
- package/assets/esri/core/workers/chunks/{e5c8584ae764892c324d.js → d1bc85b78d6f217b022a.js} +1 -1
- package/assets/esri/themes/base/widgets/_Editor.scss +6 -0
- package/assets/esri/themes/base/widgets/_SnappingControls.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ar.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bg.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bs.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ca.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_cs.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_da.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_de.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_el.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_es.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_et.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fi.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_he.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hu.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_id.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_it.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ja.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ko.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lt.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lv.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nb.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-BR.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-PT.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ro.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ru.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sk.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sv.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_th.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_tr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_uk.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_vi.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-CN.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-HK.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-TW.json +1 -1
- package/chunks/BlendLayers.glsl.js +4 -4
- package/config.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/webgl/context-util.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
- package/widgets/support/SnappingControls/SnappingLayerListViewModel.js +1 -1
- package/widgets/support/SnappingControls/SnappingListItem.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"تبديل خريطة الأساس","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"تبديل خريطة الأساس","incompatibleSpatialReference":"تحتوي خريطة الأساس هذه على إسناد مكاني غير متوافق"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Превключване на базова карта","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Превключване на базова карта","incompatibleSpatialReference":"Тази базова карта има несъвместима пространствена препратка"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Prebaci kartografsku podlogu","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Prebaci kartografsku podlogu","incompatibleSpatialReference":"Ova kartografska podloga sadrži nekompatibilnu prostornu referencu"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Activa o desactiva el mapa base","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Activa o desactiva el mapa base","incompatibleSpatialReference":"Aquest mapa de base té una referència espacial no compatible"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Přepnout podkladovou mapu","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Přepnout podkladovou mapu","incompatibleSpatialReference":"Podkladová mapa nemá kompatibilní souřadnicový systém."}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Skift baggrundskort","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Skift baggrundskort","incompatibleSpatialReference":"Dette baggrundskortet har en inkompatibel spatial reference"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Grundkarte wechseln","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Grundkarte wechseln","incompatibleSpatialReference":"Diese Grundkarte weist einen nicht kompatiblen Raumbezug auf."}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Εναλλαγή υποβάθρου","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Εναλλαγή υποβάθρου","incompatibleSpatialReference":"Αυτός ο βασικός χάρτης έχει μια μη συμβατή χωρική αναφορά"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Cambiar el mapa base","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Cambiar el mapa base","incompatibleSpatialReference":"Este mapa base tiene una referencia espacial incompatible"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Vaheta aluskaarti","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Vaheta aluskaarti","incompatibleSpatialReference":"Aluskaardil on ühildumatu koordinaatsüsteem"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Vaihda taustakarttaa","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Vaihda taustakarttaa","incompatibleSpatialReference":"Tässä taustakartassa on yhteensopimaton koordinaatistotieto"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Basculer le fond de carte","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Basculer le fond de carte","incompatibleSpatialReference":"Ce fond de carte possède une référence spatiale incompatible"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"הדלק או כבה מפת בסיס","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"הדלק או כבה מפת בסיס","incompatibleSpatialReference":"למפת בסיס זו יש ייחוס מרחבי לא תואם"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Prebaci kartografsku podlogu","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Prebaci kartografsku podlogu","incompatibleSpatialReference":"Ova kartografska podloga sadrži nekompatibilnu prostornu referencu"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Alaptérkép átváltása","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Alaptérkép átváltása","incompatibleSpatialReference":"Ez az alaptérkép egy nem kompatibilis térbeli referenciával rendelkezik"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Nyalakan/Matikan peta dasar","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Nyalakan/Matikan peta dasar","incompatibleSpatialReference":"Peta dasar ini memiliki referensi spasial yang tidak kompatibel"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Attiva/disattiva mappa di base","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Attiva/disattiva mappa di base","incompatibleSpatialReference":"Questa mappa di base ha un riferimento spaziale incompatibile"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"ベースマップの切り替え","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"ベースマップの切り替え","incompatibleSpatialReference":"このベースマップの空間参照は互換性がありません"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"베이스맵 토글","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"베이스맵 토글","incompatibleSpatialReference":"이 베이스맵에 호환되지 않는 공간 기준 체계가 있습니다."}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Perjungti pagrindo žemėlapį","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Perjungti pagrindo žemėlapį","incompatibleSpatialReference":"Šis pagrindo žemėlapis turi nesuderinamą erdvinę nuorodą"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Pārslēgt pamatkarti","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Pārslēgt pamatkarti","incompatibleSpatialReference":"Šai pamatkartei ir nesaderīga telpiskā atskaite"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Veksle mellom bakgrunnskart","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Veksle mellom bakgrunnskart","incompatibleSpatialReference":"Dette bakgrunnskartet har en inkompatibel romlig referanse"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Basiskaart in- en uitschakelen","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Basiskaart in- en uitschakelen","incompatibleSpatialReference":"Deze basiskaart heeft een incompatibele ruimtelijke referentie"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Przełącz mapę bazową","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Przełącz mapę bazową","incompatibleSpatialReference":"Ta mapa bazowa ma niezgodne odniesienie przestrzenne"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Alternar mapa base","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Alternar mapa base","incompatibleSpatialReference":"Este mapa base tem uma referência espacial incompatível"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Alternar mapa base","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Alternar mapa base","incompatibleSpatialReference":"Este mapa base contém uma referência espacial incompatível"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Comutare hartă fundal","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Comutare hartă fundal","incompatibleSpatialReference":"Această hartă de fundal are o referință spațială incompatibilă"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Переключить базовую карту","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Переключить базовую карту","incompatibleSpatialReference":"Пространственная привязка данной базовой карты несовместима."}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Prepnúť podkladovú mapu","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Prepnúť podkladovú mapu","incompatibleSpatialReference":"Táto podkladová mapa má nekompatibilný priestorový referenčný systém"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Preklopi temeljno karto","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Preklopi temeljno karto","incompatibleSpatialReference":"Ta temeljna karta ima nezdružljiv koordinatni sistem"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Uklj./isklj. pozadinsku mapu","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Uklj./isklj. pozadinsku mapu","incompatibleSpatialReference":"Ova pozadinska mapa ima nekompatibilnu prostornu referencu"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Växla baskarta","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Växla baskarta","incompatibleSpatialReference":"Den här baskartan har en inkompatibel spatial referens"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"ปุ่มสำหรับเปิดปิดแผนที่ฐาน","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"ปุ่มสำหรับเปิดปิดแผนที่ฐาน","incompatibleSpatialReference":"แผนที่ฐานนี้มีการอ้างอิงเชิงพื้นที่ที่ไม่สามารถใช้งานร่วมกันได้"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Altlık haritayı aç/kapat","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Altlık haritayı aç/kapat","incompatibleSpatialReference":"Bu altlık haritada uyumsuz bir mekânsal referans var"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Перемикнути базову карту","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Перемикнути базову карту","incompatibleSpatialReference":"Ця базова карта має несумісну просторову прив'язку"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Chuyển đổi bản đồ nền","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"Chuyển đổi bản đồ nền","incompatibleSpatialReference":"Bản đồ nền này có tham chiếu không gian không tương thích"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"切换底图","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"切换底图","incompatibleSpatialReference":"此底图具有不兼容的空间参考"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"切換底圖","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"切換底圖","incompatibleSpatialReference":"此底圖具有不相容的空間參考"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"切換底圖","incompatibleSpatialReference":"
|
|
1
|
+
{"widgetLabel":"切換底圖","incompatibleSpatialReference":"此底圖具有不相容的空間參考"}
|
|
@@ -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 = ${
|
|
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 = ${
|
|
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.
|
|
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.3";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/package.json
CHANGED
package/support/revision.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
|
-
const
|
|
5
|
+
const a="20220627",b="b9a439db8314444a64e506afd8c7bd048e9f7c61";export{a as buildDate,b 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"
|
|
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{disposeMaybe as t}from"../../../../core/maybe.js";import{t as s}from"../../../../chunks/common.js";import{h as i,d as r,r as e,c as o}from"../../../../chunks/mat3.js";import{c as a}from"../../../../chunks/mat3f32.js";import{f as n}from"../../../../chunks/vec2f64.js";import{s as h}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import c from"./VertexStream.js";import{stencil as d}from"./shaders/StencilPrograms.js";import{StencilOperation as p,CompareFunction as _}from"../../../webgl/enums.js";import{createProgram as
|
|
5
|
+
import{disposeMaybe as t}from"../../../../core/maybe.js";import{t as s}from"../../../../chunks/common.js";import{h as i,d as r,r as e,c as o}from"../../../../chunks/mat3.js";import{c as a}from"../../../../chunks/mat3f32.js";import{f as n}from"../../../../chunks/vec2f64.js";import{s as h}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import c from"./VertexStream.js";import{stencil as d}from"./shaders/StencilPrograms.js";import{StencilOperation as p,CompareFunction as _}from"../../../webgl/enums.js";import{createProgram as l}from"../../../webgl/ProgramTemplate.js";const u=n(-.5,-.5);class f{constructor(){this._centerNdc=m(),this._pxToNdc=m(),this._worldDimensionsPx=m(),this._mat3=a(),this._initialized=!1}dispose(){this._program=t(this._program),this._quad=t(this._quad)}render(t,s){const{context:i}=t;return!!this._updateGeometry(t,s)&&(this._initialized||this._initialize(i),i.setDepthWriteEnabled(!1),i.setDepthTestEnabled(!1),i.setColorMask(!1,!1,!1,!1),i.setBlendingEnabled(!1),i.setStencilOp(p.KEEP,p.KEEP,p.REPLACE),i.setStencilFunction(_.ALWAYS,1,255),i.setStencilTestEnabled(!0),i.useProgram(this._program),this._program.setUniformMatrix3fv("u_worldExtent",this._mat3),this._quad.draw(),this._quad.unbind(),!0)}_initialize(t){if(this._initialized)return;const s=l(t,d);s&&(this._program=s,this._quad=new c(t,[0,0,1,0,0,1,1,1]),this._initialized=!0)}_updateGeometry(t,a){const{state:n,pixelRatio:m}=t,{size:c,rotation:d}=n,p=Math.round(c[0]*m),_=Math.round(c[1]*m);if(!n.spatialReference.isWrappable)return!1;const l=s(d),f=Math.abs(Math.cos(l)),b=Math.abs(Math.sin(l)),g=Math.round(p*f+_*b),x=Math.round(n.worldScreenWidth);if(g<=x)return!1;const j=p*b+_*f,E=x*m,M=(a.left-a.right)*m/p,w=(a.bottom-a.top)*m/_;h(this._worldDimensionsPx,E,j,1),h(this._pxToNdc,2/p,-2/_,1),h(this._centerNdc,M,w,1);const P=this._mat3;return i(P,this._centerNdc),r(P,P,this._pxToNdc),0!==d&&e(P,P,l),r(P,P,this._worldDimensionsPx),o(P,P,u),!0}}export{f as WorldExtentClipRenderer};
|
|
@@ -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
|
|
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};
|