@maplat/ui 0.10.6 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/LICENSE +223 -223
  2. package/README.md +128 -91
  3. package/assets/locales/de/translation.json +71 -0
  4. package/{locales → assets/locales}/en/translation.json +70 -64
  5. package/{locales → assets/locales}/ja/translation.json +70 -64
  6. package/{locales → assets/locales}/ko/translation.json +71 -65
  7. package/assets/locales/vi/translation.json +71 -0
  8. package/{locales → assets/locales}/zh/translation.json +71 -65
  9. package/{locales → assets/locales}/zh-TW/translation.json +71 -65
  10. package/assets/parts/attr.png +0 -0
  11. package/assets/parts/border.png +0 -0
  12. package/assets/parts/compass.png +0 -0
  13. package/assets/parts/gps.png +0 -0
  14. package/assets/parts/help.png +0 -0
  15. package/assets/parts/hide_marker.png +0 -0
  16. package/assets/parts/home.png +0 -0
  17. package/assets/parts/marker_list.png +0 -0
  18. package/assets/parts/share.png +0 -0
  19. package/dist/absolute_url.d.ts +1 -0
  20. package/dist/assets/locales/de/translation.json +71 -0
  21. package/dist/assets/locales/en/translation.json +70 -64
  22. package/dist/assets/locales/ja/translation.json +70 -64
  23. package/dist/assets/locales/ko/translation.json +71 -65
  24. package/dist/assets/locales/vi/translation.json +71 -0
  25. package/dist/assets/locales/zh/translation.json +71 -65
  26. package/dist/assets/locales/zh-TW/translation.json +71 -65
  27. package/dist/contextmenu.d.ts +5 -0
  28. package/dist/function.d.ts +2 -0
  29. package/dist/icons.d.ts +7 -0
  30. package/dist/index.d.ts +65 -0
  31. package/dist/maplat-ui.es.js +33551 -0
  32. package/dist/maplat-ui.umd.js +4934 -0
  33. package/dist/maplat_control.d.ts +55 -0
  34. package/dist/pointer_images.d.ts +2 -0
  35. package/dist/swiper_ex.d.ts +2 -0
  36. package/dist/types.d.ts +185 -0
  37. package/dist/ui_init.d.ts +4 -0
  38. package/dist/ui_marker.d.ts +9 -0
  39. package/dist/ui_utils.d.ts +9 -0
  40. package/less/bootstrap.less +7010 -7010
  41. package/less/contextmenu.css +8 -0
  42. package/less/font-awesome.less +51 -31
  43. package/less/iziToast.less +1732 -1732
  44. package/less/maplat-specific.less +1038 -652
  45. package/less/swiper4.css +715 -0
  46. package/less/ui.less +11 -11
  47. package/less/ui_packed.less +10 -10
  48. package/package.json +80 -79
  49. package/src/{absolute_url.js → absolute_url.ts} +1 -1
  50. package/src/contextmenu/base.ts +170 -0
  51. package/src/contextmenu/constants.ts +66 -0
  52. package/src/contextmenu/cssVars.ts +13 -0
  53. package/src/contextmenu/helpers/dom.ts +295 -0
  54. package/src/contextmenu/helpers/mix.ts +120 -0
  55. package/src/contextmenu/html.ts +161 -0
  56. package/src/contextmenu/internal.ts +293 -0
  57. package/src/contextmenu.ts +40 -0
  58. package/src/function.ts +36 -0
  59. package/src/icons.ts +46 -0
  60. package/src/index.ts +521 -0
  61. package/src/maplat_control.ts +629 -0
  62. package/src/pointer_images.ts +101 -0
  63. package/src/{service-worker.js → service-worker/index.ts} +5 -6
  64. package/src/swiper_augment.d.ts +13 -0
  65. package/src/{swiper_ex.js → swiper_ex.ts} +14 -10
  66. package/src/types.d.ts +31 -0
  67. package/src/types.ts +202 -0
  68. package/src/ui_init.ts +1175 -0
  69. package/src/ui_marker.ts +376 -0
  70. package/src/ui_utils.ts +87 -0
  71. package/dist/assets/fonts/a8c0074cf70b152b56105e6c4b227bd8.woff +0 -0
  72. package/dist/assets/fonts/cfeff2e898a64ebe7e6b5ec078b174c3.woff +0 -0
  73. package/dist/assets/images/09c3ce5a86d600e24f8e85de3a019853.png +0 -0
  74. package/dist/assets/images/0beac2cb41dfab43ddfd9df80b32b85d.png +0 -0
  75. package/dist/assets/images/1354b4f40dd58bb0f2a4871cb4ff81d8.png +0 -0
  76. package/dist/assets/images/2a61e310e46b50b5f8ddd5e905ba9db9.png +0 -0
  77. package/dist/assets/images/3131423d782cd3ea89a81247065e7f9d.png +0 -0
  78. package/dist/assets/images/41b2cf0fa604d3f196ca52337d238219.jpg +0 -0
  79. package/dist/assets/images/558bc7e8b9b6c5f41a7141cddb8cdb5e.png +0 -0
  80. package/dist/assets/images/56f7003805ed02f8a21199947651db2e.png +0 -0
  81. package/dist/assets/images/5ba349e3596aca094c41c56966b45dc7.png +0 -0
  82. package/dist/assets/images/6111b8076a2cf81c73f0e46f41a3af60.png +0 -0
  83. package/dist/assets/images/6345ee67d554fbfbf484ba4035ad19d9.jpg +0 -0
  84. package/dist/assets/images/649fce122b354de2ac725ba5f2661955.png +0 -0
  85. package/dist/assets/images/6a580287dea82c2fb9b214321a375145.png +0 -0
  86. package/dist/assets/images/6c5dba7f7d76e74c3a8c7c5b1c3fc544.png +0 -0
  87. package/dist/assets/images/6e1f2f2f6fed3c5cddeb925e7ae75aba.png +0 -0
  88. package/dist/assets/images/799a0177b0dc540682fa4a2e349a8f4f.png +0 -0
  89. package/dist/assets/images/7bef6f357e921c43f4f800cfcb757872.png +0 -0
  90. package/dist/assets/images/7d9d643a903df6f57b8b7386316021e5.png +0 -0
  91. package/dist/assets/images/7df82bae917b68159f84998182f2fdc6.png +0 -0
  92. package/dist/assets/images/8e5d0335f6598b8d874ba23ea9fb295f.png +0 -0
  93. package/dist/assets/images/90c32e751366be22777f3fe40a53fe06.png +0 -0
  94. package/dist/assets/images/9247459937b9c882303962e42bd8d989.png +0 -0
  95. package/dist/assets/images/927c34e7b9b2f95c82ba477993117eaf.png +0 -0
  96. package/dist/assets/images/95e9ca8285131f8ccb6da5052093173c.png +0 -0
  97. package/dist/assets/images/9a243e0cb0fc43e2a016d5d3aaa330d5.png +0 -0
  98. package/dist/assets/images/9ac6d81f417d6a5626b7c8d5a087c32b.png +0 -0
  99. package/dist/assets/images/9d3a01c866095b8b3e8e63f9cf11dd51.png +0 -0
  100. package/dist/assets/images/9df733bcb29a746cb16b47eedea9fc3a.png +0 -0
  101. package/dist/assets/images/acc6eab0ba9c470ae20fb4b74135e865.png +0 -0
  102. package/dist/assets/images/b9ae27f0a01228380dff76a33b605707.jpg +0 -0
  103. package/dist/assets/images/ba48b220f61a6e1028f1854326f43acd.png +0 -0
  104. package/dist/assets/images/bf67cc860289b85c0402a4d4f890a3bd.png +0 -0
  105. package/dist/assets/images/c49f2344772e33256ba24d64b59b20d1.png +0 -0
  106. package/dist/assets/images/ca6b77b234b18e7bb9b1ccda774da286.png +0 -0
  107. package/dist/assets/images/cd213169df16398b0017450e31788d73.png +0 -0
  108. package/dist/assets/images/f101a0974972eeab41189185a5c5b225.png +0 -0
  109. package/dist/assets/images/f115726e6249018905cca51653e1262c.png +0 -0
  110. package/dist/assets/images/f7acb820d978ab2dd69e8bf695c574d1.png +0 -0
  111. package/dist/assets/images/ffea4dd10bf2506aa1e0cd4c61426b42.png +0 -0
  112. package/dist/assets/maplat.css +0 -19
  113. package/dist/assets/maplat.css.map +0 -1
  114. package/dist/assets/maplat.js +0 -3
  115. package/dist/assets/maplat.js.LICENSE.txt +0 -43
  116. package/dist/assets/maplat.js.map +0 -1
  117. package/dist/index.html +0 -125
  118. package/dist/service-worker.js +0 -3
  119. package/dist/service-worker.js.LICENSE.txt +0 -1
  120. package/dist/service-worker.js.map +0 -1
  121. package/fonts/clarenbd-webfont.woff +0 -0
  122. package/fonts/fontawesome-webfont.woff +0 -0
  123. package/legacy/bootstrap-native.js +0 -1935
  124. package/legacy/detect-element-resize.js +0 -153
  125. package/legacy/iziToast.js +0 -1301
  126. package/legacy/page.js +0 -1153
  127. package/legacy/qrcode.js +0 -616
  128. package/legacy/sprintf.js +0 -285
  129. package/less/font-face.less +0 -11
  130. package/less/font-face_packed.less +0 -11
  131. package/parts/attr.png +0 -0
  132. package/parts/blue_marker.png +0 -0
  133. package/parts/bluedot.png +0 -0
  134. package/parts/bluedot_small.png +0 -0
  135. package/parts/bluedot_transparent.png +0 -0
  136. package/parts/border.png +0 -0
  137. package/parts/compass.png +0 -0
  138. package/parts/defaultpin.png +0 -0
  139. package/parts/defaultpin_selected.png +0 -0
  140. package/parts/gps.png +0 -0
  141. package/parts/gsi.jpg +0 -0
  142. package/parts/gsi_ortho.jpg +0 -0
  143. package/parts/help.png +0 -0
  144. package/parts/hide_marker.png +0 -0
  145. package/parts/home.png +0 -0
  146. package/parts/osm.jpg +0 -0
  147. package/parts/red_marker.png +0 -0
  148. package/parts/redcircle.png +0 -0
  149. package/parts/share.png +0 -0
  150. package/src/contextmenu.js +0 -29
  151. package/src/freeze_locales.js +0 -337
  152. package/src/function.js +0 -22
  153. package/src/index.js +0 -1778
  154. package/src/index_packed.js +0 -8
  155. package/src/maplat_control.js +0 -808
  156. package/src/pointer_images.js +0 -81
  157. /package/{parts → assets/parts}/Maplat.png +0 -0
  158. /package/{parts → assets/parts}/all_right_reserved.png +0 -0
  159. /package/{parts → assets/parts}/basemap.png +0 -0
  160. /package/{parts → assets/parts}/cc0.png +0 -0
  161. /package/{parts → assets/parts}/cc_by-nc-nd.png +0 -0
  162. /package/{parts → assets/parts}/cc_by-nc-sa.png +0 -0
  163. /package/{parts → assets/parts}/cc_by-nc.png +0 -0
  164. /package/{parts → assets/parts}/cc_by-nd.png +0 -0
  165. /package/{parts → assets/parts}/cc_by-sa.png +0 -0
  166. /package/{parts → assets/parts}/cc_by.png +0 -0
  167. /package/{parts → assets/parts}/favicon.png +0 -0
  168. /package/{parts → assets/parts}/fullscreen.png +0 -0
  169. /package/{parts → assets/parts}/loading.png +0 -0
  170. /package/{parts → assets/parts}/loading_image.png +0 -0
  171. /package/{parts → assets/parts}/minus.png +0 -0
  172. /package/{parts → assets/parts}/no_image.png +0 -0
  173. /package/{parts → assets/parts}/overlay.png +0 -0
  174. /package/{parts → assets/parts}/pd.png +0 -0
  175. /package/{parts → assets/parts}/plus.png +0 -0
  176. /package/{parts → assets/parts}/slider.png +0 -0
