mudlet-map-renderer 0.43.0-konva → 1.1.0
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/README.md +520 -522
- package/dist/AreaMapRenderer.d.ts +2 -2
- package/dist/ExitRenderer.d.ts +5 -5
- package/dist/MapGraph.d.ts +2 -2
- package/dist/MapReader-mU_4JWv_.js +224 -0
- package/dist/MapReader-mU_4JWv_.js.map +1 -0
- package/dist/MapState.d.ts +15 -9
- package/dist/PathData.d.ts +2 -2
- package/dist/PathFinder.d.ts +2 -2
- package/dist/ScenePipeline.d.ts +19 -6
- package/dist/binary/BinaryMapReader.d.ts +36 -0
- package/dist/binary/index.d.ts +2 -0
- package/dist/binary.mjs +34 -0
- package/dist/binary.mjs.map +1 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.mjs +1086 -1147
- package/dist/index.mjs.map +1 -1
- package/dist/lens/ExplorationLens.d.ts +29 -0
- package/dist/lens/RoomLens.d.ts +47 -0
- package/dist/lens/composeLenses.d.ts +31 -0
- package/dist/lens/index.d.ts +5 -0
- package/dist/overlay/LiveEffect.d.ts +33 -0
- package/dist/overlay/SceneOverlay.d.ts +18 -89
- package/dist/reader/Area.d.ts +40 -4
- package/dist/reader/Exit.d.ts +4 -1
- package/dist/reader/MapReader.d.ts +23 -17
- package/dist/reader/Plane.d.ts +19 -1
- package/dist/rendering/KonvaRenderBackend.d.ts +4 -8
- package/dist/rendering/MapRenderer.d.ts +31 -7
- package/dist/rendering/SceneManager.d.ts +7 -6
- package/dist/scene/InnerExitStyle.d.ts +2 -2
- package/dist/scene/OverlayStyle.d.ts +8 -4
- package/dist/scene/RoomStyle.d.ts +2 -2
- package/dist/scene/elements/ExitLayout.d.ts +2 -2
- package/dist/scene/elements/RoomLayout.d.ts +2 -2
- package/dist/types/Settings.d.ts +44 -0
- package/dist/utils/color.d.ts +9 -1
- package/package.json +17 -1
- package/dist/reader/ExplorationArea.d.ts +0 -32
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import e from "
|
|
1
|
+
import { n as e, r as t, t as n } from "./MapReader-mU_4JWv_.js";
|
|
2
|
+
import r from "konva";
|
|
2
3
|
//#region \0rolldown/runtime.js
|
|
3
|
-
var
|
|
4
|
-
if (t && typeof t == "object" || typeof t == "function") for (var
|
|
4
|
+
var i = Object.create, a = Object.defineProperty, o = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, c = Object.getPrototypeOf, l = Object.prototype.hasOwnProperty, u = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), d = (e, t, n, r) => {
|
|
5
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = s(t), c = 0, u = i.length, d; c < u; c++) d = i[c], !l.call(e, d) && d !== n && a(e, d, {
|
|
5
6
|
get: ((e) => t[e]).bind(null, d),
|
|
6
|
-
enumerable: !(
|
|
7
|
+
enumerable: !(r = o(t, d)) || r.enumerable
|
|
7
8
|
});
|
|
8
9
|
return e;
|
|
9
|
-
},
|
|
10
|
+
}, f = (e, t, n) => (n = e == null ? {} : i(c(e)), d(t || !e || !e.__esModule ? a(n, "default", {
|
|
10
11
|
value: e,
|
|
11
12
|
enumerable: !0
|
|
12
|
-
}) :
|
|
13
|
-
function
|
|
13
|
+
}) : n, e)), p = .6, m = .025, h = "rgb(225, 255, 225)";
|
|
14
|
+
function g() {
|
|
14
15
|
return {
|
|
15
|
-
roomSize:
|
|
16
|
-
lineWidth:
|
|
17
|
-
lineColor:
|
|
16
|
+
roomSize: p,
|
|
17
|
+
lineWidth: m,
|
|
18
|
+
lineColor: h,
|
|
18
19
|
backgroundColor: "#000000",
|
|
19
20
|
instantMapMove: !1,
|
|
20
21
|
highlightCurrentRoom: !0,
|
|
@@ -35,6 +36,15 @@ function p() {
|
|
|
35
36
|
dashEnabled: !0,
|
|
36
37
|
matchRoomShape: !1
|
|
37
38
|
},
|
|
39
|
+
highlight: {
|
|
40
|
+
strokeAlpha: 1,
|
|
41
|
+
fillAlpha: 0,
|
|
42
|
+
strokeWidth: .1,
|
|
43
|
+
sizeFactor: 1.425,
|
|
44
|
+
dash: [.05, .05],
|
|
45
|
+
dashEnabled: !0,
|
|
46
|
+
matchRoomShape: !0
|
|
47
|
+
},
|
|
38
48
|
gridEnabled: !1,
|
|
39
49
|
gridSize: 1,
|
|
40
50
|
gridColor: "rgba(200, 200, 200, 0.15)",
|
|
@@ -52,33 +62,176 @@ function p() {
|
|
|
52
62
|
}
|
|
53
63
|
//#endregion
|
|
54
64
|
//#region src/utils/color.ts
|
|
55
|
-
function
|
|
65
|
+
function _(e) {
|
|
56
66
|
let t, n, r, i = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
57
67
|
if (i) t = parseInt(i[1]) / 255, n = parseInt(i[2]) / 255, r = parseInt(i[3]) / 255;
|
|
58
68
|
else if (e.startsWith("#") && e.length >= 7) t = parseInt(e.slice(1, 3), 16) / 255, n = parseInt(e.slice(3, 5), 16) / 255, r = parseInt(e.slice(5, 7), 16) / 255;
|
|
59
69
|
else return .5;
|
|
60
70
|
return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
|
|
61
71
|
}
|
|
62
|
-
function
|
|
72
|
+
function v(e, t) {
|
|
63
73
|
let n, r, i, a = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
64
74
|
if (a) n = parseInt(a[1]), r = parseInt(a[2]), i = parseInt(a[3]);
|
|
65
75
|
else if (e.startsWith("#") && e.length >= 7) n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16);
|
|
66
76
|
else return e;
|
|
67
77
|
return n = Math.round(n * (1 - t)), r = Math.round(r * (1 - t)), i = Math.round(i * (1 - t)), `rgb(${n}, ${r}, ${i})`;
|
|
68
78
|
}
|
|
69
|
-
function
|
|
79
|
+
function y(e, t) {
|
|
70
80
|
let n, r, i, a = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
71
81
|
if (a) n = parseInt(a[1]), r = parseInt(a[2]), i = parseInt(a[3]);
|
|
72
82
|
else if (e.startsWith("#") && e.length >= 7) n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16);
|
|
73
83
|
else return e;
|
|
74
84
|
return n = Math.min(255, Math.round(n + (255 - n) * t)), r = Math.min(255, Math.round(r + (255 - r) * t)), i = Math.min(255, Math.round(i + (255 - i) * t)), `rgb(${n}, ${r}, ${i})`;
|
|
75
85
|
}
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
var b = {
|
|
87
|
+
black: [
|
|
88
|
+
0,
|
|
89
|
+
0,
|
|
90
|
+
0
|
|
91
|
+
],
|
|
92
|
+
white: [
|
|
93
|
+
255,
|
|
94
|
+
255,
|
|
95
|
+
255
|
|
96
|
+
],
|
|
97
|
+
red: [
|
|
98
|
+
255,
|
|
99
|
+
0,
|
|
100
|
+
0
|
|
101
|
+
],
|
|
102
|
+
green: [
|
|
103
|
+
0,
|
|
104
|
+
128,
|
|
105
|
+
0
|
|
106
|
+
],
|
|
107
|
+
lime: [
|
|
108
|
+
0,
|
|
109
|
+
255,
|
|
110
|
+
0
|
|
111
|
+
],
|
|
112
|
+
blue: [
|
|
113
|
+
0,
|
|
114
|
+
0,
|
|
115
|
+
255
|
|
116
|
+
],
|
|
117
|
+
yellow: [
|
|
118
|
+
255,
|
|
119
|
+
255,
|
|
120
|
+
0
|
|
121
|
+
],
|
|
122
|
+
cyan: [
|
|
123
|
+
0,
|
|
124
|
+
255,
|
|
125
|
+
255
|
|
126
|
+
],
|
|
127
|
+
aqua: [
|
|
128
|
+
0,
|
|
129
|
+
255,
|
|
130
|
+
255
|
|
131
|
+
],
|
|
132
|
+
magenta: [
|
|
133
|
+
255,
|
|
134
|
+
0,
|
|
135
|
+
255
|
|
136
|
+
],
|
|
137
|
+
fuchsia: [
|
|
138
|
+
255,
|
|
139
|
+
0,
|
|
140
|
+
255
|
|
141
|
+
],
|
|
142
|
+
silver: [
|
|
143
|
+
192,
|
|
144
|
+
192,
|
|
145
|
+
192
|
|
146
|
+
],
|
|
147
|
+
gray: [
|
|
148
|
+
128,
|
|
149
|
+
128,
|
|
150
|
+
128
|
|
151
|
+
],
|
|
152
|
+
grey: [
|
|
153
|
+
128,
|
|
154
|
+
128,
|
|
155
|
+
128
|
|
156
|
+
],
|
|
157
|
+
maroon: [
|
|
158
|
+
128,
|
|
159
|
+
0,
|
|
160
|
+
0
|
|
161
|
+
],
|
|
162
|
+
olive: [
|
|
163
|
+
128,
|
|
164
|
+
128,
|
|
165
|
+
0
|
|
166
|
+
],
|
|
167
|
+
purple: [
|
|
168
|
+
128,
|
|
169
|
+
0,
|
|
170
|
+
128
|
|
171
|
+
],
|
|
172
|
+
teal: [
|
|
173
|
+
0,
|
|
174
|
+
128,
|
|
175
|
+
128
|
|
176
|
+
],
|
|
177
|
+
navy: [
|
|
178
|
+
0,
|
|
179
|
+
0,
|
|
180
|
+
128
|
|
181
|
+
],
|
|
182
|
+
orange: [
|
|
183
|
+
255,
|
|
184
|
+
165,
|
|
185
|
+
0
|
|
186
|
+
],
|
|
187
|
+
pink: [
|
|
188
|
+
255,
|
|
189
|
+
192,
|
|
190
|
+
203
|
|
191
|
+
],
|
|
192
|
+
gold: [
|
|
193
|
+
255,
|
|
194
|
+
215,
|
|
195
|
+
0
|
|
196
|
+
],
|
|
197
|
+
brown: [
|
|
198
|
+
165,
|
|
199
|
+
42,
|
|
200
|
+
42
|
|
201
|
+
],
|
|
202
|
+
violet: [
|
|
203
|
+
238,
|
|
204
|
+
130,
|
|
205
|
+
238
|
|
206
|
+
],
|
|
207
|
+
indigo: [
|
|
208
|
+
75,
|
|
209
|
+
0,
|
|
210
|
+
130
|
|
211
|
+
],
|
|
212
|
+
transparent: [
|
|
213
|
+
0,
|
|
214
|
+
0,
|
|
215
|
+
0
|
|
216
|
+
]
|
|
217
|
+
};
|
|
218
|
+
function x(e, t) {
|
|
219
|
+
let n = e.trim();
|
|
220
|
+
if (n.startsWith("#")) {
|
|
221
|
+
let r, i, a;
|
|
222
|
+
if (n.length === 4) r = parseInt(n[1] + n[1], 16), i = parseInt(n[2] + n[2], 16), a = parseInt(n[3] + n[3], 16);
|
|
223
|
+
else if (n.length >= 7) r = parseInt(n.slice(1, 3), 16), i = parseInt(n.slice(3, 5), 16), a = parseInt(n.slice(5, 7), 16);
|
|
224
|
+
else return e;
|
|
225
|
+
return Number.isNaN(r) || Number.isNaN(i) || Number.isNaN(a) ? e : `rgba(${r}, ${i}, ${a}, ${t})`;
|
|
226
|
+
}
|
|
227
|
+
let r = n.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/i);
|
|
228
|
+
if (r) return `rgba(${parseInt(r[1], 10)}, ${parseInt(r[2], 10)}, ${parseInt(r[3], 10)}, ${r[4] === void 0 ? t : parseFloat(r[4]) * t})`;
|
|
229
|
+
let i = b[n.toLowerCase()];
|
|
230
|
+
return i ? `rgba(${i[0]}, ${i[1]}, ${i[2]}, ${t})` : e;
|
|
78
231
|
}
|
|
79
232
|
//#endregion
|
|
80
233
|
//#region src/TypedEventEmitter.ts
|
|
81
|
-
var
|
|
234
|
+
var S = class {
|
|
82
235
|
constructor(e) {
|
|
83
236
|
this.listeners = /* @__PURE__ */ new Map(), this.container = e;
|
|
84
237
|
}
|
|
@@ -95,9 +248,22 @@ var v = class {
|
|
|
95
248
|
emit(e, t) {
|
|
96
249
|
this.listeners.get(e)?.forEach((e) => e(t)), this.container && this.container.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
97
250
|
}
|
|
98
|
-
},
|
|
251
|
+
}, C = {
|
|
252
|
+
isVisible: () => !0,
|
|
253
|
+
getVersion: () => 0
|
|
254
|
+
};
|
|
255
|
+
function w(e, t, n, r) {
|
|
256
|
+
let i = e.isVisible(n), a = e.isVisible(r);
|
|
257
|
+
return i && a ? "full" : i || a ? "stub" : "hidden";
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/MapState.ts
|
|
261
|
+
var T = class {
|
|
99
262
|
constructor(e, t) {
|
|
100
|
-
this.events = new
|
|
263
|
+
this.events = new S(), this.highlights = /* @__PURE__ */ new Map(), this.paths = [], this.lens = C, this.mapReader = e, this.settings = t;
|
|
264
|
+
}
|
|
265
|
+
setLens(e) {
|
|
266
|
+
this.lens = e, this.events.emit("lens", { lens: e });
|
|
101
267
|
}
|
|
102
268
|
setArea(e, t) {
|
|
103
269
|
let n = this.mapReader.getArea(e);
|
|
@@ -220,10 +386,10 @@ var v = class {
|
|
|
220
386
|
};
|
|
221
387
|
}
|
|
222
388
|
};
|
|
223
|
-
function
|
|
389
|
+
function E(e) {
|
|
224
390
|
return e < .5 ? 2 * e * e : -1 + (4 - 2 * e) * e;
|
|
225
391
|
}
|
|
226
|
-
var
|
|
392
|
+
var D = class e extends S {
|
|
227
393
|
constructor(e, t) {
|
|
228
394
|
super(), this.zoom = 1, this.minZoom = .05, this.position = {
|
|
229
395
|
x: 0,
|
|
@@ -375,7 +541,7 @@ var x = class e extends v {
|
|
|
375
541
|
this.cancelAnimation();
|
|
376
542
|
let n = performance.now(), r = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(performance.now()), 16), i = (a) => {
|
|
377
543
|
let o = a - n, s = Math.min(o / e, 1);
|
|
378
|
-
t(
|
|
544
|
+
t(E(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
|
|
379
545
|
};
|
|
380
546
|
this.animationId = r(i);
|
|
381
547
|
}
|
|
@@ -388,12 +554,12 @@ var x = class e extends v {
|
|
|
388
554
|
notify() {
|
|
389
555
|
this.emit("change", void 0);
|
|
390
556
|
}
|
|
391
|
-
},
|
|
557
|
+
}, O = (e, t) => ({
|
|
392
558
|
x: e,
|
|
393
559
|
y: t
|
|
394
|
-
}),
|
|
560
|
+
}), ee = class {
|
|
395
561
|
constructor(e, t) {
|
|
396
|
-
this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform =
|
|
562
|
+
this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform = O;
|
|
397
563
|
}
|
|
398
564
|
setCoordinateTransform(e) {
|
|
399
565
|
this.coordinateTransform = e;
|
|
@@ -412,7 +578,7 @@ var x = class e extends v {
|
|
|
412
578
|
updateCulling() {
|
|
413
579
|
this.onCullingNeeded();
|
|
414
580
|
}
|
|
415
|
-
},
|
|
581
|
+
}, k = [
|
|
416
582
|
"north",
|
|
417
583
|
"south",
|
|
418
584
|
"east",
|
|
@@ -421,7 +587,7 @@ var x = class e extends v {
|
|
|
421
587
|
"northwest",
|
|
422
588
|
"southeast",
|
|
423
589
|
"southwest"
|
|
424
|
-
],
|
|
590
|
+
], te = {
|
|
425
591
|
n: "north",
|
|
426
592
|
s: "south",
|
|
427
593
|
e: "east",
|
|
@@ -430,7 +596,7 @@ var x = class e extends v {
|
|
|
430
596
|
nw: "northwest",
|
|
431
597
|
se: "southeast",
|
|
432
598
|
sw: "southwest"
|
|
433
|
-
},
|
|
599
|
+
}, A = {
|
|
434
600
|
north: "n",
|
|
435
601
|
south: "s",
|
|
436
602
|
east: "e",
|
|
@@ -443,7 +609,7 @@ var x = class e extends v {
|
|
|
443
609
|
down: "d",
|
|
444
610
|
in: "i",
|
|
445
611
|
out: "o"
|
|
446
|
-
},
|
|
612
|
+
}, j = {
|
|
447
613
|
north: {
|
|
448
614
|
x: 0,
|
|
449
615
|
y: -1
|
|
@@ -476,7 +642,7 @@ var x = class e extends v {
|
|
|
476
642
|
x: -1,
|
|
477
643
|
y: 1
|
|
478
644
|
}
|
|
479
|
-
},
|
|
645
|
+
}, ne = [
|
|
480
646
|
"north",
|
|
481
647
|
"south",
|
|
482
648
|
"east",
|
|
@@ -485,7 +651,7 @@ var x = class e extends v {
|
|
|
485
651
|
"northwest",
|
|
486
652
|
"southeast",
|
|
487
653
|
"southwest"
|
|
488
|
-
],
|
|
654
|
+
], M = {
|
|
489
655
|
north: "south",
|
|
490
656
|
south: "north",
|
|
491
657
|
east: "west",
|
|
@@ -495,39 +661,39 @@ var x = class e extends v {
|
|
|
495
661
|
southeast: "northwest",
|
|
496
662
|
southwest: "northeast"
|
|
497
663
|
};
|
|
498
|
-
function
|
|
499
|
-
return e ? Object.prototype.hasOwnProperty.call(
|
|
664
|
+
function N(e) {
|
|
665
|
+
return e ? Object.prototype.hasOwnProperty.call(j, e) : !1;
|
|
500
666
|
}
|
|
501
|
-
function
|
|
502
|
-
if (!
|
|
667
|
+
function P(e, t, n, r = 1) {
|
|
668
|
+
if (!N(n)) return {
|
|
503
669
|
x: e,
|
|
504
670
|
y: t
|
|
505
671
|
};
|
|
506
|
-
let i =
|
|
672
|
+
let i = j[n];
|
|
507
673
|
return {
|
|
508
674
|
x: e + i.x * r,
|
|
509
675
|
y: t + i.y * r
|
|
510
676
|
};
|
|
511
677
|
}
|
|
512
|
-
function
|
|
513
|
-
if (!
|
|
678
|
+
function F(e, t, n, r = 1, i = 0) {
|
|
679
|
+
if (!N(n)) return {
|
|
514
680
|
x: e,
|
|
515
681
|
y: t
|
|
516
682
|
};
|
|
517
|
-
let a =
|
|
518
|
-
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return
|
|
683
|
+
let a = j[n];
|
|
684
|
+
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return P(e, t, n, r);
|
|
519
685
|
let o = r - i + i / Math.SQRT2;
|
|
520
686
|
return {
|
|
521
687
|
x: e + a.x * o,
|
|
522
688
|
y: t + a.y * o
|
|
523
689
|
};
|
|
524
690
|
}
|
|
525
|
-
function
|
|
526
|
-
if (!
|
|
691
|
+
function re(e, t, n, r = 1) {
|
|
692
|
+
if (!N(n)) return {
|
|
527
693
|
x: e,
|
|
528
694
|
y: t
|
|
529
695
|
};
|
|
530
|
-
let i =
|
|
696
|
+
let i = j[n], a = Math.atan2(i.y, i.x);
|
|
531
697
|
return {
|
|
532
698
|
x: e + Math.cos(a) * r,
|
|
533
699
|
y: t + Math.sin(a) * r
|
|
@@ -535,32 +701,32 @@ function M(e, t, n, r = 1) {
|
|
|
535
701
|
}
|
|
536
702
|
//#endregion
|
|
537
703
|
//#region src/ExitRenderer.ts
|
|
538
|
-
var
|
|
704
|
+
var ie = {
|
|
539
705
|
OPEN_DOOR: "rgb(10, 155, 10)",
|
|
540
706
|
CLOSED_DOOR: "rgb(226, 205, 59)",
|
|
541
707
|
LOCKED_DOOR: "rgb(155, 10, 10)",
|
|
542
708
|
ONE_WAY_FILL: "rgb(155, 10, 10)"
|
|
543
709
|
};
|
|
544
|
-
function
|
|
710
|
+
function ae(e) {
|
|
545
711
|
switch (e) {
|
|
546
|
-
case 1: return
|
|
547
|
-
case 2: return
|
|
548
|
-
default: return
|
|
712
|
+
case 1: return ie.OPEN_DOOR;
|
|
713
|
+
case 2: return ie.CLOSED_DOOR;
|
|
714
|
+
default: return ie.LOCKED_DOOR;
|
|
549
715
|
}
|
|
550
716
|
}
|
|
551
|
-
var
|
|
717
|
+
var oe = class {
|
|
552
718
|
constructor(e, t) {
|
|
553
719
|
this.mapReader = e, this.settings = t;
|
|
554
720
|
}
|
|
555
721
|
getRoomEdgePoint(e, t, n, r) {
|
|
556
722
|
let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
|
|
557
|
-
return this.settings.roomShape === "circle" ?
|
|
723
|
+
return this.settings.roomShape === "circle" ? re(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? F(e, t, n, i, this.settings.roomSize * .2) : P(e, t, n, i);
|
|
558
724
|
}
|
|
559
725
|
renderData(e, t) {
|
|
560
726
|
return this.renderDataWithColor(e, this.settings.lineColor, t);
|
|
561
727
|
}
|
|
562
728
|
renderDataWithColor(e, t, n) {
|
|
563
|
-
let r = e.aDir &&
|
|
729
|
+
let r = e.aDir && k.includes(e.aDir), i = e.bDir && k.includes(e.bDir);
|
|
564
730
|
if (r && i) return this.renderTwoWayExitData(e, t, n);
|
|
565
731
|
if (r || i) {
|
|
566
732
|
let n = r ? "a" : "b";
|
|
@@ -569,7 +735,7 @@ var P = class {
|
|
|
569
735
|
}
|
|
570
736
|
renderTwoWayExitData(e, t, n) {
|
|
571
737
|
let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
|
|
572
|
-
if (!r || !i || !e.aDir || !e.bDir || r.customLines[
|
|
738
|
+
if (!r || !i || !e.aDir || !e.bDir || r.customLines[A[e.aDir]] && i.customLines[A[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[A[e.aDir]] || n !== r.z && i.customLines[A[e.bDir]])) return;
|
|
573
739
|
let a = this.getRoomEdgePoint(r.x, r.y, e.aDir, this.settings.roomSize / 2), o = this.getRoomEdgePoint(i.x, i.y, e.bDir, this.settings.roomSize / 2), s = [
|
|
574
740
|
a.x,
|
|
575
741
|
a.y,
|
|
@@ -579,7 +745,7 @@ var P = class {
|
|
|
579
745
|
points: s,
|
|
580
746
|
stroke: t,
|
|
581
747
|
strokeWidth: this.settings.lineWidth
|
|
582
|
-
}], l = [], u = r.doors[
|
|
748
|
+
}], l = [], u = r.doors[A[e.aDir]] ?? i.doors[A[e.bDir]];
|
|
583
749
|
if (u) {
|
|
584
750
|
let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
|
|
585
751
|
l.push({
|
|
@@ -587,7 +753,7 @@ var P = class {
|
|
|
587
753
|
y: t - this.settings.roomSize / 4,
|
|
588
754
|
width: this.settings.roomSize / 2,
|
|
589
755
|
height: this.settings.roomSize / 2,
|
|
590
|
-
stroke:
|
|
756
|
+
stroke: ae(u),
|
|
591
757
|
strokeWidth: this.settings.lineWidth
|
|
592
758
|
});
|
|
593
759
|
}
|
|
@@ -618,9 +784,9 @@ var P = class {
|
|
|
618
784
|
}
|
|
619
785
|
renderOneWayExitData(e, t, n) {
|
|
620
786
|
let r = n === "a" || !n && e.aDir, i = r ? this.mapReader.getRoom(e.a) : this.mapReader.getRoom(e.b), a = r ? this.mapReader.getRoom(e.b) : this.mapReader.getRoom(e.a), o = r ? e.aDir : e.bDir;
|
|
621
|
-
if (!o || !i || !a || !
|
|
787
|
+
if (!o || !i || !a || !k.includes(o) || i.customLines[A[o] || o]) return;
|
|
622
788
|
if (i.area != a.area && o) {
|
|
623
|
-
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n =
|
|
789
|
+
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = P(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
|
|
624
790
|
return {
|
|
625
791
|
lines: [],
|
|
626
792
|
arrows: [{
|
|
@@ -659,8 +825,8 @@ var P = class {
|
|
|
659
825
|
x: a.x,
|
|
660
826
|
y: a.y
|
|
661
827
|
};
|
|
662
|
-
s && (c =
|
|
663
|
-
let l =
|
|
828
|
+
s && (c = P(i.x, i.y, o, this.settings.roomSize / 2));
|
|
829
|
+
let l = P(i.x, i.y, o, .3), u = l.x - (l.x - c.x) / 2, d = l.y - (l.y - c.y) / 2, f = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), p = [
|
|
664
830
|
f.x,
|
|
665
831
|
f.y,
|
|
666
832
|
c.x,
|
|
@@ -692,7 +858,7 @@ var P = class {
|
|
|
692
858
|
pointerWidth: .35,
|
|
693
859
|
strokeWidth: this.settings.lineWidth * 1.4,
|
|
694
860
|
stroke: t,
|
|
695
|
-
fill:
|
|
861
|
+
fill: ie.ONE_WAY_FILL,
|
|
696
862
|
dash: [.1, .05]
|
|
697
863
|
}],
|
|
698
864
|
doors: [],
|
|
@@ -747,7 +913,7 @@ var P = class {
|
|
|
747
913
|
for (let [r, i] of Object.entries(e.customLines)) {
|
|
748
914
|
let a = e.specialExits[r];
|
|
749
915
|
if (a === void 0) {
|
|
750
|
-
let t =
|
|
916
|
+
let t = te[r] ?? n[r];
|
|
751
917
|
t && (a = e.exits[t] ?? e.specialExits[t]);
|
|
752
918
|
}
|
|
753
919
|
if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
|
|
@@ -779,7 +945,7 @@ var P = class {
|
|
|
779
945
|
}
|
|
780
946
|
return t;
|
|
781
947
|
}
|
|
782
|
-
},
|
|
948
|
+
}, se = {
|
|
783
949
|
1: "north",
|
|
784
950
|
2: "northeast",
|
|
785
951
|
3: "northwest",
|
|
@@ -793,15 +959,15 @@ var P = class {
|
|
|
793
959
|
11: "in",
|
|
794
960
|
12: "out"
|
|
795
961
|
};
|
|
796
|
-
function
|
|
797
|
-
return e.roomShape === "circle" ?
|
|
962
|
+
function ce(e, t, n, r, i) {
|
|
963
|
+
return e.roomShape === "circle" ? re(t, n, r, i) : e.roomShape === "roundedRectangle" ? F(t, n, r, i, e.roomSize * .2) : P(t, n, r, i);
|
|
798
964
|
}
|
|
799
|
-
function
|
|
965
|
+
function le(e, t, n) {
|
|
800
966
|
let r = [];
|
|
801
967
|
for (let i of e.stubs) {
|
|
802
|
-
let a =
|
|
968
|
+
let a = se[i];
|
|
803
969
|
if (!a) continue;
|
|
804
|
-
let o =
|
|
970
|
+
let o = ce(t, e.x, e.y, a, t.roomSize / 2), s = P(e.x, e.y, a, t.roomSize / 2 + .5);
|
|
805
971
|
r.push({
|
|
806
972
|
roomId: e.id,
|
|
807
973
|
direction: a,
|
|
@@ -817,12 +983,12 @@ function ie(e, t, n) {
|
|
|
817
983
|
}
|
|
818
984
|
//#endregion
|
|
819
985
|
//#region src/scene/SpecialExitStyle.ts
|
|
820
|
-
var
|
|
986
|
+
var ue = {
|
|
821
987
|
1: "rgb(10, 155, 10)",
|
|
822
988
|
2: "rgb(226, 205, 59)",
|
|
823
989
|
3: "rgb(155, 10, 10)"
|
|
824
990
|
};
|
|
825
|
-
function
|
|
991
|
+
function de(e, t, n) {
|
|
826
992
|
let r = [];
|
|
827
993
|
for (let [i, a] of Object.entries(e.customLines)) {
|
|
828
994
|
let o = [e.x, e.y];
|
|
@@ -869,7 +1035,7 @@ function oe(e, t, n) {
|
|
|
869
1035
|
y: n - r / 2,
|
|
870
1036
|
width: r,
|
|
871
1037
|
height: r,
|
|
872
|
-
stroke:
|
|
1038
|
+
stroke: ue[f] ?? ue[3],
|
|
873
1039
|
strokeWidth: t.lineWidth
|
|
874
1040
|
};
|
|
875
1041
|
}
|
|
@@ -884,34 +1050,34 @@ function oe(e, t, n) {
|
|
|
884
1050
|
}
|
|
885
1051
|
//#endregion
|
|
886
1052
|
//#region src/utils/textMeasure.ts
|
|
887
|
-
var
|
|
888
|
-
function
|
|
889
|
-
return
|
|
1053
|
+
var fe = 72, I = 200, pe = 120, me = /* @__PURE__ */ new Map(), L = null;
|
|
1054
|
+
function he() {
|
|
1055
|
+
return L || (L = r.Util.createCanvasElement(), L.width = I, L.height = I), L;
|
|
890
1056
|
}
|
|
891
|
-
function
|
|
892
|
-
let n = `${e}::${t}`, r =
|
|
1057
|
+
function ge(e, t) {
|
|
1058
|
+
let n = `${e}::${t}`, r = me.get(n);
|
|
893
1059
|
if (r !== void 0) return r;
|
|
894
|
-
let i =
|
|
895
|
-
i.clearRect(0, 0,
|
|
896
|
-
let { data: o } = i.getImageData(0, 0,
|
|
897
|
-
for (let e = 0; e <
|
|
1060
|
+
let i = he().getContext("2d", { willReadFrequently: !0 }), a = `bold ${fe}px ${t}`;
|
|
1061
|
+
i.clearRect(0, 0, I, I), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, I / 2, pe);
|
|
1062
|
+
let { data: o } = i.getImageData(0, 0, I, I), s = I, c = -1;
|
|
1063
|
+
for (let e = 0; e < I; e++) for (let t = 0; t < I; t++) o[(e * I + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
|
|
898
1064
|
if (c === -1) {
|
|
899
1065
|
let e = {
|
|
900
1066
|
baselineRatio: .35,
|
|
901
1067
|
konvaCorrectionRatio: 0
|
|
902
1068
|
};
|
|
903
|
-
return
|
|
1069
|
+
return me.set(n, e), e;
|
|
904
1070
|
}
|
|
905
|
-
let l = (
|
|
1071
|
+
let l = (pe - s - Math.max(0, c - pe)) / 2 / fe, u = i.measureText("M"), d = {
|
|
906
1072
|
baselineRatio: l,
|
|
907
|
-
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 /
|
|
1073
|
+
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / fe - l
|
|
908
1074
|
};
|
|
909
|
-
return
|
|
1075
|
+
return me.set(n, d), d;
|
|
910
1076
|
}
|
|
911
1077
|
//#endregion
|
|
912
1078
|
//#region src/scene/RoomStyle.ts
|
|
913
|
-
function
|
|
914
|
-
let i = t.getColorValue(e.env), a = n.coloredMode ?
|
|
1079
|
+
function _e(e, t, n, r) {
|
|
1080
|
+
let i = t.getColorValue(e.env), a = n.coloredMode ? v(i, .5) : n.frameMode ? n.backgroundColor : i, o = n.coloredMode ? y(i, .1) : i;
|
|
915
1081
|
return {
|
|
916
1082
|
fillColor: a,
|
|
917
1083
|
strokeColor: r ? n.frameMode || n.coloredMode ? o : r : n.frameMode || n.coloredMode ? o : n.lineColor,
|
|
@@ -920,9 +1086,9 @@ function fe(e, t, n, r) {
|
|
|
920
1086
|
envColor: i
|
|
921
1087
|
};
|
|
922
1088
|
}
|
|
923
|
-
function
|
|
1089
|
+
function ve(e, t) {
|
|
924
1090
|
if (!t.emboss) return null;
|
|
925
|
-
let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a =
|
|
1091
|
+
let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a = y(e, .35), o = v(e, .45);
|
|
926
1092
|
if (t.roomShape === "circle") {
|
|
927
1093
|
let e = n / 2, t = n / 2, s = n / 2 - r, c = [];
|
|
928
1094
|
for (let n = 0; n <= 48; n++) {
|
|
@@ -1024,10 +1190,10 @@ function pe(e, t) {
|
|
|
1024
1190
|
}
|
|
1025
1191
|
//#endregion
|
|
1026
1192
|
//#region src/scene/elements/RoomLayout.ts
|
|
1027
|
-
function
|
|
1028
|
-
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } =
|
|
1193
|
+
function ye(e, t, n, r) {
|
|
1194
|
+
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } = _e(e, t, n, r.strokeOverride), c = n.roomSize, l = [], u = ve(i, n), d = u ? 0 : o, f = n.coloredMode && d > 0 && r.flatPipeline, p = (e) => n.roomShape === "roundedRectangle" ? Math.max(0, (c - 2 * e) * .2) : 0;
|
|
1029
1195
|
if (f) {
|
|
1030
|
-
let e = [
|
|
1196
|
+
let e = [v(a, .5), a], t = o * 2;
|
|
1031
1197
|
n.roomShape === "circle" ? l.push({
|
|
1032
1198
|
type: "circle",
|
|
1033
1199
|
cx: c / 2,
|
|
@@ -1109,7 +1275,7 @@ function me(e, t, n, r) {
|
|
|
1109
1275
|
lineCap: u.highlight.lineCap,
|
|
1110
1276
|
lineJoin: u.shadow.lineJoin
|
|
1111
1277
|
})), e.roomChar) {
|
|
1112
|
-
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } =
|
|
1278
|
+
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } = ge(e.roomChar, n.fontFamily), a = Math.max(c, e.roomChar.length * t * .8), o = (a - c) / 2;
|
|
1113
1279
|
l.push({
|
|
1114
1280
|
type: "text",
|
|
1115
1281
|
x: -o,
|
|
@@ -1142,13 +1308,13 @@ function me(e, t, n, r) {
|
|
|
1142
1308
|
}
|
|
1143
1309
|
//#endregion
|
|
1144
1310
|
//#region src/scene/InnerExitStyle.ts
|
|
1145
|
-
var
|
|
1311
|
+
var be = [
|
|
1146
1312
|
"up",
|
|
1147
1313
|
"down",
|
|
1148
1314
|
"in",
|
|
1149
1315
|
"out"
|
|
1150
1316
|
];
|
|
1151
|
-
function
|
|
1317
|
+
function R(e, t, n, r) {
|
|
1152
1318
|
let i = r * Math.PI / 180, a = [];
|
|
1153
1319
|
for (let r = 0; r < 3; r++) {
|
|
1154
1320
|
let o = 2 * Math.PI * r / 3 - Math.PI / 2, s = Math.cos(o) * n * 1.4, c = Math.sin(o) * n * .8, l = s * Math.cos(i) - c * Math.sin(i), u = s * Math.sin(i) + c * Math.cos(i);
|
|
@@ -1156,30 +1322,30 @@ function L(e, t, n, r) {
|
|
|
1156
1322
|
}
|
|
1157
1323
|
return a;
|
|
1158
1324
|
}
|
|
1159
|
-
function
|
|
1325
|
+
function xe(e, t, n) {
|
|
1160
1326
|
let r = e.userData?.["system.fallback_symbol_color"];
|
|
1161
1327
|
return {
|
|
1162
1328
|
symbolColor: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env)),
|
|
1163
1329
|
symbolFill: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6))
|
|
1164
1330
|
};
|
|
1165
1331
|
}
|
|
1166
|
-
var
|
|
1332
|
+
var Se = {
|
|
1167
1333
|
1: "rgb(10, 155, 10)",
|
|
1168
1334
|
2: "rgb(226, 205, 59)",
|
|
1169
1335
|
3: "rgb(155, 10, 10)"
|
|
1170
1336
|
};
|
|
1171
|
-
function
|
|
1172
|
-
let r = [], i = n.roomSize, a = i / 5, { symbolColor: o, symbolFill: s } =
|
|
1173
|
-
for (let t of
|
|
1337
|
+
function Ce(e, t, n) {
|
|
1338
|
+
let r = [], i = n.roomSize, a = i / 5, { symbolColor: o, symbolFill: s } = xe(e, t, n);
|
|
1339
|
+
for (let t of be) {
|
|
1174
1340
|
if (!e.exits[t]) continue;
|
|
1175
|
-
let c = e.doors[t], l = c === void 0 ? o :
|
|
1341
|
+
let c = e.doors[t], l = c === void 0 ? o : Se[c] ?? Se[3];
|
|
1176
1342
|
switch (t) {
|
|
1177
1343
|
case "up": {
|
|
1178
|
-
let t =
|
|
1344
|
+
let t = P(e.x, e.y, "south", i / 4);
|
|
1179
1345
|
r.push({
|
|
1180
1346
|
cx: t.x,
|
|
1181
1347
|
cy: t.y,
|
|
1182
|
-
vertices:
|
|
1348
|
+
vertices: R(t.x, t.y, a, 0),
|
|
1183
1349
|
fill: s,
|
|
1184
1350
|
stroke: l,
|
|
1185
1351
|
strokeWidth: n.lineWidth
|
|
@@ -1187,11 +1353,11 @@ function ve(e, t, n) {
|
|
|
1187
1353
|
break;
|
|
1188
1354
|
}
|
|
1189
1355
|
case "down": {
|
|
1190
|
-
let t =
|
|
1356
|
+
let t = P(e.x, e.y, "north", i / 4);
|
|
1191
1357
|
r.push({
|
|
1192
1358
|
cx: t.x,
|
|
1193
1359
|
cy: t.y,
|
|
1194
|
-
vertices:
|
|
1360
|
+
vertices: R(t.x, t.y, a, 180),
|
|
1195
1361
|
fill: s,
|
|
1196
1362
|
stroke: l,
|
|
1197
1363
|
strokeWidth: n.lineWidth
|
|
@@ -1199,18 +1365,18 @@ function ve(e, t, n) {
|
|
|
1199
1365
|
break;
|
|
1200
1366
|
}
|
|
1201
1367
|
case "in": {
|
|
1202
|
-
let t =
|
|
1368
|
+
let t = P(e.x, e.y, "west", i / 4), o = P(e.x, e.y, "east", i / 4);
|
|
1203
1369
|
r.push({
|
|
1204
1370
|
cx: t.x,
|
|
1205
1371
|
cy: t.y,
|
|
1206
|
-
vertices:
|
|
1372
|
+
vertices: R(t.x, t.y, a, 90),
|
|
1207
1373
|
fill: s,
|
|
1208
1374
|
stroke: l,
|
|
1209
1375
|
strokeWidth: n.lineWidth
|
|
1210
1376
|
}), r.push({
|
|
1211
1377
|
cx: o.x,
|
|
1212
1378
|
cy: o.y,
|
|
1213
|
-
vertices:
|
|
1379
|
+
vertices: R(o.x, o.y, a, -90),
|
|
1214
1380
|
fill: s,
|
|
1215
1381
|
stroke: l,
|
|
1216
1382
|
strokeWidth: n.lineWidth
|
|
@@ -1218,18 +1384,18 @@ function ve(e, t, n) {
|
|
|
1218
1384
|
break;
|
|
1219
1385
|
}
|
|
1220
1386
|
case "out": {
|
|
1221
|
-
let t =
|
|
1387
|
+
let t = P(e.x, e.y, "west", i / 4), o = P(e.x, e.y, "east", i / 4);
|
|
1222
1388
|
r.push({
|
|
1223
1389
|
cx: t.x,
|
|
1224
1390
|
cy: t.y,
|
|
1225
|
-
vertices:
|
|
1391
|
+
vertices: R(t.x, t.y, a, -90),
|
|
1226
1392
|
fill: s,
|
|
1227
1393
|
stroke: l,
|
|
1228
1394
|
strokeWidth: n.lineWidth
|
|
1229
1395
|
}), r.push({
|
|
1230
1396
|
cx: o.x,
|
|
1231
1397
|
cy: o.y,
|
|
1232
|
-
vertices:
|
|
1398
|
+
vertices: R(o.x, o.y, a, 90),
|
|
1233
1399
|
fill: s,
|
|
1234
1400
|
stroke: l,
|
|
1235
1401
|
strokeWidth: n.lineWidth
|
|
@@ -1242,8 +1408,8 @@ function ve(e, t, n) {
|
|
|
1242
1408
|
}
|
|
1243
1409
|
//#endregion
|
|
1244
1410
|
//#region src/scene/elements/ExitLayout.ts
|
|
1245
|
-
function
|
|
1246
|
-
let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } =
|
|
1411
|
+
function we(e, t, n) {
|
|
1412
|
+
let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } = Ce(e, t, n);
|
|
1247
1413
|
return o.map((e) => {
|
|
1248
1414
|
let t = Array(e.vertices.length);
|
|
1249
1415
|
for (let n = 0; n < e.vertices.length; n += 2) t[n] = e.vertices[n] - i, t[n + 1] = e.vertices[n + 1] - a;
|
|
@@ -1258,7 +1424,7 @@ function ye(e, t, n) {
|
|
|
1258
1424
|
};
|
|
1259
1425
|
});
|
|
1260
1426
|
}
|
|
1261
|
-
function
|
|
1427
|
+
function Te(e, t) {
|
|
1262
1428
|
let n = [];
|
|
1263
1429
|
for (let t of e.lines) n.push({
|
|
1264
1430
|
type: "line",
|
|
@@ -1269,7 +1435,7 @@ function be(e, t) {
|
|
|
1269
1435
|
dash: t.dash
|
|
1270
1436
|
}
|
|
1271
1437
|
});
|
|
1272
|
-
for (let t of e.arrows)
|
|
1438
|
+
for (let t of e.arrows) Ee(n, t);
|
|
1273
1439
|
for (let t of e.doors) n.push({
|
|
1274
1440
|
type: "rect",
|
|
1275
1441
|
x: t.x,
|
|
@@ -1290,7 +1456,7 @@ function be(e, t) {
|
|
|
1290
1456
|
children: n
|
|
1291
1457
|
};
|
|
1292
1458
|
}
|
|
1293
|
-
function
|
|
1459
|
+
function Ee(e, t) {
|
|
1294
1460
|
e.push({
|
|
1295
1461
|
type: "line",
|
|
1296
1462
|
points: t.points,
|
|
@@ -1320,7 +1486,7 @@ function xe(e, t) {
|
|
|
1320
1486
|
}
|
|
1321
1487
|
//#endregion
|
|
1322
1488
|
//#region src/scene/elements/SpecialExitLayout.ts
|
|
1323
|
-
function
|
|
1489
|
+
function De(e, t) {
|
|
1324
1490
|
let n = [];
|
|
1325
1491
|
if (n.push({
|
|
1326
1492
|
type: "line",
|
|
@@ -1381,7 +1547,7 @@ function Se(e, t) {
|
|
|
1381
1547
|
}
|
|
1382
1548
|
//#endregion
|
|
1383
1549
|
//#region src/scene/elements/StubLayout.ts
|
|
1384
|
-
function
|
|
1550
|
+
function Oe(e) {
|
|
1385
1551
|
return {
|
|
1386
1552
|
type: "group",
|
|
1387
1553
|
x: 0,
|
|
@@ -1409,11 +1575,11 @@ function Ce(e) {
|
|
|
1409
1575
|
}
|
|
1410
1576
|
//#endregion
|
|
1411
1577
|
//#region src/scene/elements/LabelLayout.ts
|
|
1412
|
-
function
|
|
1578
|
+
function ke(e) {
|
|
1413
1579
|
let t = (e?.alpha ?? 255) / 255, n = (e) => Math.min(255, Math.max(0, e ?? 0));
|
|
1414
1580
|
return `rgba(${n(e?.r)}, ${n(e?.g)}, ${n(e?.b)}, ${t})`;
|
|
1415
1581
|
}
|
|
1416
|
-
function
|
|
1582
|
+
function Ae(e, t) {
|
|
1417
1583
|
if (t.labelRenderMode === "none") return null;
|
|
1418
1584
|
let n = e.X, r = -e.Y, i = !!e.noScaling, a = i ? n : 0, o = i ? r : 0, s = i ? 0 : n, c = i ? 0 : r;
|
|
1419
1585
|
if (t.labelRenderMode === "image" && e.pixMap) return {
|
|
@@ -1442,7 +1608,7 @@ function Te(e, t) {
|
|
|
1442
1608
|
y: c,
|
|
1443
1609
|
width: e.Width,
|
|
1444
1610
|
height: e.Height,
|
|
1445
|
-
paint: { fill:
|
|
1611
|
+
paint: { fill: ke(e.BgColor) }
|
|
1446
1612
|
}), e.Text) {
|
|
1447
1613
|
let t = Math.min(.75, e.Width / Math.max(e.Text.length / 2, 1)), n = Math.max(.1, Math.min(t, Math.max(e.Height * .9, .1)));
|
|
1448
1614
|
l.push({
|
|
@@ -1453,7 +1619,7 @@ function Te(e, t) {
|
|
|
1453
1619
|
height: e.Height,
|
|
1454
1620
|
text: e.Text,
|
|
1455
1621
|
fontSize: n,
|
|
1456
|
-
fill:
|
|
1622
|
+
fill: ke(e.FgColor),
|
|
1457
1623
|
align: "center",
|
|
1458
1624
|
verticalAlign: "middle"
|
|
1459
1625
|
});
|
|
@@ -1473,11 +1639,11 @@ function Te(e, t) {
|
|
|
1473
1639
|
}
|
|
1474
1640
|
//#endregion
|
|
1475
1641
|
//#region src/ScenePipeline.ts
|
|
1476
|
-
function
|
|
1477
|
-
let n =
|
|
1642
|
+
function je(e, t) {
|
|
1643
|
+
let n = Me(e);
|
|
1478
1644
|
return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${t})` : e;
|
|
1479
1645
|
}
|
|
1480
|
-
function
|
|
1646
|
+
function Me(e) {
|
|
1481
1647
|
let t = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
1482
1648
|
if (t) return {
|
|
1483
1649
|
r: +t[1],
|
|
@@ -1490,11 +1656,11 @@ function De(e) {
|
|
|
1490
1656
|
b: parseInt(e.slice(5, 7), 16)
|
|
1491
1657
|
};
|
|
1492
1658
|
}
|
|
1493
|
-
function
|
|
1494
|
-
let r =
|
|
1659
|
+
function Ne(e, t, n) {
|
|
1660
|
+
let r = Me(e), i = Me(t);
|
|
1495
1661
|
return !r || !i ? e : `rgb(${Math.round(r.r * n + i.r * (1 - n))}, ${Math.round(r.g * n + i.g * (1 - n))}, ${Math.round(r.b * n + i.b * (1 - n))})`;
|
|
1496
1662
|
}
|
|
1497
|
-
function
|
|
1663
|
+
function Pe(e, t) {
|
|
1498
1664
|
let n = t * t, r = [];
|
|
1499
1665
|
outer: for (let t of e) {
|
|
1500
1666
|
for (let e of r) for (let r of e) {
|
|
@@ -1508,33 +1674,33 @@ function ke(e, t) {
|
|
|
1508
1674
|
}
|
|
1509
1675
|
return r;
|
|
1510
1676
|
}
|
|
1511
|
-
var
|
|
1677
|
+
var z = class {
|
|
1512
1678
|
constructor(e, t) {
|
|
1513
|
-
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new
|
|
1679
|
+
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new oe(e, t);
|
|
1514
1680
|
}
|
|
1515
|
-
buildScene(e, t, n) {
|
|
1681
|
+
buildScene(e, t, n, r = C) {
|
|
1516
1682
|
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.renderLabels(t.getLabels(), e.getAreaId());
|
|
1517
|
-
let
|
|
1683
|
+
let i = this.renderLinkExits(e.getLinkExits(n), n, r), a = (t.getRooms() ?? []).filter((e) => r.isVisible(e)), o = this.renderRooms(a, n);
|
|
1518
1684
|
this.renderAreaName(e, t);
|
|
1519
|
-
let
|
|
1520
|
-
|
|
1521
|
-
let
|
|
1685
|
+
let s = [...i.areaExitHitZones, ...o.areaExitHitZones], c = this.renderAreaExitLabels(s, e.getAreaId(), a, i.standaloneExitShapeRefs.map((e) => e.bounds));
|
|
1686
|
+
s.push(...c);
|
|
1687
|
+
let l = [
|
|
1522
1688
|
...this.linkShapes,
|
|
1523
1689
|
...this.roomShapes,
|
|
1524
1690
|
...this.topLabelShapes
|
|
1525
1691
|
];
|
|
1526
1692
|
return {
|
|
1527
|
-
roomShapeRefs:
|
|
1528
|
-
standaloneExitShapeRefs:
|
|
1693
|
+
roomShapeRefs: o.roomShapeRefs,
|
|
1694
|
+
standaloneExitShapeRefs: i.standaloneExitShapeRefs,
|
|
1529
1695
|
labelShapeRefs: this.labelShapeRefs,
|
|
1530
1696
|
specialExitShapeRefs: this.specialExitShapeRefs,
|
|
1531
1697
|
stubShapeRefs: this.stubShapeRefs,
|
|
1532
1698
|
areaExitLabelShapeRefs: this.areaExitLabelShapeRefs,
|
|
1533
|
-
areaExitHitZones:
|
|
1534
|
-
drawnExits:
|
|
1535
|
-
drawnSpecialExits:
|
|
1536
|
-
drawnStubs:
|
|
1537
|
-
hitShapes:
|
|
1699
|
+
areaExitHitZones: s,
|
|
1700
|
+
drawnExits: i.drawnExits,
|
|
1701
|
+
drawnSpecialExits: o.drawnSpecialExits,
|
|
1702
|
+
drawnStubs: o.drawnStubs,
|
|
1703
|
+
hitShapes: l,
|
|
1538
1704
|
sceneShapes: {
|
|
1539
1705
|
grid: [],
|
|
1540
1706
|
link: this.linkShapes,
|
|
@@ -1549,10 +1715,10 @@ var R = class {
|
|
|
1549
1715
|
renderRooms(e, t) {
|
|
1550
1716
|
let n = /* @__PURE__ */ new Map(), r = [], i = [], a = [], o = [];
|
|
1551
1717
|
e.forEach((e) => {
|
|
1552
|
-
let t =
|
|
1553
|
-
t.children.push(...
|
|
1554
|
-
for (let t of
|
|
1555
|
-
let n =
|
|
1718
|
+
let t = ye(e, this.mapReader, this.settings, { flatPipeline: !0 });
|
|
1719
|
+
t.children.push(...we(e, this.mapReader, this.settings));
|
|
1720
|
+
for (let t of de(e, this.settings)) {
|
|
1721
|
+
let n = De(t, e.id);
|
|
1556
1722
|
this.linkShapes.push(n);
|
|
1557
1723
|
let r = t.line.points, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
|
|
1558
1724
|
for (let e = 0; e < r.length; e += 2) r[e] < a && (a = r[e]), r[e] > s && (s = r[e]), r[e + 1] < o && (o = r[e + 1]), r[e + 1] > c && (c = r[e + 1]);
|
|
@@ -1597,8 +1763,8 @@ var R = class {
|
|
|
1597
1763
|
arrowColor: e.arrowColor
|
|
1598
1764
|
});
|
|
1599
1765
|
});
|
|
1600
|
-
for (let t of
|
|
1601
|
-
let e =
|
|
1766
|
+
for (let t of le(e, this.settings)) {
|
|
1767
|
+
let e = Oe(t);
|
|
1602
1768
|
this.linkShapes.push(e), a.push({
|
|
1603
1769
|
roomId: t.roomId,
|
|
1604
1770
|
direction: t.direction,
|
|
@@ -1631,12 +1797,21 @@ var R = class {
|
|
|
1631
1797
|
drawnStubs: a
|
|
1632
1798
|
};
|
|
1633
1799
|
}
|
|
1634
|
-
renderLinkExits(e, t) {
|
|
1635
|
-
let
|
|
1800
|
+
renderLinkExits(e, t, n) {
|
|
1801
|
+
let r = [], i = [], a = [];
|
|
1636
1802
|
return e.forEach((e) => {
|
|
1637
|
-
let
|
|
1638
|
-
if (!
|
|
1639
|
-
let
|
|
1803
|
+
let o = this.mapReader.getRoom(e.a), s = this.mapReader.getRoom(e.b);
|
|
1804
|
+
if (!o || !s) return;
|
|
1805
|
+
let c = n.getExitTreatment ? n.getExitTreatment(e, o, s) : w(n, e, o, s);
|
|
1806
|
+
if (c === "hidden") return;
|
|
1807
|
+
if (c === "stub") {
|
|
1808
|
+
let t = this.buildLensStub(e, o, s, n);
|
|
1809
|
+
t && this.emitLensStub(t);
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
let l = this.exitRenderer.renderData(e, t);
|
|
1813
|
+
if (!l) return;
|
|
1814
|
+
let u = Te(l, {
|
|
1640
1815
|
kind: "exit",
|
|
1641
1816
|
id: `${e.a}:${e.b}:${e.aDir ?? ""}:${e.bDir ?? ""}`,
|
|
1642
1817
|
payload: {
|
|
@@ -1647,37 +1822,69 @@ var R = class {
|
|
|
1647
1822
|
kind: e.kind ?? "exit"
|
|
1648
1823
|
}
|
|
1649
1824
|
});
|
|
1650
|
-
this.linkShapes.push(
|
|
1651
|
-
shape:
|
|
1652
|
-
bounds:
|
|
1653
|
-
targetRoomId:
|
|
1654
|
-
}),
|
|
1825
|
+
this.linkShapes.push(u), r.push({
|
|
1826
|
+
shape: u,
|
|
1827
|
+
bounds: l.bounds,
|
|
1828
|
+
targetRoomId: l.targetRoomId
|
|
1829
|
+
}), a.push({
|
|
1655
1830
|
a: e.a,
|
|
1656
1831
|
b: e.b,
|
|
1657
1832
|
aDir: e.aDir,
|
|
1658
1833
|
bDir: e.bDir,
|
|
1659
1834
|
kind: e.kind ?? "exit",
|
|
1660
1835
|
zIndex: e.zIndex,
|
|
1661
|
-
data:
|
|
1662
|
-
}),
|
|
1663
|
-
bounds:
|
|
1664
|
-
targetRoomId:
|
|
1665
|
-
from:
|
|
1666
|
-
tip:
|
|
1667
|
-
arrowColor:
|
|
1836
|
+
data: l
|
|
1837
|
+
}), l.targetRoomId !== void 0 && i.push({
|
|
1838
|
+
bounds: l.bounds,
|
|
1839
|
+
targetRoomId: l.targetRoomId,
|
|
1840
|
+
from: l.from,
|
|
1841
|
+
tip: l.tip,
|
|
1842
|
+
arrowColor: l.arrowColor
|
|
1668
1843
|
});
|
|
1669
1844
|
}), {
|
|
1670
|
-
standaloneExitShapeRefs:
|
|
1671
|
-
areaExitHitZones:
|
|
1672
|
-
drawnExits:
|
|
1845
|
+
standaloneExitShapeRefs: r,
|
|
1846
|
+
areaExitHitZones: i,
|
|
1847
|
+
drawnExits: a
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
buildLensStub(e, t, n, r) {
|
|
1851
|
+
let i = r.isVisible(t);
|
|
1852
|
+
if (i === r.isVisible(n)) return;
|
|
1853
|
+
let a = i ? t : n, o = i ? e.aDir : e.bDir;
|
|
1854
|
+
if (!o || !k.includes(o) || a.customLines[A[o]]) return;
|
|
1855
|
+
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l = P(a.x, a.y, o, s / 2 + .5);
|
|
1856
|
+
return {
|
|
1857
|
+
roomId: a.id,
|
|
1858
|
+
direction: o,
|
|
1859
|
+
x1: c.x,
|
|
1860
|
+
y1: c.y,
|
|
1861
|
+
x2: l.x,
|
|
1862
|
+
y2: l.y,
|
|
1863
|
+
stroke: this.settings.lineColor,
|
|
1864
|
+
strokeWidth: this.settings.lineWidth
|
|
1673
1865
|
};
|
|
1674
1866
|
}
|
|
1867
|
+
emitLensStub(e) {
|
|
1868
|
+
let t = Oe(e);
|
|
1869
|
+
this.linkShapes.push(t), this.stubShapeRefs.push({
|
|
1870
|
+
shape: t,
|
|
1871
|
+
bounds: {
|
|
1872
|
+
x: Math.min(e.x1, e.x2),
|
|
1873
|
+
y: Math.min(e.y1, e.y2),
|
|
1874
|
+
width: Math.abs(e.x2 - e.x1),
|
|
1875
|
+
height: Math.abs(e.y2 - e.y1)
|
|
1876
|
+
}
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
getRoomEdgePoint(e, t, n, r) {
|
|
1880
|
+
return this.settings.roomShape === "circle" ? re(e, t, n, r) : this.settings.roomShape === "roundedRectangle" ? F(e, t, n, r, this.settings.roomSize * .2) : P(e, t, n, r);
|
|
1881
|
+
}
|
|
1675
1882
|
buildExitShape(e) {
|
|
1676
|
-
return
|
|
1883
|
+
return Te(e);
|
|
1677
1884
|
}
|
|
1678
1885
|
renderLabels(e, t) {
|
|
1679
1886
|
for (let n of e) {
|
|
1680
|
-
let e =
|
|
1887
|
+
let e = Ae(n, this.settings);
|
|
1681
1888
|
e && (e.hit = {
|
|
1682
1889
|
kind: "label",
|
|
1683
1890
|
id: n.labelId,
|
|
@@ -1716,12 +1923,12 @@ var R = class {
|
|
|
1716
1923
|
}, c = a.get(e.area);
|
|
1717
1924
|
c ? c.push(s) : a.set(e.area, [s]);
|
|
1718
1925
|
}
|
|
1719
|
-
let o = this.settings.areaExitLabelFontSize, s = o * .6, c = o * .333, l = o * .55, u = o * 1.1, d = o * .6, f = .35, p = o * .1,
|
|
1720
|
-
x: e.x -
|
|
1721
|
-
y: e.y -
|
|
1722
|
-
width:
|
|
1723
|
-
height:
|
|
1724
|
-
})),
|
|
1926
|
+
let o = this.settings.areaExitLabelFontSize, s = o * .6, c = o * .333, l = o * .55, u = o * 1.1, d = o * .6, f = .35, p = o * .1, m = this.settings.roomSize, h = n.map((e) => ({
|
|
1927
|
+
x: e.x - m / 2,
|
|
1928
|
+
y: e.y - m / 2,
|
|
1929
|
+
width: m,
|
|
1930
|
+
height: m
|
|
1931
|
+
})), g = e.map((e) => e.bounds), v = (e, t, n) => {
|
|
1725
1932
|
let r = Math.max(0, Math.max(e.x, t.x) - Math.min(e.x + e.w, t.x + t.w)), i = Math.max(0, Math.max(e.y, t.y) - Math.min(e.y + e.h, t.y + t.h));
|
|
1726
1933
|
return Math.hypot(r, i) <= n;
|
|
1727
1934
|
}, y = (e, t, n, r, i) => {
|
|
@@ -1737,52 +1944,52 @@ var R = class {
|
|
|
1737
1944
|
[.707, -.707],
|
|
1738
1945
|
[-.707, -.707]
|
|
1739
1946
|
], x = (e, t, n) => {
|
|
1740
|
-
let i = t.length * l + s * 2, a = u + c * 2, o = 0, d = 0, f = 0, p = 0, m = Infinity,
|
|
1741
|
-
for (let t of e) o += t.tip.x, d += t.tip.y, f += t.dir.x, p += t.dir.y, t.tip.x < m && (m = t.tip.x), t.tip.x >
|
|
1947
|
+
let i = t.length * l + s * 2, a = u + c * 2, o = 0, d = 0, f = 0, p = 0, m = Infinity, _ = -Infinity, v = Infinity, x = -Infinity, S = /* @__PURE__ */ new Map();
|
|
1948
|
+
for (let t of e) o += t.tip.x, d += t.tip.y, f += t.dir.x, p += t.dir.y, t.tip.x < m && (m = t.tip.x), t.tip.x > _ && (_ = t.tip.x), t.tip.y < v && (v = t.tip.y), t.tip.y > x && (x = t.tip.y), S.set(t.color, (S.get(t.color) ?? 0) + 1);
|
|
1742
1949
|
let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0, E = w > 0 ? p / w : 0, D = 0;
|
|
1743
1950
|
for (let t = 0; t < e.length; t++) for (let n = t + 1; n < e.length; n++) {
|
|
1744
1951
|
let r = e[t].tip.x - e[n].tip.x, i = e[t].tip.y - e[n].tip.y, a = Math.hypot(r, i);
|
|
1745
1952
|
a > D && (D = a);
|
|
1746
1953
|
}
|
|
1747
|
-
let O = D > 3, ee = w / C >= .4, k = n?.x ?? (O ? (m +
|
|
1748
|
-
for (let [e, t] of S) t >
|
|
1749
|
-
let
|
|
1954
|
+
let O = D > 3, ee = w / C >= .4, k = n?.x ?? (O ? (m + _) / 2 : o / C), te = n?.y ?? (O ? (v + x) / 2 : d / C), A = "white", j = 0;
|
|
1955
|
+
for (let [e, t] of S) t > j && (A = e, j = t);
|
|
1956
|
+
let ne = h.concat(g).concat(r), M = (e, t, n = 0) => .5 + n + Math.abs(e) * i / 2 + Math.abs(t) * a / 2, N = [];
|
|
1750
1957
|
if (ee) {
|
|
1751
|
-
let e =
|
|
1752
|
-
|
|
1958
|
+
let e = M(T, E);
|
|
1959
|
+
N.push({
|
|
1753
1960
|
x: k + T * e,
|
|
1754
|
-
y:
|
|
1961
|
+
y: te + E * e
|
|
1755
1962
|
});
|
|
1756
1963
|
}
|
|
1757
|
-
|
|
1964
|
+
N.push({
|
|
1758
1965
|
x: k,
|
|
1759
|
-
y:
|
|
1966
|
+
y: te
|
|
1760
1967
|
});
|
|
1761
1968
|
for (let e of [
|
|
1762
1969
|
0,
|
|
1763
1970
|
.6,
|
|
1764
1971
|
1.4
|
|
1765
1972
|
]) for (let [t, n] of b) {
|
|
1766
|
-
let r =
|
|
1767
|
-
|
|
1973
|
+
let r = M(t, n, e);
|
|
1974
|
+
N.push({
|
|
1768
1975
|
x: k + t * r,
|
|
1769
|
-
y:
|
|
1976
|
+
y: te + n * r
|
|
1770
1977
|
});
|
|
1771
1978
|
}
|
|
1772
|
-
for (let t of
|
|
1979
|
+
for (let t of N) {
|
|
1773
1980
|
let n = t.x - i / 2, r = t.y - a / 2;
|
|
1774
|
-
if (!y(n, r, i, a,
|
|
1981
|
+
if (!y(n, r, i, a, ne)) return {
|
|
1775
1982
|
cluster: e,
|
|
1776
1983
|
boxX: n,
|
|
1777
1984
|
boxY: r,
|
|
1778
1985
|
boxW: i,
|
|
1779
1986
|
boxH: a,
|
|
1780
|
-
color:
|
|
1987
|
+
color: A
|
|
1781
1988
|
};
|
|
1782
1989
|
}
|
|
1783
1990
|
};
|
|
1784
1991
|
for (let [e, t] of a) {
|
|
1785
|
-
let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r =
|
|
1992
|
+
let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r = Pe(t, 10).map((e) => x(e, n)).filter((e) => e !== void 0), a = !0;
|
|
1786
1993
|
for (; a && r.length > 1;) {
|
|
1787
1994
|
a = !1;
|
|
1788
1995
|
outer: for (let e = 0; e < r.length; e++) for (let t = e + 1; t < r.length; t++) {
|
|
@@ -1808,7 +2015,7 @@ var R = class {
|
|
|
1808
2015
|
}
|
|
1809
2016
|
}
|
|
1810
2017
|
for (let e of r) {
|
|
1811
|
-
let t =
|
|
2018
|
+
let t = je(e.color, f), r = _(Ne(e.color, this.settings.backgroundColor, f)) > .55 ? "#000" : "#fff", a = {
|
|
1812
2019
|
type: "group",
|
|
1813
2020
|
x: 0,
|
|
1814
2021
|
y: 0,
|
|
@@ -1884,7 +2091,7 @@ var R = class {
|
|
|
1884
2091
|
};
|
|
1885
2092
|
//#endregion
|
|
1886
2093
|
//#region src/scene/elements/GridLayout.ts
|
|
1887
|
-
function
|
|
2094
|
+
function Fe(e, t, n = {}) {
|
|
1888
2095
|
if (!t.gridEnabled) return [];
|
|
1889
2096
|
let r = n.inverseTransform ?? ((e, t) => ({
|
|
1890
2097
|
x: e,
|
|
@@ -1921,11 +2128,11 @@ function Ae(e, t, n = {}) {
|
|
|
1921
2128
|
}
|
|
1922
2129
|
//#endregion
|
|
1923
2130
|
//#region src/export/clipSceneToViewport.ts
|
|
1924
|
-
function
|
|
2131
|
+
function Ie(e, t, n, r) {
|
|
1925
2132
|
if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
|
|
1926
2133
|
let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
|
|
1927
2134
|
if (l) {
|
|
1928
|
-
let c =
|
|
2135
|
+
let c = Le(e, t, n, r, l);
|
|
1929
2136
|
return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
|
|
1930
2137
|
}
|
|
1931
2138
|
return n >= i && e <= a && r >= o && t <= s;
|
|
@@ -1938,7 +2145,7 @@ function je(e, t, n, r) {
|
|
|
1938
2145
|
for (let { shape: t, bounds: n } of e.areaExitLabelShapeRefs) d.set(t, u(n.x, n.y, n.x + n.width, n.y + n.height));
|
|
1939
2146
|
return d;
|
|
1940
2147
|
}
|
|
1941
|
-
function
|
|
2148
|
+
function Le(e, t, n, r, i) {
|
|
1942
2149
|
let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
|
|
1943
2150
|
return {
|
|
1944
2151
|
minX: Math.min(a.x, o.x, s.x, c.x),
|
|
@@ -1947,13 +2154,13 @@ function Me(e, t, n, r, i) {
|
|
|
1947
2154
|
maxY: Math.max(a.y, o.y, s.y, c.y)
|
|
1948
2155
|
};
|
|
1949
2156
|
}
|
|
1950
|
-
function
|
|
1951
|
-
let i =
|
|
2157
|
+
function Re(e, t, n, r) {
|
|
2158
|
+
let i = Fe(t, n, { inverseTransform: r?.inverse });
|
|
1952
2159
|
if (!n.cullingEnabled) return {
|
|
1953
2160
|
...e.sceneShapes,
|
|
1954
2161
|
grid: i
|
|
1955
2162
|
};
|
|
1956
|
-
let a =
|
|
2163
|
+
let a = Ie(e, t, n, r);
|
|
1957
2164
|
return {
|
|
1958
2165
|
grid: i,
|
|
1959
2166
|
link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
|
|
@@ -1963,14 +2170,14 @@ function Ne(e, t, n, r) {
|
|
|
1963
2170
|
}
|
|
1964
2171
|
//#endregion
|
|
1965
2172
|
//#region src/rendering/SceneManager.ts
|
|
1966
|
-
var
|
|
2173
|
+
var ze = {
|
|
1967
2174
|
grid: [],
|
|
1968
2175
|
link: [],
|
|
1969
2176
|
room: [],
|
|
1970
2177
|
topLabel: []
|
|
1971
|
-
},
|
|
2178
|
+
}, Be = class {
|
|
1972
2179
|
constructor(e, t, n) {
|
|
1973
|
-
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new
|
|
2180
|
+
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new z(n, t);
|
|
1974
2181
|
}
|
|
1975
2182
|
get exitRenderer() {
|
|
1976
2183
|
return this.pipeline.exitRenderer;
|
|
@@ -1993,8 +2200,8 @@ var Pe = {
|
|
|
1993
2200
|
get hitShapes() {
|
|
1994
2201
|
return this.lastBuildResult?.hitShapes ?? [];
|
|
1995
2202
|
}
|
|
1996
|
-
rebuild(e, t, n) {
|
|
1997
|
-
return this.lastBuildResult = this.pipeline.buildScene(e, t, n), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
|
|
2203
|
+
rebuild(e, t, n, r) {
|
|
2204
|
+
return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
|
|
1998
2205
|
}
|
|
1999
2206
|
buildExitShape(e) {
|
|
2000
2207
|
return this.pipeline.buildExitShape(e);
|
|
@@ -2003,23 +2210,23 @@ var Pe = {
|
|
|
2003
2210
|
this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
|
|
2004
2211
|
}
|
|
2005
2212
|
resetPipeline(e) {
|
|
2006
|
-
this.pipeline = new
|
|
2213
|
+
this.pipeline = new z(e, this.settings), this.reset();
|
|
2007
2214
|
}
|
|
2008
|
-
cullInteractive(e =
|
|
2215
|
+
cullInteractive(e = O) {
|
|
2009
2216
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
2010
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e ===
|
|
2011
|
-
return
|
|
2217
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === O ? void 0 : { forward: e };
|
|
2218
|
+
return Ie(this.lastBuildResult, t, this.settings, n);
|
|
2012
2219
|
}
|
|
2013
|
-
cull(e =
|
|
2220
|
+
cull(e = O) {
|
|
2014
2221
|
if (!this.lastBuildResult) return {
|
|
2015
|
-
shapes:
|
|
2222
|
+
shapes: ze,
|
|
2016
2223
|
stats: {
|
|
2017
2224
|
visibleRooms: 0,
|
|
2018
2225
|
totalRooms: 0,
|
|
2019
2226
|
visibleExits: 0
|
|
2020
2227
|
}
|
|
2021
2228
|
};
|
|
2022
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e ===
|
|
2229
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === O ? void 0 : { forward: e }, r = Re(this.lastBuildResult, t, this.settings, n);
|
|
2023
2230
|
return {
|
|
2024
2231
|
shapes: r,
|
|
2025
2232
|
stats: {
|
|
@@ -2029,7 +2236,7 @@ var Pe = {
|
|
|
2029
2236
|
}
|
|
2030
2237
|
};
|
|
2031
2238
|
}
|
|
2032
|
-
},
|
|
2239
|
+
}, Ve = class {
|
|
2033
2240
|
setCursor(e) {
|
|
2034
2241
|
this.container.dataset.editorCursor || (this.container.style.cursor = e);
|
|
2035
2242
|
}
|
|
@@ -2222,7 +2429,7 @@ var Pe = {
|
|
|
2222
2429
|
};
|
|
2223
2430
|
//#endregion
|
|
2224
2431
|
//#region src/render/RecordingLayer.ts
|
|
2225
|
-
function
|
|
2432
|
+
function He(e, t) {
|
|
2226
2433
|
switch (t.type) {
|
|
2227
2434
|
case "rect":
|
|
2228
2435
|
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
@@ -2279,7 +2486,7 @@ function Le(e, t) {
|
|
|
2279
2486
|
break;
|
|
2280
2487
|
}
|
|
2281
2488
|
}
|
|
2282
|
-
var
|
|
2489
|
+
var Ue = class {
|
|
2283
2490
|
constructor(e, t) {
|
|
2284
2491
|
this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
|
|
2285
2492
|
}
|
|
@@ -2309,39 +2516,39 @@ var Re = class {
|
|
|
2309
2516
|
}
|
|
2310
2517
|
materialize() {
|
|
2311
2518
|
if (this._konvaGroup) return this._konvaGroup;
|
|
2312
|
-
let
|
|
2519
|
+
let e = new r.Group({
|
|
2313
2520
|
x: this.x,
|
|
2314
2521
|
y: this.y,
|
|
2315
2522
|
listening: !1,
|
|
2316
2523
|
visible: this._visible
|
|
2317
|
-
}),
|
|
2318
|
-
return
|
|
2524
|
+
}), t = this.commands;
|
|
2525
|
+
return e.add(new r.Shape({
|
|
2319
2526
|
listening: !1,
|
|
2320
2527
|
perfectDrawEnabled: !1,
|
|
2321
2528
|
sceneFunc: (e) => {
|
|
2322
|
-
let
|
|
2323
|
-
for (let e of
|
|
2529
|
+
let n = e._context;
|
|
2530
|
+
for (let e of t) He(n, e);
|
|
2324
2531
|
}
|
|
2325
|
-
})), this._konvaGroup =
|
|
2532
|
+
})), this._konvaGroup = e, e;
|
|
2326
2533
|
}
|
|
2327
|
-
},
|
|
2328
|
-
constructor(
|
|
2329
|
-
this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.konvaLayer =
|
|
2330
|
-
let
|
|
2331
|
-
this.konvaShape = new
|
|
2534
|
+
}, We = class {
|
|
2535
|
+
constructor(e) {
|
|
2536
|
+
this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
|
|
2537
|
+
let t = this;
|
|
2538
|
+
this.konvaShape = new r.Shape({
|
|
2332
2539
|
listening: !1,
|
|
2333
2540
|
perfectDrawEnabled: !1,
|
|
2334
2541
|
sceneFunc: (e) => {
|
|
2335
|
-
let
|
|
2336
|
-
for (let e of
|
|
2542
|
+
let n = e._context, r = n.getTransform(), i = r.a, a = r.b, o = r.c, s = r.d;
|
|
2543
|
+
for (let e of t.entries) {
|
|
2337
2544
|
if (!e.visible) continue;
|
|
2338
|
-
let
|
|
2339
|
-
e.noScaling ?
|
|
2340
|
-
for (let
|
|
2545
|
+
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
2546
|
+
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
2547
|
+
for (let t of e.commands) He(n, t);
|
|
2341
2548
|
}
|
|
2342
|
-
|
|
2549
|
+
n.setTransform(r);
|
|
2343
2550
|
}
|
|
2344
|
-
}),
|
|
2551
|
+
}), e.add(this.konvaShape);
|
|
2345
2552
|
}
|
|
2346
2553
|
addNode(e) {
|
|
2347
2554
|
let t = {
|
|
@@ -2365,24 +2572,24 @@ var Re = class {
|
|
|
2365
2572
|
ensureShape() {
|
|
2366
2573
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2367
2574
|
}
|
|
2368
|
-
},
|
|
2369
|
-
constructor(
|
|
2370
|
-
this.groups = [], this.konvaLayer =
|
|
2371
|
-
let
|
|
2372
|
-
this.konvaShape = new
|
|
2575
|
+
}, B = class {
|
|
2576
|
+
constructor(e) {
|
|
2577
|
+
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
2578
|
+
let t = this;
|
|
2579
|
+
this.konvaShape = new r.Shape({
|
|
2373
2580
|
listening: !1,
|
|
2374
2581
|
perfectDrawEnabled: !1,
|
|
2375
2582
|
sceneFunc: (e) => {
|
|
2376
|
-
let
|
|
2377
|
-
for (let e of
|
|
2583
|
+
let n = e._context, r = n.getTransform(), i = r.a, a = r.b, o = r.c, s = r.d;
|
|
2584
|
+
for (let e of t.groups) {
|
|
2378
2585
|
if (!e._visible) continue;
|
|
2379
|
-
let
|
|
2380
|
-
e.noScaling ?
|
|
2381
|
-
for (let
|
|
2586
|
+
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
2587
|
+
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
2588
|
+
for (let t of e.commands) He(n, t);
|
|
2382
2589
|
}
|
|
2383
|
-
|
|
2590
|
+
n.setTransform(r);
|
|
2384
2591
|
}
|
|
2385
|
-
}),
|
|
2592
|
+
}), e.add(this.konvaShape);
|
|
2386
2593
|
}
|
|
2387
2594
|
addNode(e) {
|
|
2388
2595
|
this.groups.push(e), this.ensureShape();
|
|
@@ -2396,7 +2603,7 @@ var Re = class {
|
|
|
2396
2603
|
ensureShape() {
|
|
2397
2604
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2398
2605
|
}
|
|
2399
|
-
},
|
|
2606
|
+
}, Ge = class {
|
|
2400
2607
|
constructor(e) {
|
|
2401
2608
|
this.konvaLayer = e;
|
|
2402
2609
|
}
|
|
@@ -2412,14 +2619,14 @@ var Re = class {
|
|
|
2412
2619
|
};
|
|
2413
2620
|
//#endregion
|
|
2414
2621
|
//#region src/render/shapeToRecording.ts
|
|
2415
|
-
function
|
|
2416
|
-
let t = new
|
|
2417
|
-
return e.noScale && (t.noScaling = !0),
|
|
2622
|
+
function Ke(e) {
|
|
2623
|
+
let t = new Ue(e.x, e.y);
|
|
2624
|
+
return e.noScale && (t.noScaling = !0), qe(t, e.children, 0, 0), t;
|
|
2418
2625
|
}
|
|
2419
|
-
function
|
|
2420
|
-
for (let i of t)
|
|
2626
|
+
function qe(e, t, n, r) {
|
|
2627
|
+
for (let i of t) Je(e, i, n, r);
|
|
2421
2628
|
}
|
|
2422
|
-
function
|
|
2629
|
+
function Je(e, t, n, r) {
|
|
2423
2630
|
switch (t.type) {
|
|
2424
2631
|
case "rect":
|
|
2425
2632
|
e.commands.push({
|
|
@@ -2448,7 +2655,7 @@ function Ue(e, t, n, r) {
|
|
|
2448
2655
|
});
|
|
2449
2656
|
return;
|
|
2450
2657
|
case "line": {
|
|
2451
|
-
let i = n === 0 && r === 0 ? t.points :
|
|
2658
|
+
let i = n === 0 && r === 0 ? t.points : Ye(t.points, n, r);
|
|
2452
2659
|
e.commands.push({
|
|
2453
2660
|
type: "line",
|
|
2454
2661
|
points: i,
|
|
@@ -2464,7 +2671,7 @@ function Ue(e, t, n, r) {
|
|
|
2464
2671
|
case "polygon":
|
|
2465
2672
|
e.commands.push({
|
|
2466
2673
|
type: "polygon",
|
|
2467
|
-
vertices: n === 0 && r === 0 ? t.vertices :
|
|
2674
|
+
vertices: n === 0 && r === 0 ? t.vertices : Ye(t.vertices, n, r),
|
|
2468
2675
|
fill: t.paint.fill,
|
|
2469
2676
|
stroke: t.paint.stroke,
|
|
2470
2677
|
sw: t.paint.strokeWidth ?? 0
|
|
@@ -2491,7 +2698,7 @@ function Ue(e, t, n, r) {
|
|
|
2491
2698
|
});
|
|
2492
2699
|
return;
|
|
2493
2700
|
case "image": {
|
|
2494
|
-
let i =
|
|
2701
|
+
let i = Xe(t.src);
|
|
2495
2702
|
e.commands.push({
|
|
2496
2703
|
type: "image",
|
|
2497
2704
|
x: t.x + n,
|
|
@@ -2504,35 +2711,35 @@ function Ue(e, t, n, r) {
|
|
|
2504
2711
|
return;
|
|
2505
2712
|
}
|
|
2506
2713
|
case "group":
|
|
2507
|
-
|
|
2714
|
+
qe(e, t.children, n + t.x, r + t.y);
|
|
2508
2715
|
return;
|
|
2509
2716
|
}
|
|
2510
2717
|
}
|
|
2511
|
-
function
|
|
2718
|
+
function Ye(e, t, n) {
|
|
2512
2719
|
let r = Array(e.length);
|
|
2513
2720
|
for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
|
|
2514
2721
|
return r;
|
|
2515
2722
|
}
|
|
2516
|
-
function
|
|
2517
|
-
let
|
|
2518
|
-
return
|
|
2723
|
+
function Xe(e) {
|
|
2724
|
+
let t = r === void 0 ? typeof Image < "u" ? new Image() : null : r.Util.createImageElement();
|
|
2725
|
+
return t && (t.src = e), t;
|
|
2519
2726
|
}
|
|
2520
2727
|
//#endregion
|
|
2521
2728
|
//#region src/PathData.ts
|
|
2522
|
-
var
|
|
2729
|
+
var V = [
|
|
2523
2730
|
"up",
|
|
2524
2731
|
"down",
|
|
2525
2732
|
"in",
|
|
2526
2733
|
"out"
|
|
2527
2734
|
];
|
|
2528
|
-
function
|
|
2529
|
-
return e.roomShape === "circle" ?
|
|
2735
|
+
function H(e, t, n, r, i) {
|
|
2736
|
+
return e.roomShape === "circle" ? re(t, n, r, i) : e.roomShape === "roundedRectangle" ? F(t, n, r, i, e.roomSize * .2) : P(t, n, r, i);
|
|
2530
2737
|
}
|
|
2531
|
-
function
|
|
2738
|
+
function Ze(e, t, n) {
|
|
2532
2739
|
for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
|
|
2533
2740
|
let r = e;
|
|
2534
|
-
if (
|
|
2535
|
-
let e =
|
|
2741
|
+
if (V.includes(r)) {
|
|
2742
|
+
let e = A[r];
|
|
2536
2743
|
return {
|
|
2537
2744
|
type: "inner",
|
|
2538
2745
|
fromDir: r,
|
|
@@ -2541,7 +2748,7 @@ function Ke(e, t, n) {
|
|
|
2541
2748
|
toRoom: n
|
|
2542
2749
|
};
|
|
2543
2750
|
}
|
|
2544
|
-
let i =
|
|
2751
|
+
let i = A[r];
|
|
2545
2752
|
return t.customLines[i] ? {
|
|
2546
2753
|
type: "special",
|
|
2547
2754
|
fromDir: r,
|
|
@@ -2557,7 +2764,7 @@ function Ke(e, t, n) {
|
|
|
2557
2764
|
} : {
|
|
2558
2765
|
type: "regular",
|
|
2559
2766
|
fromDir: r,
|
|
2560
|
-
toDir:
|
|
2767
|
+
toDir: Qe(n, t.id),
|
|
2561
2768
|
fromRoom: t,
|
|
2562
2769
|
toRoom: n
|
|
2563
2770
|
};
|
|
@@ -2574,8 +2781,8 @@ function Ke(e, t, n) {
|
|
|
2574
2781
|
};
|
|
2575
2782
|
for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
|
|
2576
2783
|
let r = e;
|
|
2577
|
-
if (
|
|
2578
|
-
let e =
|
|
2784
|
+
if (V.includes(r)) {
|
|
2785
|
+
let e = A[r];
|
|
2579
2786
|
return {
|
|
2580
2787
|
type: "inner",
|
|
2581
2788
|
toDir: r,
|
|
@@ -2584,7 +2791,7 @@ function Ke(e, t, n) {
|
|
|
2584
2791
|
toRoom: n
|
|
2585
2792
|
};
|
|
2586
2793
|
}
|
|
2587
|
-
let i =
|
|
2794
|
+
let i = A[r];
|
|
2588
2795
|
return n.customLines[i] ? {
|
|
2589
2796
|
type: "special",
|
|
2590
2797
|
toDir: r,
|
|
@@ -2620,39 +2827,39 @@ function Ke(e, t, n) {
|
|
|
2620
2827
|
toRoom: n
|
|
2621
2828
|
};
|
|
2622
2829
|
}
|
|
2623
|
-
function
|
|
2830
|
+
function Qe(e, t) {
|
|
2624
2831
|
for (let [n, r] of Object.entries(e.exits)) if (r === t) return n;
|
|
2625
2832
|
}
|
|
2626
|
-
function
|
|
2833
|
+
function $e(e, t, n) {
|
|
2627
2834
|
return e ? e.area === t && e.z === n : !1;
|
|
2628
2835
|
}
|
|
2629
|
-
function
|
|
2836
|
+
function et(e, t) {
|
|
2630
2837
|
for (let [n, r] of Object.entries(e.exits)) if (r === t.id) return { direction: n };
|
|
2631
2838
|
for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
|
|
2632
2839
|
}
|
|
2633
|
-
function
|
|
2634
|
-
for (let n of
|
|
2635
|
-
for (let n of
|
|
2840
|
+
function tt(e, t) {
|
|
2841
|
+
for (let n of ne) if (e.exits[n] === t.id) return n;
|
|
2842
|
+
for (let n of ne) if (t.exits[n] === e.id) return M[n];
|
|
2636
2843
|
}
|
|
2637
|
-
function
|
|
2844
|
+
function nt(e, t, n) {
|
|
2638
2845
|
let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
|
|
2639
|
-
if (n.length === 0 && n.push(r.x, r.y), a &&
|
|
2640
|
-
let t =
|
|
2846
|
+
if (n.length === 0 && n.push(r.x, r.y), a && k.includes(a)) {
|
|
2847
|
+
let t = H(e, r.x, r.y, a, e.roomSize / 2);
|
|
2641
2848
|
n.push(t.x, t.y);
|
|
2642
2849
|
}
|
|
2643
|
-
if (o &&
|
|
2644
|
-
let t =
|
|
2850
|
+
if (o && k.includes(o)) {
|
|
2851
|
+
let t = H(e, i.x, i.y, o, e.roomSize / 2);
|
|
2645
2852
|
n.push(t.x, t.y);
|
|
2646
2853
|
}
|
|
2647
2854
|
n.push(i.x, i.y);
|
|
2648
2855
|
}
|
|
2649
|
-
function
|
|
2856
|
+
function rt(e, t) {
|
|
2650
2857
|
let { fromRoom: n, toRoom: r, customLineKey: i } = e, a = n, o;
|
|
2651
2858
|
i && (o = n.customLines[i], o || (o = r.customLines[i], a = r)), t.length === 0 && t.push(a.x, a.y), o && o.points.forEach((e) => {
|
|
2652
2859
|
t.push(e.x, -e.y);
|
|
2653
2860
|
}), t.push(r.x, r.y);
|
|
2654
2861
|
}
|
|
2655
|
-
function
|
|
2862
|
+
function it(e, t, n, r, i) {
|
|
2656
2863
|
let a = [], o = [], s = [], c = n.map((t) => e.getRoom(t)).filter((e) => e !== void 0), l = [], u = () => {
|
|
2657
2864
|
l.length >= 4 && a.push({ points: [...l] }), l = [];
|
|
2658
2865
|
}, d = (e) => {
|
|
@@ -2666,28 +2873,28 @@ function $e(e, t, n, r, i) {
|
|
|
2666
2873
|
}), s.push({ points: t });
|
|
2667
2874
|
}
|
|
2668
2875
|
}
|
|
2669
|
-
r &&
|
|
2876
|
+
r && V.includes(r) && o.push({
|
|
2670
2877
|
room: t,
|
|
2671
2878
|
direction: r
|
|
2672
|
-
}), i &&
|
|
2879
|
+
}), i && V.includes(i) && o.push({
|
|
2673
2880
|
room: n,
|
|
2674
2881
|
direction: i
|
|
2675
2882
|
});
|
|
2676
2883
|
};
|
|
2677
2884
|
for (let n = 0; n < c.length - 1; n++) {
|
|
2678
|
-
let a = c[n], s = c[n + 1], f =
|
|
2885
|
+
let a = c[n], s = c[n + 1], f = $e(a, r, i), p = $e(s, r, i);
|
|
2679
2886
|
if (!f && !p) {
|
|
2680
2887
|
u();
|
|
2681
2888
|
continue;
|
|
2682
2889
|
}
|
|
2683
2890
|
if (f && p) {
|
|
2684
|
-
let n =
|
|
2891
|
+
let n = Ze(e, a, s);
|
|
2685
2892
|
switch (n.type) {
|
|
2686
2893
|
case "regular":
|
|
2687
|
-
|
|
2894
|
+
nt(t, n, l);
|
|
2688
2895
|
break;
|
|
2689
2896
|
case "special":
|
|
2690
|
-
|
|
2897
|
+
rt(n, l);
|
|
2691
2898
|
break;
|
|
2692
2899
|
case "inner":
|
|
2693
2900
|
u(), d(n);
|
|
@@ -2697,22 +2904,22 @@ function $e(e, t, n, r, i) {
|
|
|
2697
2904
|
break;
|
|
2698
2905
|
}
|
|
2699
2906
|
} else {
|
|
2700
|
-
let e = f ? a : s, n = f ? s : a, r =
|
|
2907
|
+
let e = f ? a : s, n = f ? s : a, r = et(e, n);
|
|
2701
2908
|
if (r) {
|
|
2702
|
-
if (
|
|
2909
|
+
if (V.includes(r.direction)) u(), o.push({
|
|
2703
2910
|
room: e,
|
|
2704
2911
|
direction: r.direction
|
|
2705
2912
|
});
|
|
2706
|
-
else if (
|
|
2913
|
+
else if (k.includes(r.direction)) {
|
|
2707
2914
|
l.length === 0 && l.push(e.x, e.y);
|
|
2708
|
-
let n =
|
|
2915
|
+
let n = H(t, e.x, e.y, r.direction, t.roomSize / 2), i = P(e.x, e.y, r.direction, t.roomSize);
|
|
2709
2916
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2710
2917
|
}
|
|
2711
2918
|
} else {
|
|
2712
|
-
let r =
|
|
2919
|
+
let r = tt(e, n);
|
|
2713
2920
|
if (r) {
|
|
2714
2921
|
l.length === 0 && l.push(e.x, e.y);
|
|
2715
|
-
let n =
|
|
2922
|
+
let n = H(t, e.x, e.y, r, t.roomSize / 2), i = P(e.x, e.y, r, t.roomSize);
|
|
2716
2923
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2717
2924
|
}
|
|
2718
2925
|
}
|
|
@@ -2726,20 +2933,24 @@ function $e(e, t, n, r, i) {
|
|
|
2726
2933
|
}
|
|
2727
2934
|
//#endregion
|
|
2728
2935
|
//#region src/scene/OverlayStyle.ts
|
|
2729
|
-
function
|
|
2730
|
-
let r =
|
|
2936
|
+
function at(e, t, n) {
|
|
2937
|
+
let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = r.matchRoomShape && n.roomShape !== "circle";
|
|
2731
2938
|
return {
|
|
2732
|
-
shape:
|
|
2939
|
+
shape: o ? "rect" : "circle",
|
|
2733
2940
|
cx: e.x,
|
|
2734
2941
|
cy: e.y,
|
|
2735
|
-
size: i / 2 *
|
|
2736
|
-
cornerRadius: n.roomShape === "roundedRectangle" ? i *
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2942
|
+
size: i / 2 * a,
|
|
2943
|
+
cornerRadius: o && n.roomShape === "roundedRectangle" ? i * a * .2 : 0,
|
|
2944
|
+
strokeColor: t,
|
|
2945
|
+
strokeAlpha: r.strokeAlpha,
|
|
2946
|
+
strokeWidth: r.strokeWidth,
|
|
2947
|
+
fillColor: t,
|
|
2948
|
+
fillAlpha: r.fillAlpha,
|
|
2949
|
+
dash: r.dash,
|
|
2950
|
+
dashEnabled: r.dashEnabled
|
|
2740
2951
|
};
|
|
2741
2952
|
}
|
|
2742
|
-
function
|
|
2953
|
+
function ot(e, t) {
|
|
2743
2954
|
let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
|
|
2744
2955
|
return {
|
|
2745
2956
|
shape: i ? "rect" : "circle",
|
|
@@ -2756,14 +2967,14 @@ function tt(e, t) {
|
|
|
2756
2967
|
dashEnabled: n.dashEnabled
|
|
2757
2968
|
};
|
|
2758
2969
|
}
|
|
2759
|
-
function
|
|
2760
|
-
let o =
|
|
2970
|
+
function st(e, t, n, r, i, a) {
|
|
2971
|
+
let o = it(e, t, n, i, a), s = t.lineWidth, c = t.roomSize / 5, l = [];
|
|
2761
2972
|
for (let e of o.segments) e.points.length >= 4 && l.push({ points: e.points });
|
|
2762
2973
|
for (let e of o.customLines) e.points.length >= 4 && l.push({ points: e.points });
|
|
2763
2974
|
let u = [];
|
|
2764
2975
|
for (let e of o.innerMarkers) {
|
|
2765
2976
|
let t = e.direction === "up" ? 0 : e.direction === "down" ? 180 : e.direction === "in" ? 90 : -90;
|
|
2766
|
-
u.push({ vertices:
|
|
2977
|
+
u.push({ vertices: R(e.room.x, e.room.y, c, t) });
|
|
2767
2978
|
}
|
|
2768
2979
|
return {
|
|
2769
2980
|
segments: l,
|
|
@@ -2775,66 +2986,80 @@ function nt(e, t, n, r, i, a) {
|
|
|
2775
2986
|
}
|
|
2776
2987
|
//#endregion
|
|
2777
2988
|
//#region src/scene/elements/OverlayLayout.ts
|
|
2778
|
-
function
|
|
2989
|
+
function ct(e) {
|
|
2990
|
+
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
2779
2991
|
if (e.shape === "circle") return {
|
|
2780
2992
|
type: "circle",
|
|
2781
2993
|
cx: e.cx,
|
|
2782
2994
|
cy: e.cy,
|
|
2783
2995
|
radius: e.size,
|
|
2784
2996
|
paint: {
|
|
2785
|
-
|
|
2997
|
+
fill: n,
|
|
2998
|
+
stroke: t,
|
|
2786
2999
|
strokeWidth: e.strokeWidth,
|
|
2787
3000
|
dash: e.dash,
|
|
2788
|
-
dashEnabled:
|
|
3001
|
+
dashEnabled: e.dashEnabled
|
|
2789
3002
|
},
|
|
2790
3003
|
layer: "overlay"
|
|
2791
3004
|
};
|
|
2792
|
-
let
|
|
3005
|
+
let r = e.cx - e.size, i = e.cy - e.size, a = e.cx + e.size, o = e.cy + e.size, s = [
|
|
3006
|
+
[
|
|
3007
|
+
r,
|
|
3008
|
+
i,
|
|
3009
|
+
a,
|
|
3010
|
+
i
|
|
3011
|
+
],
|
|
3012
|
+
[
|
|
3013
|
+
a,
|
|
3014
|
+
i,
|
|
3015
|
+
a,
|
|
3016
|
+
o
|
|
3017
|
+
],
|
|
3018
|
+
[
|
|
3019
|
+
a,
|
|
3020
|
+
o,
|
|
3021
|
+
r,
|
|
3022
|
+
o
|
|
3023
|
+
],
|
|
3024
|
+
[
|
|
3025
|
+
r,
|
|
3026
|
+
o,
|
|
3027
|
+
r,
|
|
3028
|
+
i
|
|
3029
|
+
]
|
|
3030
|
+
], c = [];
|
|
3031
|
+
n && c.push({
|
|
3032
|
+
type: "rect",
|
|
3033
|
+
x: r,
|
|
3034
|
+
y: i,
|
|
3035
|
+
width: e.size * 2,
|
|
3036
|
+
height: e.size * 2,
|
|
3037
|
+
cornerRadius: e.cornerRadius,
|
|
3038
|
+
paint: { fill: n },
|
|
3039
|
+
layer: "overlay"
|
|
3040
|
+
});
|
|
3041
|
+
for (let n of s) c.push({
|
|
3042
|
+
type: "line",
|
|
3043
|
+
points: n,
|
|
3044
|
+
paint: {
|
|
3045
|
+
stroke: t,
|
|
3046
|
+
strokeWidth: e.strokeWidth,
|
|
3047
|
+
dash: e.dash,
|
|
3048
|
+
dashEnabled: e.dashEnabled
|
|
3049
|
+
},
|
|
3050
|
+
lineCap: "butt",
|
|
3051
|
+
layer: "overlay"
|
|
3052
|
+
});
|
|
2793
3053
|
return {
|
|
2794
3054
|
type: "group",
|
|
2795
3055
|
x: 0,
|
|
2796
3056
|
y: 0,
|
|
2797
|
-
children:
|
|
2798
|
-
[
|
|
2799
|
-
t,
|
|
2800
|
-
n,
|
|
2801
|
-
r,
|
|
2802
|
-
n
|
|
2803
|
-
],
|
|
2804
|
-
[
|
|
2805
|
-
r,
|
|
2806
|
-
n,
|
|
2807
|
-
r,
|
|
2808
|
-
i
|
|
2809
|
-
],
|
|
2810
|
-
[
|
|
2811
|
-
r,
|
|
2812
|
-
i,
|
|
2813
|
-
t,
|
|
2814
|
-
i
|
|
2815
|
-
],
|
|
2816
|
-
[
|
|
2817
|
-
t,
|
|
2818
|
-
i,
|
|
2819
|
-
t,
|
|
2820
|
-
n
|
|
2821
|
-
]
|
|
2822
|
-
].map((t) => ({
|
|
2823
|
-
type: "line",
|
|
2824
|
-
points: t,
|
|
2825
|
-
paint: {
|
|
2826
|
-
stroke: e.stroke,
|
|
2827
|
-
strokeWidth: e.strokeWidth,
|
|
2828
|
-
dash: e.dash
|
|
2829
|
-
},
|
|
2830
|
-
lineCap: "butt",
|
|
2831
|
-
layer: "overlay"
|
|
2832
|
-
})),
|
|
3057
|
+
children: c,
|
|
2833
3058
|
layer: "overlay"
|
|
2834
3059
|
};
|
|
2835
3060
|
}
|
|
2836
|
-
function
|
|
2837
|
-
let t =
|
|
3061
|
+
function lt(e) {
|
|
3062
|
+
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
2838
3063
|
return e.shape === "circle" ? {
|
|
2839
3064
|
type: "circle",
|
|
2840
3065
|
cx: e.cx,
|
|
@@ -2865,7 +3090,7 @@ function it(e) {
|
|
|
2865
3090
|
layer: "overlay"
|
|
2866
3091
|
};
|
|
2867
3092
|
}
|
|
2868
|
-
function
|
|
3093
|
+
function ut(e) {
|
|
2869
3094
|
let t = [];
|
|
2870
3095
|
for (let n of e.segments) t.push({
|
|
2871
3096
|
type: "line",
|
|
@@ -2903,236 +3128,30 @@ function at(e) {
|
|
|
2903
3128
|
return t;
|
|
2904
3129
|
}
|
|
2905
3130
|
//#endregion
|
|
2906
|
-
//#region src/
|
|
2907
|
-
var
|
|
2908
|
-
constructor(e, t) {
|
|
2909
|
-
this.rooms = [], this.labels = [], this.rooms = e, this.labels = t, this.bounds = this.createBounds();
|
|
2910
|
-
}
|
|
2911
|
-
getRooms() {
|
|
2912
|
-
return this.rooms;
|
|
2913
|
-
}
|
|
2914
|
-
getLabels() {
|
|
2915
|
-
return this.labels;
|
|
2916
|
-
}
|
|
2917
|
-
getBounds() {
|
|
2918
|
-
return this.bounds;
|
|
2919
|
-
}
|
|
2920
|
-
createBounds() {
|
|
2921
|
-
let e = this.rooms.reduce((e, t) => ({
|
|
2922
|
-
minX: Math.min(e.minX, t.x),
|
|
2923
|
-
maxX: Math.max(e.maxX, t.x),
|
|
2924
|
-
minY: Math.min(e.minY, t.y),
|
|
2925
|
-
maxY: Math.max(e.maxY, t.y)
|
|
2926
|
-
}), {
|
|
2927
|
-
minX: Infinity,
|
|
2928
|
-
maxX: -Infinity,
|
|
2929
|
-
minY: Infinity,
|
|
2930
|
-
maxY: -Infinity
|
|
2931
|
-
});
|
|
2932
|
-
for (let t of this.labels) {
|
|
2933
|
-
let n = t.X, r = -t.Y;
|
|
2934
|
-
e.minX = Math.min(e.minX, n), e.maxX = Math.max(e.maxX, n + t.Width), e.minY = Math.min(e.minY, r), e.maxY = Math.max(e.maxY, r + t.Height);
|
|
2935
|
-
}
|
|
2936
|
-
return e;
|
|
2937
|
-
}
|
|
2938
|
-
}, st = class e {
|
|
2939
|
-
constructor(e) {
|
|
2940
|
-
this.planes = {}, this.exits = /* @__PURE__ */ new Map(), this.version = 0, this.area = e, this.planes = this.createPlanes(), this.createExits();
|
|
2941
|
-
}
|
|
2942
|
-
getAreaName() {
|
|
2943
|
-
return this.area.areaName;
|
|
2944
|
-
}
|
|
2945
|
-
getAreaId() {
|
|
2946
|
-
return parseInt(this.area.areaId);
|
|
2947
|
-
}
|
|
2948
|
-
getVersion() {
|
|
2949
|
-
return this.version;
|
|
2950
|
-
}
|
|
2951
|
-
markDirty() {
|
|
2952
|
-
this.version++;
|
|
2953
|
-
}
|
|
2954
|
-
getPlane(e) {
|
|
2955
|
-
return this.planes[e];
|
|
2956
|
-
}
|
|
2957
|
-
getPlanes() {
|
|
2958
|
-
return Object.values(this.planes);
|
|
2959
|
-
}
|
|
2960
|
-
getZLevels() {
|
|
2961
|
-
return Object.keys(this.planes).map(Number).sort((e, t) => e - t);
|
|
2962
|
-
}
|
|
2963
|
-
getRooms() {
|
|
2964
|
-
return this.area.rooms;
|
|
2965
|
-
}
|
|
2966
|
-
getFullBounds() {
|
|
2967
|
-
return this.getPlanes().reduce((e, t) => {
|
|
2968
|
-
let n = t.getBounds();
|
|
2969
|
-
return {
|
|
2970
|
-
minX: Math.min(e.minX, n.minX),
|
|
2971
|
-
maxX: Math.max(e.maxX, n.maxX),
|
|
2972
|
-
minY: Math.min(e.minY, n.minY),
|
|
2973
|
-
maxY: Math.max(e.maxY, n.maxY)
|
|
2974
|
-
};
|
|
2975
|
-
}, {
|
|
2976
|
-
minX: Infinity,
|
|
2977
|
-
maxX: -Infinity,
|
|
2978
|
-
minY: Infinity,
|
|
2979
|
-
maxY: -Infinity
|
|
2980
|
-
});
|
|
2981
|
-
}
|
|
2982
|
-
getLinkExits(e) {
|
|
2983
|
-
return Array.from(this.exits.values()).filter((t) => t.zIndex.includes(e));
|
|
2984
|
-
}
|
|
2985
|
-
createPlanes() {
|
|
2986
|
-
let e = this.area.rooms.reduce((e, t) => (e[t.z] || (e[t.z] = []), e[t.z].push(t), e), {});
|
|
2987
|
-
return Object.entries(e).reduce((e, [t, n]) => (e[+t] = new ot(n, this.area.labels.filter((e) => e.Z === +t)), e), {});
|
|
2988
|
-
}
|
|
2989
|
-
static {
|
|
2990
|
-
this.oppositeDir = {
|
|
2991
|
-
north: "south",
|
|
2992
|
-
south: "north",
|
|
2993
|
-
east: "west",
|
|
2994
|
-
west: "east",
|
|
2995
|
-
northeast: "southwest",
|
|
2996
|
-
southwest: "northeast",
|
|
2997
|
-
northwest: "southeast",
|
|
2998
|
-
southeast: "northwest",
|
|
2999
|
-
up: "down",
|
|
3000
|
-
down: "up",
|
|
3001
|
-
in: "out",
|
|
3002
|
-
out: "in"
|
|
3003
|
-
};
|
|
3004
|
-
}
|
|
3005
|
-
createExits() {
|
|
3006
|
-
let t = /* @__PURE__ */ new Map();
|
|
3007
|
-
this.area.rooms.forEach((e) => {
|
|
3008
|
-
Object.entries(e.exits).forEach(([n, r]) => {
|
|
3009
|
-
if (e.id === r) return;
|
|
3010
|
-
let i = `${Math.min(e.id, r)}-${Math.max(e.id, r)}`;
|
|
3011
|
-
t.has(i) || t.set(i, []), t.get(i).push({
|
|
3012
|
-
origin: e.id,
|
|
3013
|
-
target: r,
|
|
3014
|
-
z: e.z,
|
|
3015
|
-
dir: n
|
|
3016
|
-
});
|
|
3017
|
-
});
|
|
3018
|
-
});
|
|
3019
|
-
for (let [n, r] of t) {
|
|
3020
|
-
let [t, i] = n.split("-"), a = parseInt(t), o = parseInt(i), s = r.filter((e) => e.origin === a), c = r.filter((e) => e.origin === o), l = /* @__PURE__ */ new Set();
|
|
3021
|
-
for (let t of s) {
|
|
3022
|
-
let r = -1;
|
|
3023
|
-
for (let n = 0; n < c.length; n++) if (!l.has(n) && c[n].dir === e.oppositeDir[t.dir]) {
|
|
3024
|
-
r = n;
|
|
3025
|
-
break;
|
|
3026
|
-
}
|
|
3027
|
-
if (r !== -1) {
|
|
3028
|
-
l.add(r);
|
|
3029
|
-
let e = c[r];
|
|
3030
|
-
this.exits.set(`${n}-${t.dir}`, {
|
|
3031
|
-
a,
|
|
3032
|
-
b: o,
|
|
3033
|
-
aDir: t.dir,
|
|
3034
|
-
bDir: e.dir,
|
|
3035
|
-
zIndex: [t.z, e.z]
|
|
3036
|
-
});
|
|
3037
|
-
} else this.exits.set(`${n}-a:${t.dir}`, {
|
|
3038
|
-
a,
|
|
3039
|
-
b: o,
|
|
3040
|
-
aDir: t.dir,
|
|
3041
|
-
zIndex: [t.z]
|
|
3042
|
-
});
|
|
3043
|
-
}
|
|
3044
|
-
for (let e = 0; e < c.length; e++) if (!l.has(e)) {
|
|
3045
|
-
let t = c[e];
|
|
3046
|
-
this.exits.set(`${n}-b:${t.dir}`, {
|
|
3047
|
-
a,
|
|
3048
|
-
b: o,
|
|
3049
|
-
bDir: t.dir,
|
|
3050
|
-
zIndex: [t.z]
|
|
3051
|
-
});
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
}, ct = class extends ot {
|
|
3056
|
-
constructor(e, t) {
|
|
3057
|
-
super(e.getRooms(), e.getLabels()), this.basePlane = e, this.visitedRooms = t;
|
|
3058
|
-
}
|
|
3059
|
-
getRooms() {
|
|
3060
|
-
return this.basePlane.getRooms().filter((e) => this.visitedRooms.has(e.id));
|
|
3061
|
-
}
|
|
3062
|
-
getLabels() {
|
|
3063
|
-
return this.basePlane.getLabels();
|
|
3064
|
-
}
|
|
3065
|
-
getBounds() {
|
|
3066
|
-
return this.basePlane.getBounds();
|
|
3067
|
-
}
|
|
3068
|
-
}, H = class extends st {
|
|
3069
|
-
constructor(e, t) {
|
|
3070
|
-
super(e), this.planeCache = /* @__PURE__ */ new WeakMap(), this.visitedRooms = t instanceof Set ? t : new Set(t ?? []), this.areaRoomIds = new Set(e.rooms.map((e) => e.id));
|
|
3071
|
-
}
|
|
3072
|
-
getPlane(e) {
|
|
3073
|
-
let t = super.getPlane(e);
|
|
3074
|
-
if (!t) return t;
|
|
3075
|
-
let n = this.planeCache.get(t);
|
|
3076
|
-
return n || (n = new ct(t, this.visitedRooms), this.planeCache.set(t, n)), n;
|
|
3077
|
-
}
|
|
3078
|
-
getPlanes() {
|
|
3079
|
-
return super.getPlanes().map((e) => {
|
|
3080
|
-
let t = this.planeCache.get(e);
|
|
3081
|
-
return t || (t = new ct(e, this.visitedRooms), this.planeCache.set(e, t)), t;
|
|
3082
|
-
});
|
|
3083
|
-
}
|
|
3084
|
-
getLinkExits(e) {
|
|
3085
|
-
return super.getLinkExits(e).filter((e) => this.visitedRooms.has(e.a) || this.visitedRooms.has(e.b));
|
|
3086
|
-
}
|
|
3087
|
-
getVisitedRoomCount() {
|
|
3088
|
-
return super.getRooms().reduce((e, t) => e + +!!this.visitedRooms.has(t.id), 0);
|
|
3089
|
-
}
|
|
3090
|
-
getTotalRoomCount() {
|
|
3091
|
-
return this.areaRoomIds.size;
|
|
3092
|
-
}
|
|
3093
|
-
hasVisitedRoom(e) {
|
|
3094
|
-
return this.areaRoomIds.has(e) && this.visitedRooms.has(e);
|
|
3095
|
-
}
|
|
3096
|
-
getVisitedRoomIds() {
|
|
3097
|
-
return super.getRooms().filter((e) => this.visitedRooms.has(e.id)).map((e) => e.id);
|
|
3098
|
-
}
|
|
3099
|
-
addVisitedRoom(e) {
|
|
3100
|
-
let t = this.visitedRooms.has(e);
|
|
3101
|
-
this.visitedRooms.add(e);
|
|
3102
|
-
let n = !t && this.areaRoomIds.has(e);
|
|
3103
|
-
return n && this.markDirty(), n;
|
|
3104
|
-
}
|
|
3105
|
-
addVisitedRooms(e) {
|
|
3106
|
-
let t = 0;
|
|
3107
|
-
for (let n of e) {
|
|
3108
|
-
let e = this.visitedRooms.has(n);
|
|
3109
|
-
this.visitedRooms.add(n), !e && this.areaRoomIds.has(n) && t++;
|
|
3110
|
-
}
|
|
3111
|
-
return t > 0 && this.markDirty(), t;
|
|
3112
|
-
}
|
|
3113
|
-
}, lt = {
|
|
3131
|
+
//#region src/hit/HitTester.ts
|
|
3132
|
+
var dt = {
|
|
3114
3133
|
areaExit: 110,
|
|
3115
3134
|
room: 100,
|
|
3116
3135
|
label: 80,
|
|
3117
3136
|
specialExit: 60,
|
|
3118
3137
|
exit: 40,
|
|
3119
3138
|
stub: 20
|
|
3120
|
-
},
|
|
3139
|
+
}, ft = {
|
|
3121
3140
|
room: .3,
|
|
3122
3141
|
areaExit: 1,
|
|
3123
3142
|
label: 1,
|
|
3124
3143
|
specialExit: .5,
|
|
3125
3144
|
exit: .35,
|
|
3126
3145
|
stub: .3
|
|
3127
|
-
},
|
|
3146
|
+
}, pt = (e, t) => ({
|
|
3128
3147
|
x: e,
|
|
3129
3148
|
y: t
|
|
3130
|
-
}),
|
|
3149
|
+
}), mt = class {
|
|
3131
3150
|
constructor() {
|
|
3132
|
-
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform =
|
|
3151
|
+
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform = pt;
|
|
3133
3152
|
}
|
|
3134
3153
|
build(e, t, n) {
|
|
3135
|
-
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ??
|
|
3154
|
+
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ?? pt, this.collectHitShapes(e, 0, 0);
|
|
3136
3155
|
}
|
|
3137
3156
|
clear() {
|
|
3138
3157
|
this.entries = [], this.spatialIndex.clear();
|
|
@@ -3176,13 +3195,13 @@ var ot = class {
|
|
|
3176
3195
|
forEachCandidate(e, t, n) {
|
|
3177
3196
|
let r = Math.floor(e / this.bucketSize), i = Math.floor(t / this.bucketSize), a = /* @__PURE__ */ new Set();
|
|
3178
3197
|
for (let o = -1; o <= 1; o++) for (let s = -1; s <= 1; s++) {
|
|
3179
|
-
let c = this.spatialIndex.get(
|
|
3198
|
+
let c = this.spatialIndex.get(Ct(r + o, i + s));
|
|
3180
3199
|
if (c) for (let r of c) {
|
|
3181
3200
|
if (a.has(r)) continue;
|
|
3182
3201
|
a.add(r);
|
|
3183
3202
|
let i = r.margin * this.roomSize;
|
|
3184
3203
|
if (e < r.rMinX - i || e > r.rMaxX + i || t < r.rMinY - i || t > r.rMaxY + i) continue;
|
|
3185
|
-
let o =
|
|
3204
|
+
let o = vt(r, e, t);
|
|
3186
3205
|
o > i || n(r, o);
|
|
3187
3206
|
}
|
|
3188
3207
|
}
|
|
@@ -3201,14 +3220,14 @@ var ot = class {
|
|
|
3201
3220
|
collectHitShapes(e, t, n) {
|
|
3202
3221
|
for (let r of e) {
|
|
3203
3222
|
if (r.hit) {
|
|
3204
|
-
let e = [], i =
|
|
3205
|
-
|
|
3223
|
+
let e = [], i = ht();
|
|
3224
|
+
gt(r, t, n, this.transform, e, i), e.length > 0 && i.minX <= i.maxX && this.indexEntry(i, e, r.hit);
|
|
3206
3225
|
}
|
|
3207
3226
|
r.type === "group" && this.collectHitShapes(r.children, t + r.x, n + r.y);
|
|
3208
3227
|
}
|
|
3209
3228
|
}
|
|
3210
3229
|
indexEntry(e, t, n) {
|
|
3211
|
-
let r = n.margin ??
|
|
3230
|
+
let r = n.margin ?? ft[n.kind] ?? 1, i = n.priority ?? dt[n.kind] ?? 50, a = (e.minX + e.maxX) / 2, o = (e.minY + e.maxY) / 2, s = {
|
|
3212
3231
|
info: n,
|
|
3213
3232
|
margin: r,
|
|
3214
3233
|
priority: i,
|
|
@@ -3223,12 +3242,12 @@ var ot = class {
|
|
|
3223
3242
|
this.entries.push(s);
|
|
3224
3243
|
let c = this.bucketSize, l = Math.floor(e.minX / c), u = Math.floor(e.maxX / c), d = Math.floor(e.minY / c), f = Math.floor(e.maxY / c);
|
|
3225
3244
|
for (let e = l; e <= u; e++) for (let t = d; t <= f; t++) {
|
|
3226
|
-
let n =
|
|
3245
|
+
let n = Ct(e, t), r = this.spatialIndex.get(n);
|
|
3227
3246
|
r || (r = [], this.spatialIndex.set(n, r)), r.push(s);
|
|
3228
3247
|
}
|
|
3229
3248
|
}
|
|
3230
3249
|
};
|
|
3231
|
-
function
|
|
3250
|
+
function ht() {
|
|
3232
3251
|
return {
|
|
3233
3252
|
minX: Infinity,
|
|
3234
3253
|
minY: Infinity,
|
|
@@ -3239,14 +3258,14 @@ function pt() {
|
|
|
3239
3258
|
function U(e, t, n) {
|
|
3240
3259
|
t < e.minX && (e.minX = t), t > e.maxX && (e.maxX = t), n < e.minY && (e.minY = n), n > e.maxY && (e.maxY = n);
|
|
3241
3260
|
}
|
|
3242
|
-
function
|
|
3261
|
+
function gt(e, t, n, r, i, a) {
|
|
3243
3262
|
if (e.type === "group") {
|
|
3244
|
-
for (let o of e.children) o.hit ||
|
|
3263
|
+
for (let o of e.children) o.hit || _t(o, t + e.x, n + e.y, r, i, a);
|
|
3245
3264
|
return;
|
|
3246
3265
|
}
|
|
3247
|
-
|
|
3266
|
+
_t(e, t, n, r, i, a);
|
|
3248
3267
|
}
|
|
3249
|
-
function
|
|
3268
|
+
function _t(e, t, n, r, i, a) {
|
|
3250
3269
|
switch (e.type) {
|
|
3251
3270
|
case "rect":
|
|
3252
3271
|
case "image": {
|
|
@@ -3330,42 +3349,42 @@ function ht(e, t, n, r, i, a) {
|
|
|
3330
3349
|
return;
|
|
3331
3350
|
}
|
|
3332
3351
|
case "group":
|
|
3333
|
-
for (let o of e.children) o.hit ||
|
|
3352
|
+
for (let o of e.children) o.hit || _t(o, t + e.x, n + e.y, r, i, a);
|
|
3334
3353
|
return;
|
|
3335
3354
|
}
|
|
3336
3355
|
}
|
|
3337
|
-
function
|
|
3356
|
+
function vt(e, t, n) {
|
|
3338
3357
|
let r = Infinity;
|
|
3339
3358
|
for (let i of e.geoms) {
|
|
3340
|
-
let e =
|
|
3359
|
+
let e = yt(i, t, n);
|
|
3341
3360
|
if (e < r && (r = e), r === 0) return 0;
|
|
3342
3361
|
}
|
|
3343
3362
|
return r;
|
|
3344
3363
|
}
|
|
3345
|
-
function
|
|
3364
|
+
function yt(e, t, n) {
|
|
3346
3365
|
if (e.type === "circle") {
|
|
3347
3366
|
let r = t - e.cx, i = n - e.cy;
|
|
3348
3367
|
return Math.max(0, Math.hypot(r, i) - e.r);
|
|
3349
3368
|
}
|
|
3350
|
-
return e.closed &&
|
|
3369
|
+
return e.closed && St(e.pts, t, n) ? 0 : bt(e.pts, t, n, e.closed);
|
|
3351
3370
|
}
|
|
3352
|
-
function
|
|
3371
|
+
function bt(e, t, n, r) {
|
|
3353
3372
|
let i = e.length / 2;
|
|
3354
3373
|
if (i < 2) return i === 1 ? Math.hypot(t - e[0], n - e[1]) : Infinity;
|
|
3355
3374
|
let a = Infinity, o = r ? i : i - 1;
|
|
3356
3375
|
for (let r = 0; r < o; r++) {
|
|
3357
|
-
let o = r * 2, s = (r + 1) % i * 2, c =
|
|
3376
|
+
let o = r * 2, s = (r + 1) % i * 2, c = xt(t, n, e[o], e[o + 1], e[s], e[s + 1]);
|
|
3358
3377
|
c < a && (a = c);
|
|
3359
3378
|
}
|
|
3360
3379
|
return a;
|
|
3361
3380
|
}
|
|
3362
|
-
function
|
|
3381
|
+
function xt(e, t, n, r, i, a) {
|
|
3363
3382
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : ((e - n) * o + (t - r) * s) / c;
|
|
3364
3383
|
l < 0 ? l = 0 : l > 1 && (l = 1);
|
|
3365
3384
|
let u = n + l * o, d = r + l * s;
|
|
3366
3385
|
return Math.hypot(e - u, t - d);
|
|
3367
3386
|
}
|
|
3368
|
-
function
|
|
3387
|
+
function St(e, t, n) {
|
|
3369
3388
|
let r = !1, i = e.length / 2;
|
|
3370
3389
|
for (let a = 0, o = i - 1; a < i; o = a++) {
|
|
3371
3390
|
let i = e[a * 2], s = e[a * 2 + 1], c = e[o * 2], l = e[o * 2 + 1], u = l - s || 1e-12;
|
|
@@ -3373,13 +3392,13 @@ function bt(e, t, n) {
|
|
|
3373
3392
|
}
|
|
3374
3393
|
return r;
|
|
3375
3394
|
}
|
|
3376
|
-
function
|
|
3395
|
+
function Ct(e, t) {
|
|
3377
3396
|
return e * 1000003 + t;
|
|
3378
3397
|
}
|
|
3379
3398
|
//#endregion
|
|
3380
3399
|
//#region src/style/Style.ts
|
|
3381
3400
|
var W = { transform: (e) => e };
|
|
3382
|
-
function
|
|
3401
|
+
function wt(...e) {
|
|
3383
3402
|
return e.length === 0 ? W : e.length === 1 ? e[0] : {
|
|
3384
3403
|
transform(t, n) {
|
|
3385
3404
|
let r = [t];
|
|
@@ -3419,16 +3438,16 @@ function St(...e) {
|
|
|
3419
3438
|
function G(e, t, n) {
|
|
3420
3439
|
let r = [];
|
|
3421
3440
|
for (let i of e) {
|
|
3422
|
-
let e =
|
|
3441
|
+
let e = Tt(i, t, n);
|
|
3423
3442
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3424
3443
|
}
|
|
3425
3444
|
return r;
|
|
3426
3445
|
}
|
|
3427
|
-
function
|
|
3446
|
+
function Tt(e, t, n) {
|
|
3428
3447
|
if (e.type === "group") {
|
|
3429
3448
|
let r = [];
|
|
3430
3449
|
for (let i of e.children) {
|
|
3431
|
-
let e =
|
|
3450
|
+
let e = Tt(i, t, n);
|
|
3432
3451
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3433
3452
|
}
|
|
3434
3453
|
return t.transform({
|
|
@@ -3440,38 +3459,38 @@ function Ct(e, t, n) {
|
|
|
3440
3459
|
}
|
|
3441
3460
|
//#endregion
|
|
3442
3461
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
3443
|
-
var K = "rgb(120, 72, 0)",
|
|
3462
|
+
var K = "rgb(120, 72, 0)", Et = class {
|
|
3444
3463
|
get coordinateTransform() {
|
|
3445
3464
|
return this._coordinateTransform;
|
|
3446
3465
|
}
|
|
3447
|
-
constructor(
|
|
3448
|
-
this.gridCachedBounds = null, this.currentStyle = W, this.hitTester = new
|
|
3449
|
-
container:
|
|
3450
|
-
width:
|
|
3451
|
-
height:
|
|
3466
|
+
constructor(e, t) {
|
|
3467
|
+
this.gridCachedBounds = null, this.currentStyle = W, this.hitTester = new mt(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.currentRoomOverlay = [], this.areaExitHitZones = [], this.destroyed = !1, this._coordinateTransform = O, this.coordinateInverse = O, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = e, this.container = t, t ? (this.stage = new r.Stage({
|
|
3468
|
+
container: t,
|
|
3469
|
+
width: t.clientWidth,
|
|
3470
|
+
height: t.clientHeight,
|
|
3452
3471
|
draggable: !1
|
|
3453
|
-
}),
|
|
3472
|
+
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new D(t.clientWidth, t.clientHeight)) : (this.stage = new r.Stage({
|
|
3454
3473
|
width: 1,
|
|
3455
3474
|
height: 1
|
|
3456
|
-
}), this.camera = new
|
|
3457
|
-
let
|
|
3458
|
-
if (this.linkLayer =
|
|
3475
|
+
}), this.camera = new D(1, 1)), this.gridLayer = new r.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
3476
|
+
let n = new r.Layer({ listening: !1 });
|
|
3477
|
+
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new r.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new r.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new r.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Ge(this.positionLayer), this.overlayLayerNode = new Ge(this.overlayLayer), this.sceneNode = new We(n), this.gridLayerNode = new B(this.gridLayer), this.topLabelLayerNode = new B(this.topLabelLayer), this.sceneManager = new Be(this.camera, e.settings, e.mapReader), this.events = new S(t), this.culling = new ee(e.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), t) {
|
|
3459
3478
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
3460
|
-
let
|
|
3461
|
-
this.camera.setSize = (
|
|
3462
|
-
e
|
|
3463
|
-
}, this.interactionHandler = new
|
|
3464
|
-
clientToMapPoint: (e,
|
|
3479
|
+
let n = this.origSetSize;
|
|
3480
|
+
this.camera.setSize = (e, t) => {
|
|
3481
|
+
n(e, t), this.stage.width(e), this.stage.height(t);
|
|
3482
|
+
}, this.interactionHandler = new Ve(t, this.camera, e, {
|
|
3483
|
+
clientToMapPoint: (e, n) => this.camera.clientToMapPoint(e, n, t.getBoundingClientRect()),
|
|
3465
3484
|
pickAtPoint: (e, t) => this.hitTester.pick(e, t)
|
|
3466
3485
|
}, this.events);
|
|
3467
3486
|
}
|
|
3468
|
-
this.applyStyleTransforms(), this.subscribeToState(
|
|
3487
|
+
this.applyStyleTransforms(), this.subscribeToState(e);
|
|
3469
3488
|
}
|
|
3470
3489
|
setStyle(e) {
|
|
3471
|
-
this.currentStyle = e, this.sceneNode = new
|
|
3490
|
+
this.currentStyle = e, this.sceneNode = new We(this.linkLayer), this.gridLayerNode = new B(this.gridLayer), this.topLabelLayerNode = new B(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.areaExitHitZones = [], this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
|
|
3472
3491
|
}
|
|
3473
3492
|
applyStyleTransforms() {
|
|
3474
|
-
let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) :
|
|
3493
|
+
let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) : O, n = e.sceneToWorld ? (t, n) => e.sceneToWorld(t, n) : O, r = this.coordinateInverse;
|
|
3475
3494
|
this._coordinateTransform = t, this.coordinateInverse = n, this.culling.setCoordinateTransform(t), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, t);
|
|
3476
3495
|
let i = this.camera.getScale(), a = this.camera.width / 2, o = this.camera.height / 2, s = r((a - this.camera.position.x) / i, (o - this.camera.position.y) / i), c = t(s.x, s.y);
|
|
3477
3496
|
this.camera.position = {
|
|
@@ -3503,10 +3522,12 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3503
3522
|
destroy() {
|
|
3504
3523
|
if (!this.destroyed) {
|
|
3505
3524
|
this.destroyed = !0, this.state.events.removeAllListeners(), this.interactionHandler?.destroy();
|
|
3525
|
+
for (let e of this.liveEffects.values()) e.destroy();
|
|
3526
|
+
this.liveEffects.clear();
|
|
3506
3527
|
for (let e of this.sceneOverlays.values()) e.detach?.();
|
|
3507
3528
|
this.sceneOverlays.clear();
|
|
3508
3529
|
for (let e of this.sceneOverlayNodes.values()) for (let t of e) t.destroy();
|
|
3509
|
-
this.sceneOverlayNodes.clear(), this.
|
|
3530
|
+
this.sceneOverlayNodes.clear(), this.viewportSubscribers.clear(), this.camera.cancelAnimation(), this.origSetSize && (this.camera.setSize = this.origSetSize), this.cameraChangeHandler &&= (this.camera.off("change", this.cameraChangeHandler), void 0), this.clearOverlayShapes(), this.clearCurrentRoomOverlay(), this.positionMarker &&= (this.positionMarker.destroy(), void 0), this.stage.destroy(), this.events.removeAllListeners();
|
|
3510
3531
|
}
|
|
3511
3532
|
}
|
|
3512
3533
|
updateBackground() {
|
|
@@ -3528,6 +3549,7 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3528
3549
|
let t = this.camera.getViewportBounds();
|
|
3529
3550
|
this.refreshGrid(t), this.culling.scheduleCulling(), this.events.emit("pan", t);
|
|
3530
3551
|
for (let e of this.viewportSubscribers) e();
|
|
3552
|
+
for (let n of this.liveEffects.values()) n.updateViewport(t, e, this.coordinateTransform);
|
|
3531
3553
|
}
|
|
3532
3554
|
refresh() {
|
|
3533
3555
|
let { currentAreaInstance: e, currentZIndex: t, positionRoomId: n } = this.state;
|
|
@@ -3540,24 +3562,20 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3540
3562
|
this.updateBackground(), this.buildScene(e, r, t), this.onSceneBuilt(), this.syncHighlights(), this.syncPaths(), n !== void 0 && this.onPositionChanged(n, !1, !1);
|
|
3541
3563
|
for (let [e, t] of this.sceneOverlays) this.renderSceneOverlay(e, t);
|
|
3542
3564
|
}
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
});
|
|
3554
|
-
this.overlayLayer.add(i), this.drawOverlayShapes.set(t, i);
|
|
3555
|
-
}
|
|
3556
|
-
this.overlayLayer.batchDraw();
|
|
3565
|
+
addLiveEffect(e, t) {
|
|
3566
|
+
this.removeLiveEffect(e), t.attach(this.overlayLayer), this.liveEffects.set(e, t), t.updateViewport(this.camera.getViewportBounds(), this.camera.getScale(), this.coordinateTransform);
|
|
3567
|
+
}
|
|
3568
|
+
removeLiveEffect(e) {
|
|
3569
|
+
let t = this.liveEffects.get(e);
|
|
3570
|
+
t && (t.destroy(), this.liveEffects.delete(e));
|
|
3571
|
+
}
|
|
3572
|
+
addSceneOverlay(e, t) {
|
|
3573
|
+
let n = this.sceneOverlays.get(e);
|
|
3574
|
+
n && (n.detach?.(), this.clearSceneOverlayNodes(e)), this.sceneOverlays.set(e, t), t.attach?.(this.createOverlayContext(e, t)), this.renderSceneOverlay(e, t);
|
|
3557
3575
|
}
|
|
3558
3576
|
removeSceneOverlay(e) {
|
|
3559
3577
|
let t = this.sceneOverlays.get(e);
|
|
3560
|
-
t && (t.detach?.(), this.sceneOverlays.delete(e), this.clearSceneOverlayNodes(e), this.
|
|
3578
|
+
t && (t.detach?.(), this.sceneOverlays.delete(e), this.clearSceneOverlayNodes(e), this.overlayLayer.batchDraw());
|
|
3561
3579
|
}
|
|
3562
3580
|
getSceneOverlays() {
|
|
3563
3581
|
return this.sceneOverlays.values();
|
|
@@ -3567,43 +3585,11 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3567
3585
|
state: this.state,
|
|
3568
3586
|
onViewportChange: (e) => (this.viewportSubscribers.add(e), () => this.viewportSubscribers.delete(e)),
|
|
3569
3587
|
invalidate: () => {
|
|
3570
|
-
this.sceneOverlays.get(e) === t &&
|
|
3571
|
-
},
|
|
3572
|
-
onFrame: (t) => {
|
|
3573
|
-
let n = `${e}:${++this.frameSeq}`;
|
|
3574
|
-
return this.frameCallbacks.set(n, t), this.startFrameLoop(), () => {
|
|
3575
|
-
this.frameCallbacks.delete(n), this.frameCallbacks.size === 0 && this.stopFrameLoop();
|
|
3576
|
-
};
|
|
3588
|
+
this.sceneOverlays.get(e) === t && this.renderSceneOverlay(e, t);
|
|
3577
3589
|
}
|
|
3578
3590
|
};
|
|
3579
3591
|
}
|
|
3580
|
-
startFrameLoop() {
|
|
3581
|
-
if (this.rafHandle !== null) return;
|
|
3582
|
-
this.lastFrameTime = performance.now();
|
|
3583
|
-
let e = (t) => {
|
|
3584
|
-
if (this.destroyed) return;
|
|
3585
|
-
let n = Math.min((t - this.lastFrameTime) / 1e3, .1);
|
|
3586
|
-
this.lastFrameTime = t;
|
|
3587
|
-
for (let e of this.frameCallbacks.values()) e(n);
|
|
3588
|
-
this.overlayLayer.batchDraw(), this.rafHandle = this.frameCallbacks.size > 0 ? requestAnimationFrame(e) : null;
|
|
3589
|
-
};
|
|
3590
|
-
this.rafHandle = requestAnimationFrame(e);
|
|
3591
|
-
}
|
|
3592
|
-
stopFrameLoop() {
|
|
3593
|
-
this.rafHandle !== null && (cancelAnimationFrame(this.rafHandle), this.rafHandle = null);
|
|
3594
|
-
}
|
|
3595
|
-
getCanvasDrawState() {
|
|
3596
|
-
return {
|
|
3597
|
-
bounds: this.camera.getViewportBounds(),
|
|
3598
|
-
scale: this.camera.getScale(),
|
|
3599
|
-
coordinateTransform: this._coordinateTransform,
|
|
3600
|
-
canvasWidth: this.stage.width(),
|
|
3601
|
-
canvasHeight: this.stage.height(),
|
|
3602
|
-
canvasOffset: this.stage.position()
|
|
3603
|
-
};
|
|
3604
|
-
}
|
|
3605
3592
|
renderSceneOverlay(e, t) {
|
|
3606
|
-
if (!t.render) return;
|
|
3607
3593
|
this.clearSceneOverlayNodes(e);
|
|
3608
3594
|
let n = this.camera.getViewportBounds(), r = t.render(this.state, n);
|
|
3609
3595
|
if (r) {
|
|
@@ -3614,6 +3600,7 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3614
3600
|
}
|
|
3615
3601
|
this.sceneOverlayNodes.set(e, n);
|
|
3616
3602
|
}
|
|
3603
|
+
this.overlayLayer.batchDraw();
|
|
3617
3604
|
}
|
|
3618
3605
|
clearSceneOverlayNodes(e) {
|
|
3619
3606
|
let t = this.sceneOverlayNodes.get(e);
|
|
@@ -3639,11 +3626,13 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3639
3626
|
this.syncPaths();
|
|
3640
3627
|
}), e.events.on("clear", () => {
|
|
3641
3628
|
this.syncHighlights();
|
|
3629
|
+
}), e.events.on("lens", () => {
|
|
3630
|
+
this.refresh();
|
|
3642
3631
|
});
|
|
3643
3632
|
}
|
|
3644
3633
|
buildScene(e, t, n) {
|
|
3645
3634
|
this.positionLayer.destroyChildren(), this.positionMarker = void 0, this.clearOverlayShapes(), this.currentRoomOverlay = [], this.sceneNode.destroyChildren(), this.gridLayerNode.destroyChildren(), this.gridCachedBounds = null, this.topLabelLayerNode.destroyChildren();
|
|
3646
|
-
let r = this.sceneManager.rebuild(e, t, n);
|
|
3635
|
+
let r = this.sceneManager.rebuild(e, t, n, this.state.lens);
|
|
3647
3636
|
this.shapeToGroup = /* @__PURE__ */ new Map(), this.refreshGrid(this.camera.getViewportBounds());
|
|
3648
3637
|
for (let e of r.sceneShapes.link) {
|
|
3649
3638
|
let t = this.addStyledShape(e, this.sceneNode);
|
|
@@ -3656,7 +3645,7 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3656
3645
|
for (let e of r.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
|
|
3657
3646
|
}
|
|
3658
3647
|
shapeToRecordingNode(e) {
|
|
3659
|
-
return
|
|
3648
|
+
return Ke(e.type === "group" ? e : {
|
|
3660
3649
|
type: "group",
|
|
3661
3650
|
x: 0,
|
|
3662
3651
|
y: 0,
|
|
@@ -3681,7 +3670,7 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3681
3670
|
let n = this.coordinateInverse, r = n(e.minX, e.minY), i = n(e.maxX, e.minY), a = n(e.maxX, e.maxY), o = n(e.minX, e.maxY), s = Math.min(r.x, i.x, a.x, o.x), c = Math.max(r.x, i.x, a.x, o.x), l = Math.min(r.y, i.y, a.y, o.y), u = Math.max(r.y, i.y, a.y, o.y), d = t.gridSize * 2, f = Math.floor((s - d) / t.gridSize) * t.gridSize, p = Math.ceil((c + d) / t.gridSize) * t.gridSize, m = Math.floor((l - d) / t.gridSize) * t.gridSize, h = Math.ceil((u + d) / t.gridSize) * t.gridSize, g = this.gridCachedBounds;
|
|
3682
3671
|
if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
|
|
3683
3672
|
this.gridLayerNode.destroyChildren();
|
|
3684
|
-
let _ =
|
|
3673
|
+
let _ = Fe(e, t, { inverseTransform: this.coordinateInverse });
|
|
3685
3674
|
for (let e of _) this.addStyledShape(e, this.gridLayerNode);
|
|
3686
3675
|
this.gridCachedBounds = {
|
|
3687
3676
|
left: f,
|
|
@@ -3728,8 +3717,8 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3728
3717
|
}
|
|
3729
3718
|
applyPositionMarker(e) {
|
|
3730
3719
|
this.positionMarker && this.positionMarker.destroy();
|
|
3731
|
-
let t =
|
|
3732
|
-
this.positionMarker = this.addStyledShape(
|
|
3720
|
+
let t = ot(e, this.state.settings);
|
|
3721
|
+
this.positionMarker = this.addStyledShape(lt(t), this.positionLayerNode);
|
|
3733
3722
|
}
|
|
3734
3723
|
clearCurrentRoomOverlay() {
|
|
3735
3724
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3746,27 +3735,27 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3746
3735
|
}
|
|
3747
3736
|
let n = /* @__PURE__ */ new Map();
|
|
3748
3737
|
n.set(e.id, e);
|
|
3749
|
-
let r = [], i = this.sceneManager.exitRenderer, a = this.state.
|
|
3738
|
+
let r = [], i = this.sceneManager.exitRenderer, a = this.state.lens;
|
|
3750
3739
|
this.state.currentAreaInstance && this.state.currentZIndex !== void 0 && this.state.currentAreaInstance.getLinkExits(this.state.currentZIndex).filter((t) => t.a === e.id || t.b === e.id).forEach((e) => {
|
|
3751
3740
|
let t = i.renderDataWithColor(e, K, this.state.currentZIndex);
|
|
3752
3741
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3753
3742
|
});
|
|
3754
|
-
for (let n of
|
|
3755
|
-
for (let n of
|
|
3743
|
+
for (let n of de(e, t, K)) r.push(De(n, e.id));
|
|
3744
|
+
for (let n of le(e, t, K)) r.push(Oe(n));
|
|
3756
3745
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3757
|
-
let t = this.state.mapReader.getRoom(e)
|
|
3758
|
-
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex &&
|
|
3746
|
+
let t = this.state.mapReader.getRoom(e);
|
|
3747
|
+
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
3759
3748
|
}), r.forEach((e) => {
|
|
3760
3749
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3761
3750
|
t && this.currentRoomOverlay.push(t);
|
|
3762
3751
|
}), n.forEach((n, r) => {
|
|
3763
|
-
let i = r === e.id, a =
|
|
3752
|
+
let i = r === e.id, a = ye(n, this.state.mapReader, t, {
|
|
3764
3753
|
strokeOverride: i ? K : t.lineColor,
|
|
3765
3754
|
flatPipeline: !0
|
|
3766
3755
|
}), o = this.addStyledShape(a, this.positionLayerNode);
|
|
3767
3756
|
o && this.currentRoomOverlay.push(o);
|
|
3768
3757
|
}), n.forEach((e) => {
|
|
3769
|
-
let n =
|
|
3758
|
+
let n = we(e, this.state.mapReader, t);
|
|
3770
3759
|
for (let e of n) {
|
|
3771
3760
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3772
3761
|
t && this.currentRoomOverlay.push(t);
|
|
@@ -3778,7 +3767,7 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3778
3767
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3779
3768
|
let n = this.state.mapReader.getRoom(e);
|
|
3780
3769
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3781
|
-
let r =
|
|
3770
|
+
let r = at(n, t, this.state.settings), i = this.addStyledShape(ct(r), this.overlayLayerNode);
|
|
3782
3771
|
i && this.highlightShapes.set(e, i);
|
|
3783
3772
|
}
|
|
3784
3773
|
}
|
|
@@ -3791,7 +3780,7 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3791
3780
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3792
3781
|
let n = this.state.mapReader.getRoom(e);
|
|
3793
3782
|
if (!n) continue;
|
|
3794
|
-
let r =
|
|
3783
|
+
let r = at(n, t.color, this.state.settings), i = this.addStyledShape(ct(r), this.overlayLayerNode);
|
|
3795
3784
|
i && this.highlightShapes.set(e, i);
|
|
3796
3785
|
}
|
|
3797
3786
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3801,8 +3790,8 @@ var K = "rgb(120, 72, 0)", wt = class {
|
|
|
3801
3790
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3802
3791
|
if (!(e === void 0 || t === void 0)) {
|
|
3803
3792
|
for (let n of this.state.paths) {
|
|
3804
|
-
let r =
|
|
3805
|
-
for (let e of
|
|
3793
|
+
let r = st(this.state.mapReader, this.state.settings, n.locations, n.color, e, t);
|
|
3794
|
+
for (let e of ut(r)) {
|
|
3806
3795
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3807
3796
|
t && this.pathShapes.push(t);
|
|
3808
3797
|
}
|
|
@@ -3838,97 +3827,97 @@ function q(e) {
|
|
|
3838
3827
|
function J(e, t, n, r = 1) {
|
|
3839
3828
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3840
3829
|
}
|
|
3841
|
-
function
|
|
3830
|
+
function Dt(e) {
|
|
3842
3831
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3843
3832
|
}
|
|
3844
3833
|
//#endregion
|
|
3845
3834
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3846
|
-
var
|
|
3847
|
-
function
|
|
3835
|
+
var Ot = "#4a3728", kt = "#3b2a1a", At = 139, jt = 115, Mt = 85, Nt = 244, Pt = 228, Ft = 193;
|
|
3836
|
+
function It(e) {
|
|
3848
3837
|
let t = q(e);
|
|
3849
|
-
if (!t) return J(
|
|
3850
|
-
let n =
|
|
3851
|
-
return J(Math.round(
|
|
3838
|
+
if (!t) return J(Nt, Pt, Ft);
|
|
3839
|
+
let n = Dt(t);
|
|
3840
|
+
return J(Math.round(At + (Nt - At) * n), Math.round(jt + (Pt - jt) * n), Math.round(Mt + (Ft - Mt) * n), t.a);
|
|
3852
3841
|
}
|
|
3853
|
-
function
|
|
3842
|
+
function Lt(e) {
|
|
3854
3843
|
let t = q(e);
|
|
3855
|
-
if (!t || t.a >= 1) return
|
|
3856
|
-
let n = q(
|
|
3844
|
+
if (!t || t.a >= 1) return Ot;
|
|
3845
|
+
let n = q(Ot);
|
|
3857
3846
|
return J(n.r, n.g, n.b, t.a);
|
|
3858
3847
|
}
|
|
3859
|
-
function
|
|
3848
|
+
function Rt(e) {
|
|
3860
3849
|
return {
|
|
3861
3850
|
...e,
|
|
3862
|
-
fill: e.fill ?
|
|
3863
|
-
stroke: e.stroke ?
|
|
3851
|
+
fill: e.fill ? It(e.fill) : e.fill,
|
|
3852
|
+
stroke: e.stroke ? Lt(e.stroke) : e.stroke
|
|
3864
3853
|
};
|
|
3865
3854
|
}
|
|
3866
|
-
var
|
|
3855
|
+
var zt = { transform(e) {
|
|
3867
3856
|
switch (e.type) {
|
|
3868
3857
|
case "rect":
|
|
3869
3858
|
case "circle":
|
|
3870
3859
|
case "polygon": return {
|
|
3871
3860
|
...e,
|
|
3872
|
-
paint:
|
|
3861
|
+
paint: Rt(e.paint)
|
|
3873
3862
|
};
|
|
3874
3863
|
case "line": return {
|
|
3875
3864
|
...e,
|
|
3876
3865
|
paint: e.paint.stroke ? {
|
|
3877
3866
|
...e.paint,
|
|
3878
|
-
stroke:
|
|
3867
|
+
stroke: Lt(e.paint.stroke)
|
|
3879
3868
|
} : e.paint
|
|
3880
3869
|
};
|
|
3881
3870
|
case "text": return {
|
|
3882
3871
|
...e,
|
|
3883
|
-
fill:
|
|
3872
|
+
fill: kt
|
|
3884
3873
|
};
|
|
3885
3874
|
case "image":
|
|
3886
3875
|
case "group": return e;
|
|
3887
3876
|
}
|
|
3888
|
-
} },
|
|
3889
|
-
function
|
|
3877
|
+
} }, Bt = "#c0deff", Vt = "#e0f0ff", Ht = 20, Ut = 40, Wt = 80, Gt = 60, Kt = 100, qt = 160;
|
|
3878
|
+
function Jt(e) {
|
|
3890
3879
|
let t = q(e);
|
|
3891
|
-
if (!t) return J(
|
|
3892
|
-
let n =
|
|
3893
|
-
return J(Math.round(
|
|
3880
|
+
if (!t) return J(Gt, Kt, qt);
|
|
3881
|
+
let n = Dt(t);
|
|
3882
|
+
return J(Math.round(Ht + (Gt - Ht) * n), Math.round(Ut + (Kt - Ut) * n), Math.round(Wt + (qt - Wt) * n), t.a);
|
|
3894
3883
|
}
|
|
3895
|
-
function
|
|
3884
|
+
function Yt(e) {
|
|
3896
3885
|
let t = q(e);
|
|
3897
|
-
if (!t || t.a >= 1) return
|
|
3898
|
-
let n = q(
|
|
3886
|
+
if (!t || t.a >= 1) return Bt;
|
|
3887
|
+
let n = q(Bt);
|
|
3899
3888
|
return J(n.r, n.g, n.b, t.a);
|
|
3900
3889
|
}
|
|
3901
|
-
function
|
|
3890
|
+
function Xt(e) {
|
|
3902
3891
|
return {
|
|
3903
3892
|
...e,
|
|
3904
|
-
fill: e.fill ?
|
|
3905
|
-
stroke: e.stroke ?
|
|
3893
|
+
fill: e.fill ? Jt(e.fill) : e.fill,
|
|
3894
|
+
stroke: e.stroke ? Yt(e.stroke) : e.stroke
|
|
3906
3895
|
};
|
|
3907
3896
|
}
|
|
3908
|
-
var
|
|
3897
|
+
var Zt = { transform(e) {
|
|
3909
3898
|
switch (e.type) {
|
|
3910
3899
|
case "rect":
|
|
3911
3900
|
case "circle":
|
|
3912
3901
|
case "polygon": return {
|
|
3913
3902
|
...e,
|
|
3914
|
-
paint:
|
|
3903
|
+
paint: Xt(e.paint)
|
|
3915
3904
|
};
|
|
3916
3905
|
case "line": return {
|
|
3917
3906
|
...e,
|
|
3918
3907
|
paint: e.paint.stroke ? {
|
|
3919
3908
|
...e.paint,
|
|
3920
|
-
stroke:
|
|
3909
|
+
stroke: Yt(e.paint.stroke)
|
|
3921
3910
|
} : e.paint
|
|
3922
3911
|
};
|
|
3923
3912
|
case "text": return {
|
|
3924
3913
|
...e,
|
|
3925
|
-
fill:
|
|
3914
|
+
fill: Vt
|
|
3926
3915
|
};
|
|
3927
3916
|
case "image":
|
|
3928
3917
|
case "group": return e;
|
|
3929
3918
|
}
|
|
3930
|
-
} },
|
|
3931
|
-
function
|
|
3919
|
+
} }, Qt = "#00ffd0", $t = .3, en = 3;
|
|
3920
|
+
function tn(e, t, n) {
|
|
3932
3921
|
e /= 255, t /= 255, n /= 255;
|
|
3933
3922
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3934
3923
|
if (r === i) return [
|
|
@@ -3943,68 +3932,68 @@ function $t(e, t, n) {
|
|
|
3943
3932
|
a
|
|
3944
3933
|
];
|
|
3945
3934
|
}
|
|
3946
|
-
function
|
|
3935
|
+
function nn(e, t, n, r = 1) {
|
|
3947
3936
|
e = (e % 360 + 360) % 360;
|
|
3948
3937
|
let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
|
|
3949
3938
|
e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
|
|
3950
3939
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3951
3940
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3952
3941
|
}
|
|
3953
|
-
function
|
|
3942
|
+
function rn(e) {
|
|
3954
3943
|
let t = q(e);
|
|
3955
3944
|
if (!t) return {
|
|
3956
3945
|
h: 150,
|
|
3957
3946
|
a: 1
|
|
3958
3947
|
};
|
|
3959
|
-
let [n] =
|
|
3948
|
+
let [n] = tn(t.r, t.g, t.b);
|
|
3960
3949
|
return {
|
|
3961
3950
|
h: n,
|
|
3962
3951
|
a: t.a
|
|
3963
3952
|
};
|
|
3964
3953
|
}
|
|
3965
|
-
function
|
|
3966
|
-
let { h: t, a: n } =
|
|
3967
|
-
return
|
|
3954
|
+
function an(e) {
|
|
3955
|
+
let { h: t, a: n } = rn(e);
|
|
3956
|
+
return nn(t, .95, .65, n);
|
|
3968
3957
|
}
|
|
3969
|
-
function
|
|
3958
|
+
function on(e) {
|
|
3970
3959
|
let t = q(e);
|
|
3971
3960
|
if (!t) return "rgb(8, 12, 10)";
|
|
3972
|
-
let [n] =
|
|
3973
|
-
return
|
|
3961
|
+
let [n] = tn(t.r, t.g, t.b);
|
|
3962
|
+
return nn(n, .4, .1, t.a);
|
|
3974
3963
|
}
|
|
3975
|
-
function
|
|
3976
|
-
let { h: t, a: n } =
|
|
3977
|
-
return
|
|
3964
|
+
function sn(e) {
|
|
3965
|
+
let { h: t, a: n } = rn(e);
|
|
3966
|
+
return nn(t, .95, .65, Math.min(n, $t));
|
|
3978
3967
|
}
|
|
3979
|
-
function
|
|
3968
|
+
function cn(e) {
|
|
3980
3969
|
return {
|
|
3981
3970
|
...e,
|
|
3982
|
-
fill: e.fill ?
|
|
3983
|
-
stroke: e.stroke ?
|
|
3971
|
+
fill: e.fill ? on(e.fill) : e.fill,
|
|
3972
|
+
stroke: e.stroke ? an(e.stroke) : e.stroke
|
|
3984
3973
|
};
|
|
3985
3974
|
}
|
|
3986
|
-
function
|
|
3975
|
+
function ln(e, t = !1) {
|
|
3987
3976
|
if (!e.stroke) return e;
|
|
3988
|
-
let n = (e.strokeWidth ?? 1) *
|
|
3977
|
+
let n = (e.strokeWidth ?? 1) * en;
|
|
3989
3978
|
return {
|
|
3990
|
-
stroke:
|
|
3979
|
+
stroke: sn(e.stroke),
|
|
3991
3980
|
strokeWidth: n,
|
|
3992
3981
|
dash: e.dash,
|
|
3993
3982
|
dashEnabled: e.dashEnabled,
|
|
3994
|
-
alpha: t ?
|
|
3983
|
+
alpha: t ? $t : e.alpha
|
|
3995
3984
|
};
|
|
3996
3985
|
}
|
|
3997
|
-
var
|
|
3986
|
+
var un = { transform(e) {
|
|
3998
3987
|
switch (e.type) {
|
|
3999
3988
|
case "rect": {
|
|
4000
3989
|
let t = {
|
|
4001
3990
|
...e,
|
|
4002
|
-
paint:
|
|
3991
|
+
paint: cn(e.paint)
|
|
4003
3992
|
};
|
|
4004
3993
|
return e.paint.stroke ? [{
|
|
4005
3994
|
...e,
|
|
4006
3995
|
paint: {
|
|
4007
|
-
...
|
|
3996
|
+
...ln(e.paint),
|
|
4008
3997
|
fill: void 0
|
|
4009
3998
|
}
|
|
4010
3999
|
}, t] : t;
|
|
@@ -4012,12 +4001,12 @@ var cn = { transform(e) {
|
|
|
4012
4001
|
case "circle": {
|
|
4013
4002
|
let t = {
|
|
4014
4003
|
...e,
|
|
4015
|
-
paint:
|
|
4004
|
+
paint: cn(e.paint)
|
|
4016
4005
|
};
|
|
4017
4006
|
return e.paint.stroke ? [{
|
|
4018
4007
|
...e,
|
|
4019
4008
|
paint: {
|
|
4020
|
-
...
|
|
4009
|
+
...ln(e.paint),
|
|
4021
4010
|
fill: void 0
|
|
4022
4011
|
}
|
|
4023
4012
|
}, t] : t;
|
|
@@ -4027,21 +4016,21 @@ var cn = { transform(e) {
|
|
|
4027
4016
|
...e,
|
|
4028
4017
|
paint: e.paint.stroke ? {
|
|
4029
4018
|
...e.paint,
|
|
4030
|
-
stroke:
|
|
4019
|
+
stroke: an(e.paint.stroke)
|
|
4031
4020
|
} : e.paint
|
|
4032
4021
|
};
|
|
4033
4022
|
return e.paint.stroke ? [{
|
|
4034
4023
|
...e,
|
|
4035
|
-
paint:
|
|
4024
|
+
paint: ln(e.paint, !0)
|
|
4036
4025
|
}, t] : t;
|
|
4037
4026
|
}
|
|
4038
4027
|
case "polygon": return {
|
|
4039
4028
|
...e,
|
|
4040
|
-
paint:
|
|
4029
|
+
paint: cn(e.paint)
|
|
4041
4030
|
};
|
|
4042
4031
|
case "text": return {
|
|
4043
4032
|
...e,
|
|
4044
|
-
fill:
|
|
4033
|
+
fill: Qt
|
|
4045
4034
|
};
|
|
4046
4035
|
case "image":
|
|
4047
4036
|
case "group": return e;
|
|
@@ -4053,12 +4042,12 @@ function Y(e) {
|
|
|
4053
4042
|
let t = e | 0 || 1;
|
|
4054
4043
|
return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
|
|
4055
4044
|
}
|
|
4056
|
-
function
|
|
4045
|
+
function X(...e) {
|
|
4057
4046
|
let t = 2654435769;
|
|
4058
4047
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4059
4048
|
return t;
|
|
4060
4049
|
}
|
|
4061
|
-
function
|
|
4050
|
+
function dn(e, t, n, r, i, a) {
|
|
4062
4051
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4063
4052
|
if (c < .001) return [
|
|
4064
4053
|
e,
|
|
@@ -4073,17 +4062,17 @@ function un(e, t, n, r, i, a) {
|
|
|
4073
4062
|
}
|
|
4074
4063
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4075
4064
|
}
|
|
4076
|
-
function
|
|
4065
|
+
function fn(e, t, n) {
|
|
4077
4066
|
if (e.length < 4) return e;
|
|
4078
4067
|
let r = [];
|
|
4079
4068
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4080
|
-
let a =
|
|
4069
|
+
let a = dn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4081
4070
|
if (i === 0) r.push(...a);
|
|
4082
4071
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4083
4072
|
}
|
|
4084
4073
|
return r;
|
|
4085
4074
|
}
|
|
4086
|
-
function
|
|
4075
|
+
function pn(e, t, n, r, i, a) {
|
|
4087
4076
|
let o = [
|
|
4088
4077
|
e,
|
|
4089
4078
|
t,
|
|
@@ -4095,12 +4084,12 @@ function fn(e, t, n, r, i, a) {
|
|
|
4095
4084
|
t + r
|
|
4096
4085
|
], s = [];
|
|
4097
4086
|
for (let e = 0; e < 4; e++) {
|
|
4098
|
-
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u =
|
|
4087
|
+
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = dn(t, n, c, l, i, a);
|
|
4099
4088
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4100
4089
|
}
|
|
4101
4090
|
return s;
|
|
4102
4091
|
}
|
|
4103
|
-
function
|
|
4092
|
+
function mn(e, t, n, r, i) {
|
|
4104
4093
|
let a = [];
|
|
4105
4094
|
for (let o = 0; o < 24; o++) {
|
|
4106
4095
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4108,31 +4097,31 @@ function pn(e, t, n, r, i) {
|
|
|
4108
4097
|
}
|
|
4109
4098
|
return a;
|
|
4110
4099
|
}
|
|
4111
|
-
function
|
|
4100
|
+
function hn(e, t, n) {
|
|
4112
4101
|
let r = e.length / 2;
|
|
4113
4102
|
if (r < 2) return e;
|
|
4114
4103
|
let i = [];
|
|
4115
4104
|
for (let a = 0; a < r; a++) {
|
|
4116
|
-
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d =
|
|
4105
|
+
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = dn(o, s, l, u, t, n);
|
|
4117
4106
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4118
4107
|
}
|
|
4119
4108
|
return i;
|
|
4120
4109
|
}
|
|
4121
4110
|
//#endregion
|
|
4122
4111
|
//#region src/style/shape/SketchyStyle.ts
|
|
4123
|
-
function
|
|
4112
|
+
function gn(e, t) {
|
|
4124
4113
|
if (!t) return e;
|
|
4125
4114
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4126
4115
|
if (!n) return e;
|
|
4127
4116
|
let r = parseFloat(n[1]);
|
|
4128
4117
|
return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
|
|
4129
4118
|
}
|
|
4130
|
-
function
|
|
4119
|
+
function _n(e) {
|
|
4131
4120
|
let { jitter: t, color: n } = e;
|
|
4132
4121
|
return { transform(e) {
|
|
4133
4122
|
switch (e.type) {
|
|
4134
4123
|
case "rect": {
|
|
4135
|
-
let r = Y(
|
|
4124
|
+
let r = Y(X(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
|
|
4136
4125
|
if (e.cornerRadius && e.cornerRadius > 0) {
|
|
4137
4126
|
let n = [];
|
|
4138
4127
|
if (i && n.push({
|
|
@@ -4145,7 +4134,7 @@ function gn(e) {
|
|
|
4145
4134
|
}), a && e.paint.strokeWidth) {
|
|
4146
4135
|
let i = {
|
|
4147
4136
|
type: "polygon",
|
|
4148
|
-
vertices:
|
|
4137
|
+
vertices: pn(e.x, e.y, e.width, e.height, t, r),
|
|
4149
4138
|
paint: {
|
|
4150
4139
|
stroke: a,
|
|
4151
4140
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4160,7 +4149,7 @@ function gn(e) {
|
|
|
4160
4149
|
}
|
|
4161
4150
|
return {
|
|
4162
4151
|
type: "polygon",
|
|
4163
|
-
vertices:
|
|
4152
|
+
vertices: pn(e.x, e.y, e.width, e.height, t, r),
|
|
4164
4153
|
paint: {
|
|
4165
4154
|
fill: i,
|
|
4166
4155
|
stroke: a,
|
|
@@ -4172,10 +4161,10 @@ function gn(e) {
|
|
|
4172
4161
|
};
|
|
4173
4162
|
}
|
|
4174
4163
|
case "circle": {
|
|
4175
|
-
let r = Y(
|
|
4164
|
+
let r = Y(X(e.cx, e.cy, e.radius));
|
|
4176
4165
|
return {
|
|
4177
4166
|
type: "polygon",
|
|
4178
|
-
vertices:
|
|
4167
|
+
vertices: mn(e.cx, e.cy, e.radius, t, r),
|
|
4179
4168
|
paint: {
|
|
4180
4169
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4181
4170
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4187,7 +4176,7 @@ function gn(e) {
|
|
|
4187
4176
|
};
|
|
4188
4177
|
}
|
|
4189
4178
|
case "line": {
|
|
4190
|
-
let r = Y(
|
|
4179
|
+
let r = Y(X(...e.points.slice(0, 4))), i = fn(e.points, t, r), a = gn(n, e.paint.stroke), o = {
|
|
4191
4180
|
...e.paint,
|
|
4192
4181
|
stroke: a
|
|
4193
4182
|
};
|
|
@@ -4198,7 +4187,7 @@ function gn(e) {
|
|
|
4198
4187
|
};
|
|
4199
4188
|
}
|
|
4200
4189
|
case "polygon": {
|
|
4201
|
-
let r = Y(
|
|
4190
|
+
let r = Y(X(...e.vertices.slice(0, 4))), i = hn(e.vertices, t, r);
|
|
4202
4191
|
return {
|
|
4203
4192
|
...e,
|
|
4204
4193
|
vertices: i,
|
|
@@ -4220,16 +4209,16 @@ function gn(e) {
|
|
|
4220
4209
|
}
|
|
4221
4210
|
//#endregion
|
|
4222
4211
|
//#region src/style/shape/IsometricStyle.ts
|
|
4223
|
-
function
|
|
4212
|
+
function vn(e) {
|
|
4224
4213
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4225
4214
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4226
4215
|
}
|
|
4227
|
-
function
|
|
4216
|
+
function yn(e) {
|
|
4228
4217
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4229
4218
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4230
4219
|
}
|
|
4231
|
-
var
|
|
4232
|
-
function
|
|
4220
|
+
var Z = 32;
|
|
4221
|
+
function bn(e, t) {
|
|
4233
4222
|
let n = Array(t.length);
|
|
4234
4223
|
for (let r = 0; r < t.length; r += 2) {
|
|
4235
4224
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4237,7 +4226,7 @@ function yn(e, t) {
|
|
|
4237
4226
|
}
|
|
4238
4227
|
return n;
|
|
4239
4228
|
}
|
|
4240
|
-
function
|
|
4229
|
+
function xn(e, t, n, r, i) {
|
|
4241
4230
|
let [a, o] = e(t, n), [s, c] = e(t + r, n), [l, u] = e(t + r, n + i), [d, f] = e(t, n + i);
|
|
4242
4231
|
return [
|
|
4243
4232
|
a,
|
|
@@ -4250,8 +4239,8 @@ function bn(e, t, n, r, i) {
|
|
|
4250
4239
|
f
|
|
4251
4240
|
];
|
|
4252
4241
|
}
|
|
4253
|
-
function
|
|
4254
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
4242
|
+
function Sn(e = {}) {
|
|
4243
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = vn(t), i = yn(t);
|
|
4255
4244
|
function a(e, t, n, i) {
|
|
4256
4245
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4257
4246
|
return [
|
|
@@ -4264,7 +4253,7 @@ function xn(e = {}) {
|
|
|
4264
4253
|
];
|
|
4265
4254
|
}
|
|
4266
4255
|
function o(e) {
|
|
4267
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
4256
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = xn(r, t, i, a, o);
|
|
4268
4257
|
if (s.dash || s.dashEnabled) {
|
|
4269
4258
|
let t = [];
|
|
4270
4259
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4290,7 +4279,7 @@ function xn(e = {}) {
|
|
|
4290
4279
|
if (n > 0 && s.fill) {
|
|
4291
4280
|
let t = [], r = 0;
|
|
4292
4281
|
for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[r * 2 + 1] && (r = e);
|
|
4293
|
-
let i = c[r * 2], a = c[r * 2 + 1], o = (r + 3) % 4, l = c[o * 2], u = c[o * 2 + 1], d = (r + 1) % 4, f = c[d * 2], p = c[d * 2 + 1], m = (r + 2) % 4,
|
|
4282
|
+
let i = c[r * 2], a = c[r * 2 + 1], o = (r + 3) % 4, l = c[o * 2], u = c[o * 2 + 1], d = (r + 1) % 4, f = c[d * 2], p = c[d * 2 + 1], m = (r + 2) % 4, h = c[m * 2], g = c[m * 2 + 1];
|
|
4294
4283
|
if (t.push({
|
|
4295
4284
|
type: "polygon",
|
|
4296
4285
|
vertices: [
|
|
@@ -4303,7 +4292,7 @@ function xn(e = {}) {
|
|
|
4303
4292
|
l,
|
|
4304
4293
|
u + n
|
|
4305
4294
|
],
|
|
4306
|
-
paint: { fill:
|
|
4295
|
+
paint: { fill: v(s.fill, .2) },
|
|
4307
4296
|
layer: e.layer
|
|
4308
4297
|
}), t.push({
|
|
4309
4298
|
type: "polygon",
|
|
@@ -4317,7 +4306,7 @@ function xn(e = {}) {
|
|
|
4317
4306
|
i,
|
|
4318
4307
|
a + n
|
|
4319
4308
|
],
|
|
4320
|
-
paint: { fill:
|
|
4309
|
+
paint: { fill: v(s.fill, .4) },
|
|
4321
4310
|
layer: e.layer
|
|
4322
4311
|
}), t.push({
|
|
4323
4312
|
type: "polygon",
|
|
@@ -4336,15 +4325,15 @@ function xn(e = {}) {
|
|
|
4336
4325
|
layer: c
|
|
4337
4326
|
});
|
|
4338
4327
|
d([
|
|
4328
|
+
h,
|
|
4339
4329
|
g,
|
|
4340
|
-
_,
|
|
4341
4330
|
l,
|
|
4342
4331
|
u
|
|
4343
4332
|
]), d([
|
|
4344
4333
|
f,
|
|
4345
4334
|
p,
|
|
4346
|
-
|
|
4347
|
-
|
|
4335
|
+
h,
|
|
4336
|
+
g
|
|
4348
4337
|
]), d([
|
|
4349
4338
|
l,
|
|
4350
4339
|
u,
|
|
@@ -4383,15 +4372,15 @@ function xn(e = {}) {
|
|
|
4383
4372
|
};
|
|
4384
4373
|
}
|
|
4385
4374
|
function s(e) {
|
|
4386
|
-
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(
|
|
4387
|
-
for (let e = 0; e <
|
|
4388
|
-
let n = e /
|
|
4375
|
+
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(Z * 2);
|
|
4376
|
+
for (let e = 0; e < Z; e++) {
|
|
4377
|
+
let n = e / Z * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
|
|
4389
4378
|
s[e * 2] = o, s[e * 2 + 1] = c;
|
|
4390
4379
|
}
|
|
4391
4380
|
if (o.dash || o.dashEnabled) {
|
|
4392
4381
|
let t = [];
|
|
4393
|
-
for (let n = 0; n <
|
|
4394
|
-
let r = (n + 1) %
|
|
4382
|
+
for (let n = 0; n < Z; n++) {
|
|
4383
|
+
let r = (n + 1) % Z;
|
|
4395
4384
|
t.push({
|
|
4396
4385
|
type: "line",
|
|
4397
4386
|
points: [
|
|
@@ -4413,15 +4402,15 @@ function xn(e = {}) {
|
|
|
4413
4402
|
let c = [];
|
|
4414
4403
|
if (n > 0 && o.fill) {
|
|
4415
4404
|
let t = 0, r = 0, i = 0, a = -Infinity, l = Infinity, u = -Infinity;
|
|
4416
|
-
for (let e = 0; e <
|
|
4405
|
+
for (let e = 0; e < Z; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < l && (l = s[e * 2], r = e), s[e * 2 + 1] > u && (u = s[e * 2 + 1], i = e);
|
|
4417
4406
|
let d = [], f = t;
|
|
4418
|
-
for (let e = 0; e <=
|
|
4407
|
+
for (let e = 0; e <= Z && (d.push(s[f * 2], s[f * 2 + 1]), f !== i); e++) f = (f + 1) % Z;
|
|
4419
4408
|
for (let e = d.length - 2; e >= 0; e -= 2) d.push(d[e], d[e + 1] + n);
|
|
4420
4409
|
c.push({
|
|
4421
4410
|
type: "polygon",
|
|
4422
4411
|
vertices: d,
|
|
4423
4412
|
paint: {
|
|
4424
|
-
fill:
|
|
4413
|
+
fill: v(o.fill, .2),
|
|
4425
4414
|
stroke: o.stroke,
|
|
4426
4415
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4427
4416
|
},
|
|
@@ -4429,13 +4418,13 @@ function xn(e = {}) {
|
|
|
4429
4418
|
});
|
|
4430
4419
|
let p = [];
|
|
4431
4420
|
f = i;
|
|
4432
|
-
for (let e = 0; e <=
|
|
4421
|
+
for (let e = 0; e <= Z && (p.push(s[f * 2], s[f * 2 + 1]), f !== r); e++) f = (f + 1) % Z;
|
|
4433
4422
|
for (let e = p.length - 2; e >= 0; e -= 2) p.push(p[e], p[e + 1] + n);
|
|
4434
4423
|
c.push({
|
|
4435
4424
|
type: "polygon",
|
|
4436
4425
|
vertices: p,
|
|
4437
4426
|
paint: {
|
|
4438
|
-
fill:
|
|
4427
|
+
fill: v(o.fill, .4),
|
|
4439
4428
|
stroke: o.stroke,
|
|
4440
4429
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4441
4430
|
},
|
|
@@ -4463,11 +4452,11 @@ function xn(e = {}) {
|
|
|
4463
4452
|
case "circle": return s(e);
|
|
4464
4453
|
case "line": return {
|
|
4465
4454
|
...e,
|
|
4466
|
-
points:
|
|
4455
|
+
points: bn(r, e.points)
|
|
4467
4456
|
};
|
|
4468
4457
|
case "polygon": return {
|
|
4469
4458
|
...e,
|
|
4470
|
-
vertices:
|
|
4459
|
+
vertices: bn(r, e.vertices)
|
|
4471
4460
|
};
|
|
4472
4461
|
case "text": {
|
|
4473
4462
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
@@ -4522,21 +4511,21 @@ function xn(e = {}) {
|
|
|
4522
4511
|
}
|
|
4523
4512
|
//#endregion
|
|
4524
4513
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4525
|
-
var
|
|
4526
|
-
function
|
|
4514
|
+
var Q = "#1a1a1a", Cn = "#ffc200", wn = "#ff6600", Tn = 26, En = 26, Dn = 26, On = 255, kn = 194, An = 0;
|
|
4515
|
+
function jn(e) {
|
|
4527
4516
|
let t = q(e);
|
|
4528
|
-
if (!t) return J(
|
|
4529
|
-
let n =
|
|
4530
|
-
return J(Math.round(
|
|
4517
|
+
if (!t) return J(On, kn, An);
|
|
4518
|
+
let n = Dt(t);
|
|
4519
|
+
return J(Math.round(Tn + (On - Tn) * n), Math.round(En + (kn - En) * n), Math.round(Dn + (An - Dn) * n), t.a);
|
|
4531
4520
|
}
|
|
4532
|
-
function
|
|
4521
|
+
function Mn(e) {
|
|
4533
4522
|
return {
|
|
4534
4523
|
...e,
|
|
4535
|
-
fill: e.fill ?
|
|
4536
|
-
stroke: e.stroke ?
|
|
4524
|
+
fill: e.fill ? jn(e.fill) : e.fill,
|
|
4525
|
+
stroke: e.stroke ? Q : e.stroke
|
|
4537
4526
|
};
|
|
4538
4527
|
}
|
|
4539
|
-
function
|
|
4528
|
+
function Nn(e, t, n, r) {
|
|
4540
4529
|
let i = [], a = e.length;
|
|
4541
4530
|
for (let o = 0; o < a; o++) {
|
|
4542
4531
|
let s = e[o], c = e[(o + 1) % a], l = t * s[0] + n * s[1] - r, u = t * c[0] + n * c[1] - r;
|
|
@@ -4547,7 +4536,7 @@ function Mn(e, t, n, r) {
|
|
|
4547
4536
|
}
|
|
4548
4537
|
return i;
|
|
4549
4538
|
}
|
|
4550
|
-
function
|
|
4539
|
+
function Pn(e, t, n, r, i) {
|
|
4551
4540
|
let a = [
|
|
4552
4541
|
[e, t],
|
|
4553
4542
|
[e + n, t],
|
|
@@ -4555,37 +4544,37 @@ function Nn(e, t, n, r, i) {
|
|
|
4555
4544
|
[e, t + r]
|
|
4556
4545
|
], o = i * .4, s = o * .35, c = e + t, l = e + n + t + r, u = Math.floor(c / o) - 1, d = Math.ceil(l / o) + 1, f = [];
|
|
4557
4546
|
for (let e = u; e <= d; e++) {
|
|
4558
|
-
let t = e * o, n = t + s, r =
|
|
4559
|
-
r =
|
|
4547
|
+
let t = e * o, n = t + s, r = Nn(a, 1, 1, t);
|
|
4548
|
+
r = Nn(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
4560
4549
|
}
|
|
4561
4550
|
return f;
|
|
4562
4551
|
}
|
|
4563
|
-
var
|
|
4552
|
+
var Fn = { transform(e, t) {
|
|
4564
4553
|
switch (e.type) {
|
|
4565
4554
|
case "rect": {
|
|
4566
4555
|
if (!e.paint.fill) return {
|
|
4567
4556
|
...e,
|
|
4568
|
-
paint:
|
|
4557
|
+
paint: Mn(e.paint)
|
|
4569
4558
|
};
|
|
4570
4559
|
let n = {
|
|
4571
4560
|
...e,
|
|
4572
4561
|
paint: {
|
|
4573
|
-
fill:
|
|
4562
|
+
fill: Q,
|
|
4574
4563
|
strokeWidth: e.paint.strokeWidth
|
|
4575
4564
|
}
|
|
4576
|
-
}, r =
|
|
4565
|
+
}, r = Pn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4577
4566
|
type: "polygon",
|
|
4578
4567
|
vertices: t,
|
|
4579
4568
|
layer: e.layer,
|
|
4580
4569
|
paint: {
|
|
4581
|
-
fill:
|
|
4570
|
+
fill: Cn,
|
|
4582
4571
|
alpha: .65
|
|
4583
4572
|
}
|
|
4584
4573
|
})), i = {
|
|
4585
4574
|
...e,
|
|
4586
4575
|
hit: void 0,
|
|
4587
4576
|
paint: {
|
|
4588
|
-
stroke:
|
|
4577
|
+
stroke: Q,
|
|
4589
4578
|
strokeWidth: e.paint.strokeWidth
|
|
4590
4579
|
}
|
|
4591
4580
|
};
|
|
@@ -4597,38 +4586,38 @@ var Pn = { transform(e, t) {
|
|
|
4597
4586
|
}
|
|
4598
4587
|
case "circle": return {
|
|
4599
4588
|
...e,
|
|
4600
|
-
paint:
|
|
4589
|
+
paint: Mn(e.paint)
|
|
4601
4590
|
};
|
|
4602
4591
|
case "polygon": return {
|
|
4603
4592
|
...e,
|
|
4604
4593
|
paint: {
|
|
4605
4594
|
...e.paint,
|
|
4606
|
-
fill: e.paint.fill ?
|
|
4607
|
-
stroke: e.paint.stroke ?
|
|
4595
|
+
fill: e.paint.fill ? wn : e.paint.fill,
|
|
4596
|
+
stroke: e.paint.stroke ? Q : e.paint.stroke
|
|
4608
4597
|
}
|
|
4609
4598
|
};
|
|
4610
4599
|
case "line": return {
|
|
4611
4600
|
...e,
|
|
4612
4601
|
paint: e.paint.stroke ? {
|
|
4613
4602
|
...e.paint,
|
|
4614
|
-
stroke:
|
|
4603
|
+
stroke: wn
|
|
4615
4604
|
} : e.paint
|
|
4616
4605
|
};
|
|
4617
4606
|
case "text": return {
|
|
4618
4607
|
...e,
|
|
4619
|
-
fill:
|
|
4620
|
-
stroke:
|
|
4608
|
+
fill: wn,
|
|
4609
|
+
stroke: Q,
|
|
4621
4610
|
strokeWidth: t.roomSize * .25
|
|
4622
4611
|
};
|
|
4623
4612
|
case "image":
|
|
4624
4613
|
case "group": return e;
|
|
4625
4614
|
}
|
|
4626
|
-
} },
|
|
4627
|
-
function
|
|
4615
|
+
} }, In = "#c8eeff", Ln = "#00c8ff", Rn = "#00ffaa", zn = .2, Bn = 5, Vn = 190;
|
|
4616
|
+
function Hn(e, t, n) {
|
|
4628
4617
|
e /= 255, t /= 255, n /= 255;
|
|
4629
4618
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4630
4619
|
if (r === i) return [
|
|
4631
|
-
|
|
4620
|
+
Vn,
|
|
4632
4621
|
0,
|
|
4633
4622
|
a
|
|
4634
4623
|
];
|
|
@@ -4639,54 +4628,54 @@ function Vn(e, t, n) {
|
|
|
4639
4628
|
a
|
|
4640
4629
|
];
|
|
4641
4630
|
}
|
|
4642
|
-
function
|
|
4631
|
+
function Un(e, t, n, r = 1) {
|
|
4643
4632
|
e = (e % 360 + 360) % 360;
|
|
4644
4633
|
let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
|
|
4645
4634
|
e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
|
|
4646
4635
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4647
4636
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4648
4637
|
}
|
|
4649
|
-
function
|
|
4638
|
+
function Wn(e) {
|
|
4650
4639
|
let t = q(e);
|
|
4651
|
-
if (!t) return
|
|
4652
|
-
let [n, r] =
|
|
4653
|
-
return
|
|
4640
|
+
if (!t) return Un(Vn, .55, .18);
|
|
4641
|
+
let [n, r] = Hn(t.r, t.g, t.b);
|
|
4642
|
+
return Un(r < .08 ? Vn : n, .55, .18, t.a);
|
|
4654
4643
|
}
|
|
4655
|
-
function
|
|
4644
|
+
function Gn(e) {
|
|
4656
4645
|
return {
|
|
4657
4646
|
...e,
|
|
4658
|
-
fill: e.fill ?
|
|
4659
|
-
stroke: e.stroke ?
|
|
4647
|
+
fill: e.fill ? Wn(e.fill) : e.fill,
|
|
4648
|
+
stroke: e.stroke ? Ln : e.stroke
|
|
4660
4649
|
};
|
|
4661
4650
|
}
|
|
4662
|
-
function
|
|
4651
|
+
function Kn(e) {
|
|
4663
4652
|
return {
|
|
4664
|
-
stroke:
|
|
4665
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4666
|
-
alpha:
|
|
4653
|
+
stroke: Ln,
|
|
4654
|
+
strokeWidth: (e.strokeWidth ?? 1) * Bn,
|
|
4655
|
+
alpha: zn
|
|
4667
4656
|
};
|
|
4668
4657
|
}
|
|
4669
|
-
function
|
|
4658
|
+
function qn(e) {
|
|
4670
4659
|
return {
|
|
4671
|
-
stroke:
|
|
4672
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4673
|
-
alpha:
|
|
4660
|
+
stroke: Rn,
|
|
4661
|
+
strokeWidth: (e.strokeWidth ?? 1) * Bn,
|
|
4662
|
+
alpha: zn,
|
|
4674
4663
|
dash: e.dash,
|
|
4675
4664
|
dashEnabled: e.dashEnabled
|
|
4676
4665
|
};
|
|
4677
4666
|
}
|
|
4678
|
-
var
|
|
4667
|
+
var Jn = { transform(e) {
|
|
4679
4668
|
switch (e.type) {
|
|
4680
4669
|
case "rect": {
|
|
4681
4670
|
let t = {
|
|
4682
4671
|
...e,
|
|
4683
|
-
paint:
|
|
4672
|
+
paint: Gn(e.paint)
|
|
4684
4673
|
};
|
|
4685
4674
|
return e.paint.stroke ? [{
|
|
4686
4675
|
...e,
|
|
4687
4676
|
hit: void 0,
|
|
4688
4677
|
paint: {
|
|
4689
|
-
...
|
|
4678
|
+
...Kn(e.paint),
|
|
4690
4679
|
fill: void 0
|
|
4691
4680
|
}
|
|
4692
4681
|
}, t] : t;
|
|
@@ -4694,13 +4683,13 @@ var qn = { transform(e) {
|
|
|
4694
4683
|
case "circle": {
|
|
4695
4684
|
let t = {
|
|
4696
4685
|
...e,
|
|
4697
|
-
paint:
|
|
4686
|
+
paint: Gn(e.paint)
|
|
4698
4687
|
};
|
|
4699
4688
|
return e.paint.stroke ? [{
|
|
4700
4689
|
...e,
|
|
4701
4690
|
hit: void 0,
|
|
4702
4691
|
paint: {
|
|
4703
|
-
...
|
|
4692
|
+
...Kn(e.paint),
|
|
4704
4693
|
fill: void 0
|
|
4705
4694
|
}
|
|
4706
4695
|
}, t] : t;
|
|
@@ -4717,38 +4706,38 @@ var qn = { transform(e) {
|
|
|
4717
4706
|
...e,
|
|
4718
4707
|
paint: e.paint.stroke ? {
|
|
4719
4708
|
...e.paint,
|
|
4720
|
-
stroke:
|
|
4709
|
+
stroke: Rn
|
|
4721
4710
|
} : e.paint
|
|
4722
4711
|
};
|
|
4723
4712
|
return e.paint.stroke ? [{
|
|
4724
4713
|
...e,
|
|
4725
4714
|
hit: void 0,
|
|
4726
|
-
paint:
|
|
4715
|
+
paint: qn(e.paint)
|
|
4727
4716
|
}, t] : t;
|
|
4728
4717
|
}
|
|
4729
4718
|
case "polygon": return {
|
|
4730
4719
|
...e,
|
|
4731
4720
|
paint: {
|
|
4732
4721
|
...e.paint,
|
|
4733
|
-
fill: e.paint.fill ?
|
|
4722
|
+
fill: e.paint.fill ? Rn : e.paint.fill,
|
|
4734
4723
|
stroke: void 0
|
|
4735
4724
|
}
|
|
4736
4725
|
};
|
|
4737
4726
|
case "text": return {
|
|
4738
4727
|
...e,
|
|
4739
|
-
fill:
|
|
4728
|
+
fill: In
|
|
4740
4729
|
};
|
|
4741
4730
|
case "image":
|
|
4742
4731
|
case "group": return e;
|
|
4743
4732
|
}
|
|
4744
|
-
} },
|
|
4745
|
-
function
|
|
4746
|
-
return
|
|
4733
|
+
} }, Yn = zt, Xn = Zt, Zn = un;
|
|
4734
|
+
function Qn(e) {
|
|
4735
|
+
return _n(e);
|
|
4747
4736
|
}
|
|
4748
|
-
function
|
|
4749
|
-
return
|
|
4737
|
+
function $n(e = {}) {
|
|
4738
|
+
return Sn(e);
|
|
4750
4739
|
}
|
|
4751
|
-
var
|
|
4740
|
+
var er = Fn, tr = Jn, nr = class {
|
|
4752
4741
|
get settings() {
|
|
4753
4742
|
return this.state.settings;
|
|
4754
4743
|
}
|
|
@@ -4765,7 +4754,7 @@ var $n = Pn, er = qn, tr = class {
|
|
|
4765
4754
|
return this.backend.events;
|
|
4766
4755
|
}
|
|
4767
4756
|
constructor(e, t, n, r) {
|
|
4768
|
-
this.currentStyle = W, this.state = new
|
|
4757
|
+
this.currentStyle = W, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new Et(this.state, n);
|
|
4769
4758
|
}
|
|
4770
4759
|
destroy() {
|
|
4771
4760
|
this.backend.destroy();
|
|
@@ -4809,6 +4798,12 @@ var $n = Pn, er = qn, tr = class {
|
|
|
4809
4798
|
refreshCurrentRoomOverlay() {
|
|
4810
4799
|
this.state.refreshPosition();
|
|
4811
4800
|
}
|
|
4801
|
+
setLens(e) {
|
|
4802
|
+
this.state.setLens(e);
|
|
4803
|
+
}
|
|
4804
|
+
getLens() {
|
|
4805
|
+
return this.state.lens;
|
|
4806
|
+
}
|
|
4812
4807
|
setStyle(e) {
|
|
4813
4808
|
this.currentStyle = e, this.backend.setStyle(e);
|
|
4814
4809
|
}
|
|
@@ -4830,6 +4825,12 @@ var $n = Pn, er = qn, tr = class {
|
|
|
4830
4825
|
removeSceneOverlay(e) {
|
|
4831
4826
|
this.backend.removeSceneOverlay(e);
|
|
4832
4827
|
}
|
|
4828
|
+
addLiveEffect(e, t) {
|
|
4829
|
+
this.backend instanceof Et && this.backend.addLiveEffect(e, t);
|
|
4830
|
+
}
|
|
4831
|
+
removeLiveEffect(e) {
|
|
4832
|
+
this.backend instanceof Et && this.backend.removeLiveEffect(e);
|
|
4833
|
+
}
|
|
4833
4834
|
hitTest(e, t) {
|
|
4834
4835
|
let n = this.backend.coordinateTransform(e, t);
|
|
4835
4836
|
return this.backend.hitTester.pick(n.x, n.y);
|
|
@@ -4909,15 +4910,15 @@ var $n = Pn, er = qn, tr = class {
|
|
|
4909
4910
|
getCullingMode() {
|
|
4910
4911
|
return this.state.settings.cullingMode;
|
|
4911
4912
|
}
|
|
4912
|
-
},
|
|
4913
|
-
function
|
|
4913
|
+
}, rr = "room";
|
|
4914
|
+
function ir(e, t) {
|
|
4914
4915
|
let n = /* @__PURE__ */ new Map();
|
|
4915
4916
|
function r(e) {
|
|
4916
4917
|
let t = n.get(e);
|
|
4917
4918
|
return t || (t = [], n.set(e, t)), t;
|
|
4918
4919
|
}
|
|
4919
4920
|
function i(e, t, n, i, o, s, c) {
|
|
4920
|
-
let l = e.layer ?? c ??
|
|
4921
|
+
let l = e.layer ?? c ?? rr;
|
|
4921
4922
|
switch (e.type) {
|
|
4922
4923
|
case "rect": {
|
|
4923
4924
|
let a = {
|
|
@@ -4930,7 +4931,7 @@ function rr(e, t) {
|
|
|
4930
4931
|
stroke: e.paint.stroke,
|
|
4931
4932
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4932
4933
|
cr: (e.cornerRadius ?? 0) * i,
|
|
4933
|
-
dash:
|
|
4934
|
+
dash: or(e.paint.dash, i, e.paint.dashEnabled)
|
|
4934
4935
|
};
|
|
4935
4936
|
r(l).push(a);
|
|
4936
4937
|
return;
|
|
@@ -4944,16 +4945,16 @@ function rr(e, t) {
|
|
|
4944
4945
|
fill: e.paint.fill,
|
|
4945
4946
|
stroke: e.paint.stroke,
|
|
4946
4947
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4947
|
-
dash:
|
|
4948
|
+
dash: or(e.paint.dash, i, e.paint.dashEnabled)
|
|
4948
4949
|
});
|
|
4949
4950
|
return;
|
|
4950
4951
|
case "line": {
|
|
4951
4952
|
let a = {
|
|
4952
4953
|
type: "line",
|
|
4953
|
-
points:
|
|
4954
|
+
points: ar(e.points, t, n, i, o, s),
|
|
4954
4955
|
stroke: e.paint.stroke,
|
|
4955
4956
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4956
|
-
dash:
|
|
4957
|
+
dash: or(e.paint.dash, i, e.paint.dashEnabled),
|
|
4957
4958
|
lineCap: e.lineCap,
|
|
4958
4959
|
lineJoin: e.lineJoin,
|
|
4959
4960
|
alpha: e.paint.alpha
|
|
@@ -4964,7 +4965,7 @@ function rr(e, t) {
|
|
|
4964
4965
|
case "polygon": {
|
|
4965
4966
|
let a = {
|
|
4966
4967
|
type: "polygon",
|
|
4967
|
-
vertices:
|
|
4968
|
+
vertices: ar(e.vertices, t, n, i, o, s),
|
|
4968
4969
|
fill: e.paint.fill,
|
|
4969
4970
|
stroke: e.paint.stroke,
|
|
4970
4971
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
@@ -4973,7 +4974,7 @@ function rr(e, t) {
|
|
|
4973
4974
|
return;
|
|
4974
4975
|
}
|
|
4975
4976
|
case "text": {
|
|
4976
|
-
let a =
|
|
4977
|
+
let a = sr(e.transform, t, n, i, o, s), c = {
|
|
4977
4978
|
type: "text",
|
|
4978
4979
|
x: a ? 0 : (t + e.x) * i + o,
|
|
4979
4980
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -4996,7 +4997,7 @@ function rr(e, t) {
|
|
|
4996
4997
|
return;
|
|
4997
4998
|
}
|
|
4998
4999
|
case "image": {
|
|
4999
|
-
let a =
|
|
5000
|
+
let a = sr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
|
|
5000
5001
|
r(l).push({
|
|
5001
5002
|
type: "image",
|
|
5002
5003
|
x: c,
|
|
@@ -5016,7 +5017,7 @@ function rr(e, t) {
|
|
|
5016
5017
|
function a(e, t, n, a, o, s, c) {
|
|
5017
5018
|
let l = e.layer ?? c;
|
|
5018
5019
|
if (e.noScale) {
|
|
5019
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
5020
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? rr);
|
|
5020
5021
|
d.push({
|
|
5021
5022
|
type: "pushTransform",
|
|
5022
5023
|
matrix: [
|
|
@@ -5043,19 +5044,19 @@ function rr(e, t) {
|
|
|
5043
5044
|
});
|
|
5044
5045
|
return o;
|
|
5045
5046
|
}
|
|
5046
|
-
function
|
|
5047
|
+
function ar(e, t, n, r, i, a) {
|
|
5047
5048
|
let o = Array(e.length);
|
|
5048
5049
|
for (let s = 0; s < e.length; s += 2) o[s] = (t + e[s]) * r + i, o[s + 1] = (n + e[s + 1]) * r + a;
|
|
5049
5050
|
return o;
|
|
5050
5051
|
}
|
|
5051
|
-
function
|
|
5052
|
+
function or(e, t, n) {
|
|
5052
5053
|
if (n === !1) return;
|
|
5053
5054
|
if (!e || e.length === 0) return e;
|
|
5054
5055
|
let r = Array(e.length);
|
|
5055
5056
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5056
5057
|
return r;
|
|
5057
5058
|
}
|
|
5058
|
-
function
|
|
5059
|
+
function sr(e, t, n, r, i, a) {
|
|
5059
5060
|
if (!e) return;
|
|
5060
5061
|
let [o, s, c, l, u, d] = e;
|
|
5061
5062
|
return [
|
|
@@ -5069,21 +5070,21 @@ function or(e, t, n, r, i, a) {
|
|
|
5069
5070
|
}
|
|
5070
5071
|
//#endregion
|
|
5071
5072
|
//#region src/render/SvgRenderer.ts
|
|
5072
|
-
function
|
|
5073
|
+
function cr(e) {
|
|
5073
5074
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5074
5075
|
}
|
|
5075
|
-
function
|
|
5076
|
-
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ?
|
|
5076
|
+
function $(e, t) {
|
|
5077
|
+
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? cr(t) : t}"`;
|
|
5077
5078
|
}
|
|
5078
|
-
function
|
|
5079
|
+
function lr(e) {
|
|
5079
5080
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5080
5081
|
}
|
|
5081
|
-
function
|
|
5082
|
+
function ur(e) {
|
|
5082
5083
|
let t = [];
|
|
5083
|
-
for (let n of e)
|
|
5084
|
+
for (let n of e) dr(n.commands, t);
|
|
5084
5085
|
return t;
|
|
5085
5086
|
}
|
|
5086
|
-
function
|
|
5087
|
+
function dr(e, t) {
|
|
5087
5088
|
let n = [];
|
|
5088
5089
|
for (let r of e) switch (r.type) {
|
|
5089
5090
|
case "pushTransform": {
|
|
@@ -5101,65 +5102,65 @@ function ur(e, t) {
|
|
|
5101
5102
|
break;
|
|
5102
5103
|
}
|
|
5103
5104
|
default: {
|
|
5104
|
-
let e =
|
|
5105
|
+
let e = fr(r);
|
|
5105
5106
|
e && t.push(e);
|
|
5106
5107
|
break;
|
|
5107
5108
|
}
|
|
5108
5109
|
}
|
|
5109
5110
|
for (; n.length > 0;) t.push(n.pop());
|
|
5110
5111
|
}
|
|
5111
|
-
function
|
|
5112
|
+
function fr(e) {
|
|
5112
5113
|
switch (e.type) {
|
|
5113
5114
|
case "rect": {
|
|
5114
|
-
let t = e.fill ?? "none", n = e.cr > 0 ? `${
|
|
5115
|
-
return `<rect${
|
|
5115
|
+
let t = e.fill ?? "none", n = e.cr > 0 ? `${$("rx", e.cr)}${$("ry", e.cr)}` : "";
|
|
5116
|
+
return `<rect${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${n}${lr(e.dash)}/>`;
|
|
5116
5117
|
}
|
|
5117
5118
|
case "circle": {
|
|
5118
5119
|
let t = e.fill ?? "none";
|
|
5119
|
-
return `<circle${
|
|
5120
|
+
return `<circle${$("cx", e.cx)}${$("cy", e.cy)}${$("r", e.r)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${lr(e.dash)}/>`;
|
|
5120
5121
|
}
|
|
5121
5122
|
case "line": {
|
|
5122
5123
|
let t = e.points;
|
|
5123
5124
|
if (t.length < 2) return;
|
|
5124
5125
|
let n = [];
|
|
5125
5126
|
for (let e = 0; e < t.length; e += 2) n.push(`${t[e]},${t[e + 1]}`);
|
|
5126
|
-
return `<polyline points="${n.join(" ")}"${
|
|
5127
|
+
return `<polyline points="${n.join(" ")}"${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${lr(e.dash)}${$("stroke-linecap", e.lineCap)}${$("stroke-linejoin", e.lineJoin)}${$("opacity", e.alpha)} fill="none"/>`;
|
|
5127
5128
|
}
|
|
5128
5129
|
case "polygon": {
|
|
5129
5130
|
let t = e.vertices;
|
|
5130
5131
|
if (t.length < 4) return;
|
|
5131
5132
|
let n = [];
|
|
5132
5133
|
for (let e = 0; e < t.length; e += 2) n.push(`${t[e]},${t[e + 1]}`);
|
|
5133
|
-
return `<polygon points="${n.join(" ")}"${
|
|
5134
|
+
return `<polygon points="${n.join(" ")}"${$("fill", e.fill)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}/>`;
|
|
5134
5135
|
}
|
|
5135
5136
|
case "text": {
|
|
5136
5137
|
let t = e.x, n = e.y, r = "start", i = "auto";
|
|
5137
5138
|
e.w > 0 && (e.align === "center" ? (t = e.x + e.w / 2, r = "middle") : e.align === "right" && (t = e.x + e.w, r = "end")), e.h > 0 && e.vAlign === "middle" && (e.baselineRatio === void 0 ? (n = e.y + e.h / 2, i = "central") : n = e.y + e.h / 2 + e.baselineRatio * e.fontSize);
|
|
5138
5139
|
let a = e.transform ? ` transform="matrix(${e.transform.join(",")})"` : "", o = e.fontStyle === "bold" ? " font-weight=\"bold\"" : "", s = e.stroke && e.sw > 0 ? ` stroke="${e.stroke}" stroke-width="${e.sw}" paint-order="stroke fill"` : "";
|
|
5139
|
-
return `<text${
|
|
5140
|
+
return `<text${$("x", t)}${$("y", n)}${$("font-size", e.fontSize)}${e.fontFamily ? $("font-family", e.fontFamily) : ""}${o}${$("fill", e.fill)}${s} text-anchor="${r}" dominant-baseline="${i}"${a}>${cr(e.text)}</text>`;
|
|
5140
5141
|
}
|
|
5141
5142
|
case "image":
|
|
5142
5143
|
if (e.transform) {
|
|
5143
5144
|
let [t, n, r, i, a, o] = e.transform;
|
|
5144
|
-
return `<image${
|
|
5145
|
+
return `<image${$("width", e.w)}${$("height", e.h)} href="${cr(e.src)}" transform="matrix(${t},${n},${r},${i},${a},${o})"/>`;
|
|
5145
5146
|
}
|
|
5146
|
-
return `<image${
|
|
5147
|
+
return `<image${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)} href="${cr(e.src)}"/>`;
|
|
5147
5148
|
}
|
|
5148
5149
|
}
|
|
5149
5150
|
//#endregion
|
|
5150
5151
|
//#region src/render/CanvasRenderer.ts
|
|
5151
|
-
var
|
|
5152
|
+
var pr = (e) => {
|
|
5152
5153
|
if (typeof Image < "u") {
|
|
5153
5154
|
let t = new Image();
|
|
5154
5155
|
return t.src = e, t;
|
|
5155
5156
|
}
|
|
5156
5157
|
return null;
|
|
5157
5158
|
};
|
|
5158
|
-
function
|
|
5159
|
-
let r = n.imageFactory ??
|
|
5160
|
-
for (let n of t)
|
|
5159
|
+
function mr(e, t, n = {}) {
|
|
5160
|
+
let r = n.imageFactory ?? pr;
|
|
5161
|
+
for (let n of t) hr(e, n.commands, r);
|
|
5161
5162
|
}
|
|
5162
|
-
function
|
|
5163
|
+
function hr(e, t, n) {
|
|
5163
5164
|
let r = 0;
|
|
5164
5165
|
for (let i of t) switch (i.type) {
|
|
5165
5166
|
case "pushTransform":
|
|
@@ -5173,12 +5174,12 @@ function mr(e, t, n) {
|
|
|
5173
5174
|
r > 0 && (e.restore(), r--);
|
|
5174
5175
|
break;
|
|
5175
5176
|
default:
|
|
5176
|
-
|
|
5177
|
+
gr(e, i, n);
|
|
5177
5178
|
break;
|
|
5178
5179
|
}
|
|
5179
5180
|
for (; r > 0;) e.restore(), r--;
|
|
5180
5181
|
}
|
|
5181
|
-
function
|
|
5182
|
+
function gr(e, t, n) {
|
|
5182
5183
|
switch (t.type) {
|
|
5183
5184
|
case "rect":
|
|
5184
5185
|
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
@@ -5239,36 +5240,35 @@ function hr(e, t, n) {
|
|
|
5239
5240
|
}
|
|
5240
5241
|
//#endregion
|
|
5241
5242
|
//#region src/export/flushSceneShapes.ts
|
|
5242
|
-
function
|
|
5243
|
-
n(e.grid), n(e.link), n(e.room), n(
|
|
5243
|
+
function _r(e, t, n) {
|
|
5244
|
+
n(e.grid), n(e.link), n(e.room), n(vr(t.state, t.overlays));
|
|
5244
5245
|
for (let e of t.sceneOverlays) {
|
|
5245
|
-
if (!e.render) continue;
|
|
5246
5246
|
let r = e.render(t.state, t.viewportBounds);
|
|
5247
5247
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5248
5248
|
}
|
|
5249
5249
|
n(e.topLabel);
|
|
5250
5250
|
}
|
|
5251
|
-
function
|
|
5251
|
+
function vr(e, t) {
|
|
5252
5252
|
let n = e.getOverlaysForArea(t);
|
|
5253
5253
|
if (!n) return [];
|
|
5254
5254
|
let r = e.settings, i = [];
|
|
5255
5255
|
if (n.paths) for (let t of n.paths) {
|
|
5256
|
-
let n =
|
|
5257
|
-
i.push(...
|
|
5256
|
+
let n = st(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5257
|
+
i.push(...ut(n));
|
|
5258
5258
|
}
|
|
5259
5259
|
if (n.highlights) for (let t of n.highlights) {
|
|
5260
5260
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5261
|
-
n && i.push(
|
|
5261
|
+
n && i.push(ct(at(n, t.color, r)));
|
|
5262
5262
|
}
|
|
5263
5263
|
if (n.position) {
|
|
5264
5264
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5265
|
-
t && i.push(
|
|
5265
|
+
t && i.push(lt(ot(t, r)));
|
|
5266
5266
|
}
|
|
5267
5267
|
return i;
|
|
5268
5268
|
}
|
|
5269
5269
|
//#endregion
|
|
5270
5270
|
//#region src/export/sceneBounds.ts
|
|
5271
|
-
function
|
|
5271
|
+
function yr(e, t, n = 0) {
|
|
5272
5272
|
if (!t.worldToScene) return e;
|
|
5273
5273
|
let r = [
|
|
5274
5274
|
t.worldToScene(e.x, e.y),
|
|
@@ -5286,15 +5286,15 @@ function vr(e, t, n = 0) {
|
|
|
5286
5286
|
}
|
|
5287
5287
|
//#endregion
|
|
5288
5288
|
//#region src/export/SvgExporter.ts
|
|
5289
|
-
var
|
|
5289
|
+
var br = {
|
|
5290
5290
|
scale: 1,
|
|
5291
5291
|
offsetX: 0,
|
|
5292
5292
|
offsetY: 0
|
|
5293
5293
|
};
|
|
5294
|
-
function
|
|
5294
|
+
function xr(e) {
|
|
5295
5295
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5296
5296
|
}
|
|
5297
|
-
var
|
|
5297
|
+
var Sr = class {
|
|
5298
5298
|
constructor(e = {}) {
|
|
5299
5299
|
this.options = e;
|
|
5300
5300
|
}
|
|
@@ -5303,30 +5303,30 @@ var xr = class {
|
|
|
5303
5303
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5304
5304
|
let o = a, s = o.getPlane(i);
|
|
5305
5305
|
if (!s) return;
|
|
5306
|
-
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d =
|
|
5306
|
+
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Re(new z(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
|
|
5307
5307
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5308
5308
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5309
5309
|
}), p = {
|
|
5310
5310
|
scale: 1,
|
|
5311
5311
|
roomSize: c.roomSize
|
|
5312
|
-
}, m = (e) => t === W ? e : G(e, t, p), h =
|
|
5313
|
-
return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${
|
|
5312
|
+
}, m = (e) => t === W ? e : G(e, t, p), h = yr(u, t, c.roomSize * .5), g = [];
|
|
5313
|
+
return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${xr(c.backgroundColor)}"/>`), _r(f, {
|
|
5314
5314
|
state: e,
|
|
5315
5315
|
viewportBounds: d,
|
|
5316
5316
|
sceneOverlays: n,
|
|
5317
5317
|
overlays: this.options.overlays
|
|
5318
5318
|
}, (e) => {
|
|
5319
|
-
e.length !== 0 && g.push(...
|
|
5319
|
+
e.length !== 0 && g.push(...ur(ir(m(e), br)));
|
|
5320
5320
|
}), g.push("</svg>"), g.join("\n");
|
|
5321
5321
|
}
|
|
5322
|
-
},
|
|
5322
|
+
}, Cr = class {
|
|
5323
5323
|
constructor(e = {}) {
|
|
5324
5324
|
this.options = e;
|
|
5325
5325
|
}
|
|
5326
5326
|
render({ backend: e }) {
|
|
5327
5327
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5328
5328
|
}
|
|
5329
|
-
},
|
|
5329
|
+
}, wr = class {
|
|
5330
5330
|
constructor(e = {}) {
|
|
5331
5331
|
this.options = e;
|
|
5332
5332
|
}
|
|
@@ -5343,87 +5343,87 @@ var xr = class {
|
|
|
5343
5343
|
};
|
|
5344
5344
|
//#endregion
|
|
5345
5345
|
//#region src/export/canvasToBytes.ts
|
|
5346
|
-
function
|
|
5346
|
+
function Tr(e, t = "image/png", n) {
|
|
5347
5347
|
let r = e.toDataURL(t, n), i = r.indexOf(","), a = i >= 0 ? r.slice(i + 1) : r, o = atob(a), s = new Uint8Array(o.length);
|
|
5348
5348
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5349
5349
|
return s;
|
|
5350
5350
|
}
|
|
5351
5351
|
//#endregion
|
|
5352
5352
|
//#region src/export/CanvasExporter.ts
|
|
5353
|
-
var
|
|
5353
|
+
var Er = class {
|
|
5354
5354
|
constructor(e) {
|
|
5355
5355
|
this.options = e;
|
|
5356
5356
|
}
|
|
5357
|
-
render({ state:
|
|
5358
|
-
let { currentArea: i, currentZIndex: a, currentAreaInstance: o } =
|
|
5357
|
+
render({ state: e, style: t, sceneOverlays: n }) {
|
|
5358
|
+
let { currentArea: i, currentZIndex: a, currentAreaInstance: o } = e;
|
|
5359
5359
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5360
5360
|
let s = o, c = s.getPlane(a);
|
|
5361
5361
|
if (!c) return;
|
|
5362
|
-
let l =
|
|
5362
|
+
let l = e.settings, { width: u, height: d } = this.options, f = this.options.padding ?? 3, p = e.computeExportBounds(s, c, this.options.roomId, f), m = yr(p, t, l.roomSize * .5), h = Math.min(u / m.w, d / m.h), g = m.w * h, _ = m.h * h, v = (u - g) / 2 - m.x * h, y = (d - _) / 2 - m.y * h, b = {
|
|
5363
5363
|
scale: h,
|
|
5364
5364
|
offsetX: v,
|
|
5365
5365
|
offsetY: y
|
|
5366
|
-
},
|
|
5367
|
-
forward:
|
|
5368
|
-
inverse:
|
|
5369
|
-
},
|
|
5370
|
-
|
|
5371
|
-
let
|
|
5372
|
-
if (!
|
|
5373
|
-
|
|
5374
|
-
let
|
|
5366
|
+
}, x = D.forRenderCamera(u, d, h, v, y), S = {
|
|
5367
|
+
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5368
|
+
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5369
|
+
}, C = Re(new z(e.mapReader, l).buildScene(s, c, a, e.lens), x.getViewportBounds(), l, S), w = r.Util.createCanvasElement();
|
|
5370
|
+
w.width = u, w.height = d;
|
|
5371
|
+
let T = w.getContext("2d");
|
|
5372
|
+
if (!T) return;
|
|
5373
|
+
T.fillStyle = l.backgroundColor, T.fillRect(0, 0, u, d);
|
|
5374
|
+
let E = {
|
|
5375
5375
|
scale: h,
|
|
5376
5376
|
roomSize: l.roomSize
|
|
5377
|
-
}, O = (e) =>
|
|
5378
|
-
return
|
|
5379
|
-
state:
|
|
5380
|
-
viewportBounds:
|
|
5381
|
-
sceneOverlays:
|
|
5377
|
+
}, O = (e) => t === W ? e : G(e, t, E);
|
|
5378
|
+
return _r(C, {
|
|
5379
|
+
state: e,
|
|
5380
|
+
viewportBounds: D.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5381
|
+
sceneOverlays: n,
|
|
5382
5382
|
overlays: this.options.overlays
|
|
5383
5383
|
}, (e) => {
|
|
5384
|
-
e.length !== 0 &&
|
|
5385
|
-
}),
|
|
5384
|
+
e.length !== 0 && mr(T, ir(O(e), b));
|
|
5385
|
+
}), w;
|
|
5386
5386
|
}
|
|
5387
|
-
},
|
|
5387
|
+
}, Dr = class {
|
|
5388
5388
|
constructor(e) {
|
|
5389
|
-
this.options = e, this.canvasExporter = new
|
|
5389
|
+
this.options = e, this.canvasExporter = new Er(e);
|
|
5390
5390
|
}
|
|
5391
5391
|
render(e) {
|
|
5392
5392
|
let t = this.canvasExporter.render(e);
|
|
5393
|
-
if (t) return
|
|
5393
|
+
if (t) return Tr(t, this.options.mimeType, this.options.quality);
|
|
5394
5394
|
}
|
|
5395
|
-
},
|
|
5396
|
-
function
|
|
5395
|
+
}, Or, kr, Ar = 256;
|
|
5396
|
+
function jr(e, t, n) {
|
|
5397
5397
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5398
|
-
if (
|
|
5399
|
-
let i =
|
|
5398
|
+
if (kr === r && Or) return Or;
|
|
5399
|
+
let i = Ar, a = i / 2, o = document.createElement("canvas");
|
|
5400
5400
|
o.width = i, o.height = i;
|
|
5401
5401
|
let s = o.getContext("2d");
|
|
5402
5402
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5403
5403
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5404
5404
|
c.addColorStop(0, "rgba(0, 0, 0, 1)"), c.addColorStop(l * .25, "rgba(0, 0, 0, 0.97)"), c.addColorStop(l * .5, "rgba(0, 0, 0, 0.82)"), c.addColorStop(l * .7, "rgba(0, 0, 0, 0.50)"), c.addColorStop(l * .85, "rgba(0, 0, 0, 0.22)"), c.addColorStop(l * .95, "rgba(0, 0, 0, 0.06)"), c.addColorStop(l, "rgba(0, 0, 0, 0)"), l < .98 && c.addColorStop(1, "rgba(0, 0, 0, 0)"), s.fillStyle = c, s.beginPath(), s.arc(a, a, a, 0, Math.PI * 2), s.fill(), s.globalCompositeOperation = "source-over";
|
|
5405
5405
|
let u = parseInt(t.slice(1, 3), 16), d = parseInt(t.slice(3, 5), 16), f = parseInt(t.slice(5, 7), 16), p = s.createRadialGradient(a, a, 0, a, a, a * l);
|
|
5406
|
-
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i),
|
|
5406
|
+
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), Or = o.toDataURL(), kr = r, Or;
|
|
5407
5407
|
}
|
|
5408
|
-
function
|
|
5408
|
+
function Mr(e, t, n, r) {
|
|
5409
5409
|
let { radius: i, intensity: a, color: o } = r, s = n.maxX - n.minX, c = n.maxY - n.minY, l = Math.sqrt(s * s + c * c), u = Math.max(l * 2.5, i * 4);
|
|
5410
5410
|
return {
|
|
5411
5411
|
cx: e,
|
|
5412
5412
|
cy: t,
|
|
5413
5413
|
displaySize: u,
|
|
5414
|
-
src:
|
|
5414
|
+
src: jr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5415
5415
|
};
|
|
5416
5416
|
}
|
|
5417
5417
|
//#endregion
|
|
5418
5418
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5419
|
-
var
|
|
5419
|
+
var Nr = {
|
|
5420
5420
|
color: "#ffcc44",
|
|
5421
5421
|
radius: 12,
|
|
5422
5422
|
intensity: .7
|
|
5423
|
-
},
|
|
5423
|
+
}, Pr = class {
|
|
5424
5424
|
constructor(e) {
|
|
5425
5425
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5426
|
-
...
|
|
5426
|
+
...Nr,
|
|
5427
5427
|
...e
|
|
5428
5428
|
};
|
|
5429
5429
|
}
|
|
@@ -5446,7 +5446,7 @@ var jr = {
|
|
|
5446
5446
|
if (e.positionRoomId === void 0) return;
|
|
5447
5447
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5448
5448
|
if (!n) return;
|
|
5449
|
-
let r =
|
|
5449
|
+
let r = Mr(n.x, n.y, t, this.params);
|
|
5450
5450
|
return {
|
|
5451
5451
|
type: "image",
|
|
5452
5452
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5457,140 +5457,7 @@ var jr = {
|
|
|
5457
5457
|
layer: "overlay"
|
|
5458
5458
|
};
|
|
5459
5459
|
}
|
|
5460
|
-
},
|
|
5461
|
-
rgb: [
|
|
5462
|
-
114,
|
|
5463
|
-
1,
|
|
5464
|
-
0
|
|
5465
|
-
],
|
|
5466
|
-
rgbValue: "rgb(114, 1, 0)",
|
|
5467
|
-
symbolColor: [
|
|
5468
|
-
225,
|
|
5469
|
-
225,
|
|
5470
|
-
225
|
|
5471
|
-
],
|
|
5472
|
-
symbolColorValue: "rgb(225,225,225)"
|
|
5473
|
-
};
|
|
5474
|
-
function Pr(e) {
|
|
5475
|
-
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
|
|
5476
|
-
return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
|
|
5477
|
-
}
|
|
5478
|
-
var Fr = class {
|
|
5479
|
-
constructor(e, t) {
|
|
5480
|
-
this.rooms = {}, this.areas = {}, this.areaSources = {}, this.explorationEnabled = !1, this.colors = {}, e.forEach((e) => {
|
|
5481
|
-
let t = {
|
|
5482
|
-
...e,
|
|
5483
|
-
rooms: e.rooms.map((e) => ({
|
|
5484
|
-
...e,
|
|
5485
|
-
y: -e.y
|
|
5486
|
-
}))
|
|
5487
|
-
};
|
|
5488
|
-
t.rooms.forEach((e) => {
|
|
5489
|
-
this.rooms[e.id] = e;
|
|
5490
|
-
});
|
|
5491
|
-
let n = parseInt(e.areaId);
|
|
5492
|
-
this.areas[n] = new st(t), this.areaSources[n] = t;
|
|
5493
|
-
}), this.colors = t.reduce((e, t) => ({
|
|
5494
|
-
...e,
|
|
5495
|
-
[t.envId]: {
|
|
5496
|
-
rgb: t.colors,
|
|
5497
|
-
rgbValue: `rgb(${t.colors.join(",")})`,
|
|
5498
|
-
symbolColor: Pr(t.colors) > .41 ? [
|
|
5499
|
-
25,
|
|
5500
|
-
25,
|
|
5501
|
-
25
|
|
5502
|
-
] : [
|
|
5503
|
-
225,
|
|
5504
|
-
255,
|
|
5505
|
-
255
|
|
5506
|
-
],
|
|
5507
|
-
symbolColorValue: Pr(t.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
|
|
5508
|
-
}
|
|
5509
|
-
}), {});
|
|
5510
|
-
}
|
|
5511
|
-
getArea(e) {
|
|
5512
|
-
return this.areas[e];
|
|
5513
|
-
}
|
|
5514
|
-
getExplorationArea(e) {
|
|
5515
|
-
let t = this.areas[e];
|
|
5516
|
-
if (t instanceof H) return t;
|
|
5517
|
-
}
|
|
5518
|
-
getAreas() {
|
|
5519
|
-
return Object.values(this.areas);
|
|
5520
|
-
}
|
|
5521
|
-
getRooms() {
|
|
5522
|
-
return Object.values(this.rooms);
|
|
5523
|
-
}
|
|
5524
|
-
getRoom(e) {
|
|
5525
|
-
return this.rooms[e];
|
|
5526
|
-
}
|
|
5527
|
-
ensureVisitedRooms() {
|
|
5528
|
-
return this.visitedRooms ||= /* @__PURE__ */ new Set(), this.visitedRooms;
|
|
5529
|
-
}
|
|
5530
|
-
applyExplorationDecoration() {
|
|
5531
|
-
this.visitedRooms && Object.entries(this.areaSources).forEach(([e, t]) => {
|
|
5532
|
-
let n = parseInt(e, 10);
|
|
5533
|
-
this.areas[n] = new H(t, this.visitedRooms);
|
|
5534
|
-
});
|
|
5535
|
-
}
|
|
5536
|
-
decorateWithExploration(e) {
|
|
5537
|
-
return e === void 0 ? this.ensureVisitedRooms() : this.setVisitedRooms(e), this.applyExplorationDecoration(), this.explorationEnabled = !0, this.visitedRooms;
|
|
5538
|
-
}
|
|
5539
|
-
getVisitedRooms() {
|
|
5540
|
-
return this.visitedRooms;
|
|
5541
|
-
}
|
|
5542
|
-
clearExplorationDecoration() {
|
|
5543
|
-
Object.entries(this.areaSources).forEach(([e, t]) => {
|
|
5544
|
-
let n = parseInt(e, 10);
|
|
5545
|
-
this.areas[n] = new st(t);
|
|
5546
|
-
}), this.explorationEnabled = !1;
|
|
5547
|
-
}
|
|
5548
|
-
isExplorationEnabled() {
|
|
5549
|
-
return this.explorationEnabled;
|
|
5550
|
-
}
|
|
5551
|
-
setVisitedRooms(e) {
|
|
5552
|
-
return this.visitedRooms = e instanceof Set ? e : new Set(e), this.explorationEnabled && this.applyExplorationDecoration(), this.visitedRooms;
|
|
5553
|
-
}
|
|
5554
|
-
addVisitedRoom(e) {
|
|
5555
|
-
if (this.explorationEnabled) {
|
|
5556
|
-
let t = this.getRoom(e);
|
|
5557
|
-
if (t) {
|
|
5558
|
-
let n = this.getExplorationArea(t.area);
|
|
5559
|
-
if (n) return n.addVisitedRoom(e);
|
|
5560
|
-
}
|
|
5561
|
-
}
|
|
5562
|
-
let t = this.ensureVisitedRooms(), n = t.has(e);
|
|
5563
|
-
return t.add(e), !n;
|
|
5564
|
-
}
|
|
5565
|
-
addVisitedRooms(e) {
|
|
5566
|
-
let t = this.ensureVisitedRooms(), n = 0;
|
|
5567
|
-
for (let r of e) {
|
|
5568
|
-
if (this.explorationEnabled) {
|
|
5569
|
-
let e = this.getRoom(r);
|
|
5570
|
-
if (e) {
|
|
5571
|
-
let t = this.getExplorationArea(e.area);
|
|
5572
|
-
if (t) {
|
|
5573
|
-
t.addVisitedRoom(r) && n++;
|
|
5574
|
-
continue;
|
|
5575
|
-
}
|
|
5576
|
-
}
|
|
5577
|
-
}
|
|
5578
|
-
let e = t.has(r);
|
|
5579
|
-
t.add(r), e || n++;
|
|
5580
|
-
}
|
|
5581
|
-
return n;
|
|
5582
|
-
}
|
|
5583
|
-
hasVisitedRoom(e) {
|
|
5584
|
-
return this.visitedRooms?.has(e) ?? !1;
|
|
5585
|
-
}
|
|
5586
|
-
getColorValue(e) {
|
|
5587
|
-
return this.colors[e]?.rgbValue ?? Nr.rgbValue;
|
|
5588
|
-
}
|
|
5589
|
-
getSymbolColor(e, t) {
|
|
5590
|
-
let n = this.colors[e]?.symbolColor ?? Nr.symbolColor, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.join(",");
|
|
5591
|
-
return r == 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
|
|
5592
|
-
}
|
|
5593
|
-
}, Ir = /* @__PURE__ */ s(((e, t) => {
|
|
5460
|
+
}, Fr = /* @__PURE__ */ u(((e, t) => {
|
|
5594
5461
|
t.exports = class {
|
|
5595
5462
|
constructor() {
|
|
5596
5463
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5620,14 +5487,14 @@ var Fr = class {
|
|
|
5620
5487
|
return this.queue.find((t) => t.key === e);
|
|
5621
5488
|
}
|
|
5622
5489
|
};
|
|
5623
|
-
})),
|
|
5490
|
+
})), Ir = /* @__PURE__ */ u(((e, t) => {
|
|
5624
5491
|
function n(e, t) {
|
|
5625
5492
|
let r = /* @__PURE__ */ new Map();
|
|
5626
5493
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5627
5494
|
return r;
|
|
5628
5495
|
}
|
|
5629
5496
|
t.exports = n;
|
|
5630
|
-
})),
|
|
5497
|
+
})), Lr = /* @__PURE__ */ u(((e, t) => {
|
|
5631
5498
|
function n(e) {
|
|
5632
5499
|
let t = Number(e);
|
|
5633
5500
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5642,7 +5509,7 @@ var Fr = class {
|
|
|
5642
5509
|
}), t;
|
|
5643
5510
|
}
|
|
5644
5511
|
t.exports = r;
|
|
5645
|
-
})),
|
|
5512
|
+
})), Rr = /* @__PURE__ */ u(((e, t) => {
|
|
5646
5513
|
function n(e) {
|
|
5647
5514
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5648
5515
|
e.forEach((e, t) => {
|
|
@@ -5654,8 +5521,8 @@ var Fr = class {
|
|
|
5654
5521
|
});
|
|
5655
5522
|
}
|
|
5656
5523
|
t.exports = n;
|
|
5657
|
-
})),
|
|
5658
|
-
var n =
|
|
5524
|
+
})), zr = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5525
|
+
var n = Fr(), r = Ir(), i = Lr(), a = Rr();
|
|
5659
5526
|
t.exports = class {
|
|
5660
5527
|
constructor(e) {
|
|
5661
5528
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5705,7 +5572,7 @@ var Fr = class {
|
|
|
5705
5572
|
return this.path(...e);
|
|
5706
5573
|
}
|
|
5707
5574
|
};
|
|
5708
|
-
})))(), 1),
|
|
5575
|
+
})))(), 1), Br = {
|
|
5709
5576
|
1: "north",
|
|
5710
5577
|
2: "northeast",
|
|
5711
5578
|
3: "northwest",
|
|
@@ -5718,7 +5585,7 @@ var Fr = class {
|
|
|
5718
5585
|
10: "down",
|
|
5719
5586
|
11: "in",
|
|
5720
5587
|
12: "out"
|
|
5721
|
-
},
|
|
5588
|
+
}, Vr = {
|
|
5722
5589
|
north: "n",
|
|
5723
5590
|
northeast: "ne",
|
|
5724
5591
|
northwest: "nw",
|
|
@@ -5731,7 +5598,7 @@ var Fr = class {
|
|
|
5731
5598
|
down: "down",
|
|
5732
5599
|
in: "in",
|
|
5733
5600
|
out: "out"
|
|
5734
|
-
},
|
|
5601
|
+
}, Hr = class {
|
|
5735
5602
|
constructor(e) {
|
|
5736
5603
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5737
5604
|
}
|
|
@@ -5757,12 +5624,12 @@ var Fr = class {
|
|
|
5757
5624
|
buildGraph() {
|
|
5758
5625
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5759
5626
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5760
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
5627
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Br[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
5761
5628
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5762
5629
|
if (s.has(e)) return;
|
|
5763
5630
|
let c = this.mapReader.getRoom(t);
|
|
5764
5631
|
if (c) {
|
|
5765
|
-
let s =
|
|
5632
|
+
let s = Vr[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5766
5633
|
a.push({
|
|
5767
5634
|
id: t,
|
|
5768
5635
|
weight: l
|
|
@@ -5793,7 +5660,7 @@ var Fr = class {
|
|
|
5793
5660
|
};
|
|
5794
5661
|
//#endregion
|
|
5795
5662
|
//#region src/PathFinder.ts
|
|
5796
|
-
function
|
|
5663
|
+
function Ur(e, t) {
|
|
5797
5664
|
e.push(t);
|
|
5798
5665
|
let n = e.length - 1;
|
|
5799
5666
|
for (; n > 0;) {
|
|
@@ -5802,7 +5669,7 @@ function Wr(e, t) {
|
|
|
5802
5669
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5803
5670
|
}
|
|
5804
5671
|
}
|
|
5805
|
-
function
|
|
5672
|
+
function Wr(e) {
|
|
5806
5673
|
if (e.length === 0) return;
|
|
5807
5674
|
let t = e[0], n = e.pop();
|
|
5808
5675
|
if (e.length > 0) {
|
|
@@ -5816,16 +5683,16 @@ function Gr(e) {
|
|
|
5816
5683
|
}
|
|
5817
5684
|
return t;
|
|
5818
5685
|
}
|
|
5819
|
-
function
|
|
5686
|
+
function Gr(e, t, n) {
|
|
5820
5687
|
let r = [n], i = n;
|
|
5821
5688
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5822
5689
|
return r.reverse(), r;
|
|
5823
5690
|
}
|
|
5824
|
-
function
|
|
5691
|
+
function Kr(e, t, n) {
|
|
5825
5692
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5826
5693
|
return i ? i.map((e) => Number(e)) : null;
|
|
5827
5694
|
}
|
|
5828
|
-
function
|
|
5695
|
+
function qr(e, t, n, r) {
|
|
5829
5696
|
let i = r.getRoom(n);
|
|
5830
5697
|
if (!i) return null;
|
|
5831
5698
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5834,16 +5701,16 @@ function Jr(e, t, n, r) {
|
|
|
5834
5701
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5835
5702
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5836
5703
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5837
|
-
for (d.set(t, 0),
|
|
5704
|
+
for (d.set(t, 0), Ur(p, {
|
|
5838
5705
|
id: t,
|
|
5839
5706
|
priority: u(t)
|
|
5840
5707
|
}); p.length > 0;) {
|
|
5841
|
-
let { id: r } =
|
|
5842
|
-
if (r === n) return
|
|
5708
|
+
let { id: r } = Wr(p);
|
|
5709
|
+
if (r === n) return Gr(f, t, n);
|
|
5843
5710
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5844
5711
|
if (a) for (let e of a) {
|
|
5845
5712
|
let t = i + e.weight;
|
|
5846
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
5713
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), Ur(p, {
|
|
5847
5714
|
id: e.id,
|
|
5848
5715
|
priority: t + u(e.id)
|
|
5849
5716
|
}));
|
|
@@ -5851,9 +5718,9 @@ function Jr(e, t, n, r) {
|
|
|
5851
5718
|
}
|
|
5852
5719
|
return null;
|
|
5853
5720
|
}
|
|
5854
|
-
var
|
|
5721
|
+
var Jr = class {
|
|
5855
5722
|
constructor(e, t = "dijkstra") {
|
|
5856
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
5723
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Hr(e), this.dijkstraGraph = new zr.default(this.mapGraph.getGraphDefinition());
|
|
5857
5724
|
}
|
|
5858
5725
|
get algorithm() {
|
|
5859
5726
|
return this._algorithm;
|
|
@@ -5872,15 +5739,87 @@ var Yr = class {
|
|
|
5872
5739
|
let r;
|
|
5873
5740
|
switch (this._algorithm) {
|
|
5874
5741
|
case "dijkstra":
|
|
5875
|
-
r =
|
|
5742
|
+
r = Kr(this.dijkstraGraph, e, t);
|
|
5876
5743
|
break;
|
|
5877
5744
|
case "astar":
|
|
5878
|
-
r =
|
|
5745
|
+
r = qr(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5879
5746
|
break;
|
|
5880
5747
|
}
|
|
5881
5748
|
return this.cache.set(n, r), r;
|
|
5882
5749
|
}
|
|
5883
|
-
},
|
|
5750
|
+
}, Yr = {
|
|
5751
|
+
hidden: 2,
|
|
5752
|
+
stub: 1,
|
|
5753
|
+
full: 0
|
|
5754
|
+
};
|
|
5755
|
+
function Xr(e, t, n) {
|
|
5756
|
+
return n === "first" ? e : n === "least-restrictive" ? Yr[e] < Yr[t] ? e : t : Yr[e] > Yr[t] ? e : t;
|
|
5757
|
+
}
|
|
5758
|
+
function Zr(e, ...t) {
|
|
5759
|
+
let n = {}, r;
|
|
5760
|
+
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5761
|
+
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
5762
|
+
return r.length === 0 ? {
|
|
5763
|
+
isVisible: () => !0,
|
|
5764
|
+
getVersion: () => 0
|
|
5765
|
+
} : r.length === 1 ? r[0] : {
|
|
5766
|
+
isVisible(e) {
|
|
5767
|
+
return a === "or" ? r.some((t) => t.isVisible(e)) : r.every((t) => t.isVisible(e));
|
|
5768
|
+
},
|
|
5769
|
+
getExitTreatment(e, t, n) {
|
|
5770
|
+
let a;
|
|
5771
|
+
for (let o of r) {
|
|
5772
|
+
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5773
|
+
if (a === void 0) a = r;
|
|
5774
|
+
else if (a = Xr(a, r, i), i === "first") break;
|
|
5775
|
+
}
|
|
5776
|
+
return a ?? "full";
|
|
5777
|
+
},
|
|
5778
|
+
getVersion() {
|
|
5779
|
+
let e = 0;
|
|
5780
|
+
for (let t of r) e += t.getVersion();
|
|
5781
|
+
return e;
|
|
5782
|
+
}
|
|
5783
|
+
};
|
|
5784
|
+
}
|
|
5785
|
+
//#endregion
|
|
5786
|
+
//#region src/lens/ExplorationLens.ts
|
|
5787
|
+
var Qr = class {
|
|
5788
|
+
constructor(e) {
|
|
5789
|
+
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5790
|
+
}
|
|
5791
|
+
isVisible(e) {
|
|
5792
|
+
return this.visited.has(e.id);
|
|
5793
|
+
}
|
|
5794
|
+
getVersion() {
|
|
5795
|
+
return this.version;
|
|
5796
|
+
}
|
|
5797
|
+
hasVisited(e) {
|
|
5798
|
+
return this.visited.has(e);
|
|
5799
|
+
}
|
|
5800
|
+
getVisitedRoomIds() {
|
|
5801
|
+
return [...this.visited];
|
|
5802
|
+
}
|
|
5803
|
+
getVisitedCount() {
|
|
5804
|
+
return this.visited.size;
|
|
5805
|
+
}
|
|
5806
|
+
addVisited(e) {
|
|
5807
|
+
return this.visited.has(e) ? !1 : (this.visited.add(e), this.version++, !0);
|
|
5808
|
+
}
|
|
5809
|
+
addVisitedAll(e) {
|
|
5810
|
+
let t = 0;
|
|
5811
|
+
for (let n of e) this.visited.has(n) || (this.visited.add(n), t++);
|
|
5812
|
+
return t > 0 && this.version++, t;
|
|
5813
|
+
}
|
|
5814
|
+
setVisited(e) {
|
|
5815
|
+
this.visited.clear();
|
|
5816
|
+
for (let t of e) this.visited.add(t);
|
|
5817
|
+
this.version++;
|
|
5818
|
+
}
|
|
5819
|
+
clear() {
|
|
5820
|
+
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5821
|
+
}
|
|
5822
|
+
}, $r = {
|
|
5884
5823
|
1: "north",
|
|
5885
5824
|
2: "northeast",
|
|
5886
5825
|
3: "northwest",
|
|
@@ -5894,7 +5833,7 @@ var Yr = class {
|
|
|
5894
5833
|
11: "in",
|
|
5895
5834
|
12: "out"
|
|
5896
5835
|
};
|
|
5897
|
-
function
|
|
5836
|
+
function ei() {
|
|
5898
5837
|
return {
|
|
5899
5838
|
areaWidth: 150,
|
|
5900
5839
|
areaHeight: 80,
|
|
@@ -5908,14 +5847,14 @@ function Zr() {
|
|
|
5908
5847
|
highlightColor: "#ff9900"
|
|
5909
5848
|
};
|
|
5910
5849
|
}
|
|
5911
|
-
var
|
|
5912
|
-
constructor(t, n
|
|
5913
|
-
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings =
|
|
5914
|
-
container:
|
|
5915
|
-
width:
|
|
5916
|
-
height:
|
|
5850
|
+
var ti = class {
|
|
5851
|
+
constructor(e, t, n) {
|
|
5852
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? ei(), this.stage = new r.Stage({
|
|
5853
|
+
container: e,
|
|
5854
|
+
width: e.clientWidth,
|
|
5855
|
+
height: e.clientHeight,
|
|
5917
5856
|
draggable: !0
|
|
5918
|
-
}), this.backgroundLayer = new
|
|
5857
|
+
}), this.backgroundLayer = new r.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new r.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new r.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
|
|
5919
5858
|
}
|
|
5920
5859
|
initResize(e) {
|
|
5921
5860
|
new ResizeObserver(() => {
|
|
@@ -6005,20 +5944,20 @@ var Qr = class {
|
|
|
6005
5944
|
}
|
|
6006
5945
|
drawBackground() {
|
|
6007
5946
|
if (this.backgroundLayer.destroyChildren(), !this.backgroundConfig) return;
|
|
6008
|
-
let
|
|
6009
|
-
|
|
6010
|
-
this.backgroundImage = new
|
|
5947
|
+
let e = new Image();
|
|
5948
|
+
e.crossOrigin = "anonymous", e.onload = () => {
|
|
5949
|
+
this.backgroundImage = new r.Image({
|
|
6011
5950
|
x: this.backgroundConfig.x,
|
|
6012
5951
|
y: this.backgroundConfig.y,
|
|
6013
|
-
image:
|
|
5952
|
+
image: e,
|
|
6014
5953
|
width: this.backgroundConfig.width,
|
|
6015
5954
|
height: this.backgroundConfig.height,
|
|
6016
5955
|
opacity: this.backgroundConfig.opacity,
|
|
6017
5956
|
listening: !1
|
|
6018
5957
|
}), this.backgroundLayer.add(this.backgroundImage), this.backgroundLayer.batchDraw();
|
|
6019
|
-
},
|
|
5958
|
+
}, e.onerror = () => {
|
|
6020
5959
|
console.error("Failed to load background image:", this.backgroundConfig?.url);
|
|
6021
|
-
},
|
|
5960
|
+
}, e.src = this.backgroundConfig.url;
|
|
6022
5961
|
}
|
|
6023
5962
|
analyzeConnections() {
|
|
6024
5963
|
this.areaNodes.clear(), this.connectionGroups = [];
|
|
@@ -6093,14 +6032,14 @@ var Qr = class {
|
|
|
6093
6032
|
toAreaId: e.fromAreaId,
|
|
6094
6033
|
fromRoomId: e.toRoomId,
|
|
6095
6034
|
toRoomId: e.fromRoomId,
|
|
6096
|
-
direction: e.direction ?
|
|
6035
|
+
direction: e.direction ? M[e.direction] : null,
|
|
6097
6036
|
fromRoomPosition: e.toRoomPosition,
|
|
6098
6037
|
toRoomPosition: e.fromRoomPosition
|
|
6099
6038
|
});
|
|
6100
6039
|
}
|
|
6101
6040
|
}
|
|
6102
6041
|
getLockedDirections(e) {
|
|
6103
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6042
|
+
return new Set((e.exitLocks ?? []).map((e) => $r[e]).filter((e) => !!e));
|
|
6104
6043
|
}
|
|
6105
6044
|
createConnection(e, t, n) {
|
|
6106
6045
|
let r = this.toPlanarDirection(n);
|
|
@@ -6169,7 +6108,7 @@ var Qr = class {
|
|
|
6169
6108
|
}[e.toLowerCase().trim()] ?? null;
|
|
6170
6109
|
}
|
|
6171
6110
|
toPlanarDirection(e) {
|
|
6172
|
-
return e &&
|
|
6111
|
+
return e && ne.includes(e) ? e : null;
|
|
6173
6112
|
}
|
|
6174
6113
|
layoutAreas() {
|
|
6175
6114
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6551,18 +6490,18 @@ var Qr = class {
|
|
|
6551
6490
|
}
|
|
6552
6491
|
drawConnections() {
|
|
6553
6492
|
this.connectionLayer.destroyChildren();
|
|
6554
|
-
for (let
|
|
6555
|
-
let
|
|
6556
|
-
if (!
|
|
6493
|
+
for (let e of this.connectionGroups) {
|
|
6494
|
+
let t = this.areaNodes.get(e.fromAreaId), n = this.areaNodes.get(e.toAreaId);
|
|
6495
|
+
if (!t || !n || !isFinite(t.x) || !isFinite(t.y) || !isFinite(n.x) || !isFinite(n.y)) continue;
|
|
6557
6496
|
let i = {
|
|
6497
|
+
x: t.x + t.width / 2,
|
|
6498
|
+
y: t.y + t.height / 2
|
|
6499
|
+
}, a = {
|
|
6558
6500
|
x: n.x + n.width / 2,
|
|
6559
6501
|
y: n.y + n.height / 2
|
|
6560
|
-
}, a = {
|
|
6561
|
-
x: r.x + r.width / 2,
|
|
6562
|
-
y: r.y + r.height / 2
|
|
6563
6502
|
}, o, s;
|
|
6564
|
-
if (this.dotsMode ? (o = i, s = a) : (o = this.getEdgePoint(
|
|
6565
|
-
let c = this.dotsMode ? "#ffffff" : this.settings.connectionColor, l = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 +
|
|
6503
|
+
if (this.dotsMode ? (o = i, s = a) : (o = this.getEdgePoint(t, a), s = this.getEdgePoint(n, i)), !isFinite(o.x) || !isFinite(o.y) || !isFinite(s.x) || !isFinite(s.y)) continue;
|
|
6504
|
+
let c = this.dotsMode ? "#ffffff" : this.settings.connectionColor, l = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), u = new r.Line({
|
|
6566
6505
|
points: [
|
|
6567
6506
|
o.x,
|
|
6568
6507
|
o.y,
|
|
@@ -6591,85 +6530,85 @@ var Qr = class {
|
|
|
6591
6530
|
}
|
|
6592
6531
|
drawAreas() {
|
|
6593
6532
|
this.areaLayer.destroyChildren();
|
|
6594
|
-
for (let [,
|
|
6595
|
-
if (!isFinite(
|
|
6596
|
-
let
|
|
6533
|
+
for (let [, e] of this.areaNodes) {
|
|
6534
|
+
if (!isFinite(e.x) || !isFinite(e.y)) continue;
|
|
6535
|
+
let t = e.areaId === this.highlightedArea;
|
|
6597
6536
|
if (this.dotsMode) {
|
|
6598
|
-
let
|
|
6599
|
-
x:
|
|
6537
|
+
let n = e.x + e.width / 2, i = e.y + e.height / 2, a = new r.Group({
|
|
6538
|
+
x: n,
|
|
6600
6539
|
y: i,
|
|
6601
6540
|
draggable: !0
|
|
6602
|
-
}), o = new
|
|
6541
|
+
}), o = new r.Circle({
|
|
6603
6542
|
radius: 6,
|
|
6604
|
-
fill:
|
|
6605
|
-
stroke:
|
|
6543
|
+
fill: t ? this.settings.highlightColor : "#ffffff",
|
|
6544
|
+
stroke: t ? this.settings.highlightColor : "#ffffff",
|
|
6606
6545
|
strokeWidth: 1
|
|
6607
|
-
}), s = new
|
|
6608
|
-
text:
|
|
6546
|
+
}), s = new r.Text({
|
|
6547
|
+
text: e.name,
|
|
6609
6548
|
fontSize: 10,
|
|
6610
6549
|
fill: "#ffffff",
|
|
6611
6550
|
x: 10,
|
|
6612
6551
|
y: -5
|
|
6613
6552
|
});
|
|
6614
6553
|
a.add(o), a.add(s), a.on("click tap", () => {
|
|
6615
|
-
this.emitAreaClickEvent(
|
|
6554
|
+
this.emitAreaClickEvent(e.areaId);
|
|
6616
6555
|
}), a.on("mouseenter", () => {
|
|
6617
6556
|
this.stage.container().style.cursor = "pointer", o.fill(this.settings.highlightColor), o.stroke(this.settings.highlightColor), this.areaLayer.batchDraw();
|
|
6618
6557
|
}), a.on("mouseleave", () => {
|
|
6619
|
-
this.stage.container().style.cursor = "auto", o.fill(
|
|
6558
|
+
this.stage.container().style.cursor = "auto", o.fill(t ? this.settings.highlightColor : "#ffffff"), o.stroke(t ? this.settings.highlightColor : "#ffffff"), this.areaLayer.batchDraw();
|
|
6620
6559
|
}), a.on("dragmove", () => {
|
|
6621
|
-
|
|
6560
|
+
e.x = a.x() - e.width / 2, e.y = a.y() - e.height / 2, this.drawConnections(), this.connectionLayer.batchDraw();
|
|
6622
6561
|
}), a.on("dragstart", () => {
|
|
6623
6562
|
this.stage.container().style.cursor = "grabbing";
|
|
6624
6563
|
}), a.on("dragend", () => {
|
|
6625
6564
|
this.stage.container().style.cursor = "pointer";
|
|
6626
6565
|
}), this.areaLayer.add(a);
|
|
6627
6566
|
} else {
|
|
6628
|
-
let
|
|
6629
|
-
x:
|
|
6630
|
-
y:
|
|
6567
|
+
let n = new r.Group({
|
|
6568
|
+
x: e.x,
|
|
6569
|
+
y: e.y,
|
|
6631
6570
|
draggable: !0
|
|
6632
|
-
}), i = new
|
|
6633
|
-
width:
|
|
6634
|
-
height:
|
|
6571
|
+
}), i = new r.Rect({
|
|
6572
|
+
width: e.width,
|
|
6573
|
+
height: e.height,
|
|
6635
6574
|
fill: this.settings.areaFillColor,
|
|
6636
|
-
stroke:
|
|
6637
|
-
strokeWidth:
|
|
6575
|
+
stroke: t ? this.settings.highlightColor : this.settings.areaStrokeColor,
|
|
6576
|
+
strokeWidth: t ? 3 : 2,
|
|
6638
6577
|
cornerRadius: 8
|
|
6639
|
-
}), a = new
|
|
6640
|
-
text:
|
|
6578
|
+
}), a = new r.Text({
|
|
6579
|
+
text: e.name,
|
|
6641
6580
|
fontSize: this.settings.fontSize,
|
|
6642
6581
|
fill: this.settings.textColor,
|
|
6643
|
-
width:
|
|
6644
|
-
height:
|
|
6582
|
+
width: e.width - 10,
|
|
6583
|
+
height: e.height - 20,
|
|
6645
6584
|
x: 5,
|
|
6646
6585
|
y: 10,
|
|
6647
6586
|
align: "center",
|
|
6648
6587
|
verticalAlign: "middle",
|
|
6649
6588
|
ellipsis: !0,
|
|
6650
6589
|
wrap: "word"
|
|
6651
|
-
}), o = new
|
|
6652
|
-
text: `${
|
|
6590
|
+
}), o = new r.Text({
|
|
6591
|
+
text: `${e.roomCount} rooms`,
|
|
6653
6592
|
fontSize: 10,
|
|
6654
6593
|
fill: this.settings.connectionColor,
|
|
6655
|
-
width:
|
|
6594
|
+
width: e.width - 10,
|
|
6656
6595
|
x: 5,
|
|
6657
|
-
y:
|
|
6596
|
+
y: e.height - 18,
|
|
6658
6597
|
align: "center"
|
|
6659
6598
|
});
|
|
6660
|
-
|
|
6661
|
-
this.emitAreaClickEvent(
|
|
6662
|
-
}),
|
|
6599
|
+
n.add(i), n.add(a), n.add(o), n.on("click tap", () => {
|
|
6600
|
+
this.emitAreaClickEvent(e.areaId);
|
|
6601
|
+
}), n.on("mouseenter", () => {
|
|
6663
6602
|
this.stage.container().style.cursor = "pointer", i.stroke(this.settings.highlightColor), this.areaLayer.batchDraw();
|
|
6664
|
-
}),
|
|
6665
|
-
this.stage.container().style.cursor = "auto", i.stroke(
|
|
6666
|
-
}),
|
|
6667
|
-
|
|
6668
|
-
}),
|
|
6603
|
+
}), n.on("mouseleave", () => {
|
|
6604
|
+
this.stage.container().style.cursor = "auto", i.stroke(t ? this.settings.highlightColor : this.settings.areaStrokeColor), this.areaLayer.batchDraw();
|
|
6605
|
+
}), n.on("dragmove", () => {
|
|
6606
|
+
e.x = n.x(), e.y = n.y(), this.drawConnections(), this.connectionLayer.batchDraw();
|
|
6607
|
+
}), n.on("dragstart", () => {
|
|
6669
6608
|
this.stage.container().style.cursor = "grabbing";
|
|
6670
|
-
}),
|
|
6609
|
+
}), n.on("dragend", () => {
|
|
6671
6610
|
this.stage.container().style.cursor = "pointer";
|
|
6672
|
-
}), this.areaLayer.add(
|
|
6611
|
+
}), this.areaLayer.add(n);
|
|
6673
6612
|
}
|
|
6674
6613
|
}
|
|
6675
6614
|
}
|
|
@@ -6712,6 +6651,6 @@ var Qr = class {
|
|
|
6712
6651
|
}
|
|
6713
6652
|
};
|
|
6714
6653
|
//#endregion
|
|
6715
|
-
export {
|
|
6654
|
+
export { C as ALL_VISIBLE, Pr as AmbientLightOverlay, e as Area, ti as AreaMapRenderer, Xn as Blueprint, D as Camera, Er as CanvasExporter, er as Construction, ee as CullingManager, We as DrawCommandLayerNode, Qr as ExplorationLens, mt as HitTester, O as IDENTITY_TRANSFORM, $n as Isometric, Hr as MapGraph, n as MapReader, nr as MapRenderer, T as MapState, Ge as MaterializingLayerNode, Zn as Neon, Yn as Parchment, Jr as PathFinder, t as Plane, wr as PngBlobExporter, Dr as PngBytesExporter, Cr as PngExporter, Ue as RecordingGroupNode, B as RecordingLayerNode, tr as SciFi, Qn as Sketchy, Sr as SvgExporter, G as applyStyleToShapes, ir as buildDrawCommands, Tr as canvasToBytes, _ as colorLightness, wt as compose, Zr as composeLenses, it as computePathData, ei as createAreaMapSettings, g as createSettings, v as darkenColor, w as defaultExitTreatment, x as hexToRgba, W as identityStyle, mr as renderToCanvas, Ke as shapeToRecording, ur as svgFromBatches };
|
|
6716
6655
|
|
|
6717
6656
|
//# sourceMappingURL=index.mjs.map
|