package/src/index.ts ADDED
@@ -0,0 +1,521 @@
1
+ import { MaplatApp as Core } from "@maplat/core";
2
+ import "ol/ol.css";
3
+ import EventTarget from "ol/events/Target.js";
4
+ import { asArray } from "ol/color";
5
+
6
+ import { Swiper } from "./swiper_ex";
7
+ import { Navigation, Pagination } from "swiper";
8
+ import "swiper/swiper-bundle.css";
9
+ import page from "page";
10
+ import * as bsn from "bootstrap.native";
11
+ import "../less/ui.less";
12
+
13
+ import { uiInit } from "./ui_init";
14
+ import {
15
+ handleMarkerAction,
16
+ showContextMenu,
17
+ xyToMapIDs,
18
+ setHideMarker,
19
+ checkOverlayID,
20
+ handleMarkerActionById
21
+ } from "./ui_marker";
22
+ import type { SliderNew } from "./maplat_control";
23
+ import type ContextMenu from "./contextmenu";
24
+
25
+ import type { Pixel } from "ol/pixel";
26
+ import type { Coordinate } from "ol/coordinate";
27
+ import { resolveRelativeLink, ellips } from "./ui_utils";
28
+ import type { MaplatAppOption, RestoreState, SwiperInstance } from "./types";
29
+
30
+ Swiper.use([Navigation, Pagination]);
31
+
32
+ export class MaplatUi extends EventTarget {
33
+ static createObject(option: MaplatAppOption) {
34
+ const app = new MaplatUi(option);
35
+ return app.waitReady.then(() => app);
36
+ }
37
+
38
+ core?: Core;
39
+ appOption: MaplatAppOption;
40
+ waitReady!: Promise<void>;
41
+ waitReadyBridge: unknown;
42
+ pathThatSet?: string;
43
+ swipers: Record<string, SwiperInstance> = {};
44
+ mobile_if: boolean = false;
45
+ ui_func: string = "default";
46
+ datum: string = "default";
47
+ selected_layer: string = "default";
48
+ toms: number = 0;
49
+ cache_messages: Record<string, string> = {};
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ last_toast: any;
52
+ share_enable!: boolean;
53
+ sliderNew!: SliderNew;
54
+ baseSwiper!: SwiperInstance;
55
+ overlaySwiper!: SwiperInstance;
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ sliderCommon: any;
58
+ contextMenu!: ContextMenu;
59
+ splashPromise!: Promise<void>;
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ _selectCandidateSources?: Record<string, any>;
62
+ appEnvelope?: boolean;
63
+ restoring: boolean = false;
64
+ poiSwiper: SwiperInstance | undefined;
65
+ html!: string;
66
+ enablePoiHtmlNoScroll: boolean = false;
67
+ enableShare: boolean = false;
68
+ enableHideMarker: boolean = false;
69
+ enableBorder: boolean = false;
70
+ enableMarkerList: boolean = false;
71
+ disableNoimage: boolean = false;
72
+ alwaysGpsOn: boolean = false;
73
+ isTouch: boolean = false;
74
+ html_id_seed: string;
75
+ lastClickPixel: Pixel | undefined;
76
+ lastClickCoordinate: Coordinate | undefined;
77
+ lastGPSError: string | undefined;
78
+
79
+ constructor(appOption: MaplatAppOption) {
80
+ super();
81
+ this.html_id_seed = `${Math.floor(Math.random() * 9000) + 1000}`;
82
+ this.appOption = appOption;
83
+
84
+ if (appOption.stateUrl) {
85
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
+ page((ctx: any, _next: any) => {
87
+ let pathes = ctx.canonicalPath.split("#!");
88
+ let path = pathes.length > 1 ? pathes[1] : pathes[0];
89
+ console.log(
90
+ `[Debug] Page callback.Canonical: ${ctx.canonicalPath}, Path: ${path} `
91
+ );
92
+
93
+ pathes = path.split("?");
94
+ path = pathes[0];
95
+ if (path === this.pathThatSet) {
96
+ delete this.pathThatSet;
97
+ return;
98
+ }
99
+ const restore: RestoreState = {
100
+ transparency: 0,
101
+ position: {
102
+ rotation: 0
103
+ }
104
+ };
105
+ // Parse "s:map/x:100/..."
106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
107
+ path.split("/").forEach((state: any) => {
108
+ if (!state) return;
109
+ const line = state.split(":");
110
+ console.log(`[Debug] Parsing state: ${state} `, line);
111
+ switch (line[0]) {
112
+ case "s":
113
+ restore.mapID = line[1];
114
+ break;
115
+ case "b":
116
+ restore.backgroundID = line[1];
117
+ break;
118
+ case "t":
119
+ restore.transparency = parseFloat(line[1]);
120
+ break;
121
+ case "r":
122
+ restore.position!.rotation = parseFloat(line[1]);
123
+ break;
124
+ case "z":
125
+ restore.position!.zoom = parseFloat(line[1]);
126
+ break;
127
+ case "x":
128
+ restore.position!.x = parseFloat(line[1]);
129
+ break;
130
+ case "y":
131
+ restore.position!.y = parseFloat(line[1]);
132
+ break;
133
+ case "sb":
134
+ restore.showBorder = !!parseInt(line[1]);
135
+ break;
136
+ case "hm":
137
+ restore.hideMarker = !!parseInt(line[1]);
138
+ break;
139
+ case "hl":
140
+ restore.hideLayer = line[1];
141
+ break;
142
+ case "om":
143
+ restore.openedMarker = line[1];
144
+ break;
145
+ case "c":
146
+ if (this.core) {
147
+ const modalElm =
148
+ this.core!.mapDivDocument!.querySelector(".modalBase")!;
149
+ const modal = new bsn.Modal(modalElm, {
150
+ root: this.core!.mapDivDocument!
151
+ });
152
+ modal.hide();
153
+ }
154
+ break;
155
+ case "mobile_if":
156
+ this.mobile_if = line[1] === "true";
157
+ break;
158
+ }
159
+ });
160
+ if (!this.core) {
161
+ if (restore.mapID) {
162
+ console.log(
163
+ `[Debug] Init with restore: `,
164
+ JSON.parse(JSON.stringify(restore))
165
+ );
166
+ appOption.restore = restore;
167
+ this.restoring = true;
168
+ }
169
+ const preRot = restore.position
170
+ ? restore.position.rotation
171
+ : "undefined";
172
+ console.log(`[Debug] Before initializer: rotation = ${preRot} `);
173
+
174
+ this.initializer(appOption).then(() => {
175
+ this.core!.waitReady.then(() => {
176
+ // Fix: Manually apply rotation as Core 0.11.1 preserves it but fails to apply it view-side
177
+ // if (restore.position && restore.position.rotation !== undefined) {
178
+ // console.log(`[Debug] Manually applying rotation: ${ restore.position.rotation } `);
179
+ // this.core!.mapObject.getView().setRotation(restore.position.rotation);
180
+ // }
181
+ // Fix: Verify transparency state before updating URL
182
+ if (this.sliderNew) {
183
+ // Ensure map transparency matches restore if slider is ready
184
+ const currentTrans = this.sliderNew.get("slidervalue") * 100;
185
+ console.log(`[Debug] Slider transparency: ${currentTrans} `);
186
+ } else {
187
+ console.log(`[Debug] Slider not ready yet`);
188
+ }
189
+
190
+ this.restoring = false;
191
+ console.log(`[Debug] Calling updateUrl from Init`);
192
+ this.updateUrl();
193
+ });
194
+ });
195
+ } else if (restore.mapID) {
196
+ console.log(
197
+ `[Debug] ChangeMap with restore: `,
198
+ JSON.parse(JSON.stringify(restore))
199
+ );
200
+ this.restoring = true;
201
+
202
+ this.core!.waitReady.then(() => {
203
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
204
+ const ret = this.core!.changeMap(restore.mapID!, restore as any);
205
+ Promise.resolve(ret).then(() => {
206
+ // Fix: Manually apply rotation after changeMap
207
+ // if (restore.position && restore.position.rotation !== undefined) {
208
+ // console.log(`[Debug] Manually applying rotation after changeMap: ${ restore.position.rotation } `);
209
+ // this.core!.mapObject.getView().setRotation(restore.position.rotation);
210
+ // }
211
+
212
+ // Update transparency slider if needed
213
+ if (this.sliderNew) {
214
+ const t = restore.transparency || 0;
215
+ const val = t / 100;
216
+ this.sliderNew.set("slidervalue", val);
217
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
218
+ if ((this.sliderNew as any).element) {
219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
220
+ (this.sliderNew as any).element.value = (1 - val).toString();
221
+ }
222
+ }
223
+
224
+ this.restoring = false;
225
+ console.log(`[Debug] Calling updateUrl from ChangeMap`);
226
+ this.updateUrl();
227
+ });
228
+ });
229
+ }
230
+ });
231
+ page({
232
+ hashbang: true
233
+ });
234
+ page();
235
+ this.waitReady = new Promise((resolve, _reject) => {
236
+ this.waitReadyBridge = resolve;
237
+ });
238
+ } else {
239
+ this.waitReady = this.initializer(appOption);
240
+ }
241
+ }
242
+
243
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
244
+ async initializer(appOption: any) {
245
+ return uiInit(this, appOption);
246
+ }
247
+
248
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
249
+ handleMarkerAction(data: any) {
250
+ handleMarkerAction(this, data);
251
+ }
252
+
253
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
254
+ showContextMenu(list: any[]) {
255
+ showContextMenu(this, list);
256
+ }
257
+
258
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
259
+ async xyToMapIDs(xy: any, threshold = 10) {
260
+ return xyToMapIDs(this, xy, threshold);
261
+ }
262
+
263
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
264
+ setShowBorder(flag: any) {
265
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
+ this.core!.requestUpdateState({ showBorder: flag ? 1 : 0 } as any);
267
+ this.updateEnvelope();
268
+ if (flag) {
269
+ this.core!.mapDivDocument!.classList.add("show-border");
270
+ } else {
271
+ this.core!.mapDivDocument!.classList.remove("show-border");
272
+ }
273
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
274
+ if (this.core!.restoreSession as any) {
275
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
276
+ this.core!.requestUpdateState({ showBorder: flag ? 1 : 0 } as any);
277
+ }
278
+ }
279
+
280
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
281
+ setHideMarker(flag: any) {
282
+ setHideMarker(this, flag);
283
+ }
284
+
285
+ handleMarkerActionById(markerId: string) {
286
+ handleMarkerActionById(this, markerId);
287
+ }
288
+
289
+ updateUrl() {
290
+ if (!this.appOption.stateUrl) return;
291
+ if (this.restoring) return;
292
+
293
+ const map = this.core!.mapObject;
294
+ if (!map) return;
295
+ const view = map.getView();
296
+ const center = view.getCenter();
297
+ const zoom = view.getZoom();
298
+ const rotation = view.getRotation();
299
+
300
+ const currentMap = this.core!.from ? this.core!.from.mapID : "";
301
+ if (!currentMap) return;
302
+
303
+ // Background ID
304
+ let backMap = "";
305
+ if (this.baseSwiper) {
306
+ const slide = this.baseSwiper.slides[this.baseSwiper.activeIndex];
307
+
308
+ if (slide) {
309
+ backMap = slide.getAttribute("data") || "";
310
+ }
311
+ }
312
+
313
+ const transparency = this.sliderNew
314
+ ? this.sliderNew.get("slidervalue") * 100
315
+ : 0;
316
+
317
+ // Legacy format: s:map/b:back/... (no leading slash, prepended with #!)
318
+ let path = `s:${currentMap}`;
319
+
320
+ if (backMap && backMap !== currentMap) {
321
+ path += `/b:${backMap}`;
322
+ }
323
+
324
+ if (transparency > 0) {
325
+ path += `/t:${transparency}`;
326
+ }
327
+
328
+ path += `/x:${center[0]}`;
329
+ path += `/y:${center[1]}`;
330
+ path += `/z:${zoom}`;
331
+
332
+ if (rotation !== 0) {
333
+ path += `/r:${(rotation * 180) / Math.PI}`;
334
+ }
335
+
336
+ // Options
337
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
338
+ if ((this.core!.stateBuffer as any).showBorder) path += `/sb:1`;
339
+ if (this.core!.mapDivDocument!.classList.contains("hide-marker"))
340
+ path += `/hm:1`;
341
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
342
+ if (this.enableMarkerList && (this.core!.stateBuffer as any).markerList)
343
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
344
+ path += `/om:${(this.core!.stateBuffer as any).markerList}`;
345
+
346
+ if (this.pathThatSet !== path) {
347
+ this.pathThatSet = path;
348
+ page(`#!${path}`);
349
+ }
350
+ }
351
+
352
+ updateEnvelope() {
353
+ if (!this.core!.mapObject) return;
354
+
355
+ this.core!.mapObject.resetEnvelope();
356
+ if (this._selectCandidateSources) {
357
+ Object.keys(this._selectCandidateSources).forEach(key => {
358
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
359
+ if ((this.core!.mapObject as any).removeEnvelope) {
360
+ console.log(`[Debug] Removing envelope for ${key}`);
361
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
362
+ (this.core!.mapObject as any).removeEnvelope(
363
+ this._selectCandidateSources![key]
364
+ );
365
+ }
366
+ });
367
+ }
368
+
369
+ this._selectCandidateSources = {};
370
+
371
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
372
+ if ((this.core!.stateBuffer as any).showBorder) {
373
+ if (!this.core!.from) return;
374
+
375
+ let activeOverlayId: string | null = null;
376
+ if (this.overlaySwiper) {
377
+ const slide = this.overlaySwiper.slides[this.overlaySwiper.activeIndex];
378
+ if (slide) activeOverlayId = slide.getAttribute("data");
379
+ }
380
+
381
+ Object.keys(this.core!.cacheHash!)
382
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
383
+ .filter((key: any) => this.core!.cacheHash[key].envelope)
384
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
385
+ .map((key: any) => {
386
+ const source = this.core!.cacheHash[key];
387
+ const isActive = key === activeOverlayId;
388
+
389
+ const xyPromises =
390
+ key === this.core!.from!.mapID &&
391
+ typeof source.xy2SysCoord === "function"
392
+ ? [
393
+ [0, 0],
394
+ [source.width, 0],
395
+ [source.width, source.height],
396
+ [0, source.height],
397
+ [0, 0]
398
+ ].map(xy => Promise.resolve(source.xy2SysCoord(xy)))
399
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
400
+ source.envelope.geometry.coordinates[0].map((coord: any) =>
401
+ this.core!.from!.merc2SysCoordAsync(coord)
402
+ );
403
+
404
+ Promise.all(xyPromises).then(xys => {
405
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
406
+ const options: any = {
407
+ color: source.envelopeColor,
408
+ width: 2,
409
+ lineDash: [6, 6]
410
+ };
411
+ this.core!.mapObject.setEnvelope(xys, options);
412
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
413
+ if (isActive && (this.core!.mapObject as any).setFillEnvelope) {
414
+ console.log(`[Debug] Setting fill envelope for ${key}`);
415
+
416
+ const color = asArray(source.envelopeColor || "#000000");
417
+
418
+ color[3] = 0.4;
419
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
420
+ const fillHandle = (this.core!.mapObject as any).setFillEnvelope(
421
+ xys,
422
+ null,
423
+ { color }
424
+ );
425
+ this._selectCandidateSources![key] = fillHandle;
426
+ }
427
+ });
428
+ });
429
+ }
430
+ }
431
+
432
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
433
+ resolveRelativeLink(file: any, fallbackPath: any) {
434
+ return resolveRelativeLink(file, fallbackPath);
435
+ }
436
+
437
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
438
+ checkOverlayID(mapID: any) {
439
+ return checkOverlayID(this, mapID);
440
+ }
441
+
442
+ areaIndex(xys: number[][]) {
443
+ return (
444
+ 0.5 *
445
+ Math.abs(
446
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
447
+ [0, 1, 2, 3].reduce((prev: any, _curr: any, i: any) => {
448
+ const xy1 = xys[i];
449
+ const xy2 = xys[i + 1];
450
+ return prev + (xy1[0] - xy2[0]) * (xy1[1] + xy2[1]);
451
+ }, 0)
452
+ )
453
+ );
454
+ }
455
+
456
+ getShareUrl(type: string) {
457
+ if (type === "view") {
458
+ return window.location.href;
459
+ }
460
+ // app
461
+ return window.location.href.split("?")[0].split("#")[0];
462
+ }
463
+
464
+ showToast(message: string, target?: HTMLElement) {
465
+ let toast = document.querySelector(".custom-toast") as HTMLElement;
466
+ if (!toast) {
467
+ toast = document.createElement("div");
468
+ toast.className = "custom-toast";
469
+ document.body.appendChild(toast);
470
+ }
471
+ (toast as HTMLElement).innerText = message;
472
+
473
+ if (target) {
474
+ const parent = target.closest(".recipient");
475
+ const rect = (parent || target).getBoundingClientRect();
476
+ toast.style.position = "fixed";
477
+ toast.style.left = `${rect.left + rect.width / 2}px`;
478
+ toast.style.top = `${rect.top + rect.height / 2}px`;
479
+ toast.style.transform = "translate(-50%, -50%)";
480
+ toast.style.bottom = "auto";
481
+ toast.style.margin = "0";
482
+ } else {
483
+ toast.style.position = "fixed";
484
+ toast.style.left = "50%";
485
+ toast.style.bottom = "30px";
486
+ toast.style.top = "auto";
487
+ toast.style.transform = "";
488
+ toast.style.marginLeft = "-125px";
489
+ }
490
+
491
+ toast.classList.add("show");
492
+
493
+ setTimeout(() => {
494
+ toast!.classList.remove("show");
495
+ }, 1500);
496
+ }
497
+
498
+ modalSetting(type: string) {
499
+ const modalElm = this.core!.mapDivDocument!.querySelector(".modalBase")!;
500
+ modalElm.classList.remove(
501
+ "modal_load",
502
+ "modal_poi",
503
+ "modal_share",
504
+ "modal_help",
505
+ "modal_gpsW",
506
+ "modal_gpsD",
507
+ "modal_map",
508
+ "modal_marker_list"
509
+ );
510
+ modalElm.classList.add(`modal_${type}`);
511
+ }
512
+
513
+ ellips() {
514
+ ellips(this.core!.mapDivDocument!);
515
+ }
516
+
517
+ remove() {
518
+ this.core!.remove();
519
+ delete this.core;
520
+ }
521
+ }