mudlet-map-renderer 2.0.0 → 2.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/dist/MapState.d.ts +6 -1
- package/dist/SvgTypes.d.ts +1 -1
- package/dist/export/CanvasExporter.d.ts +1 -1
- package/dist/index.mjs +735 -645
- package/dist/index.mjs.map +1 -1
- package/dist/rendering/KonvaRenderBackend.d.ts +1 -1
- package/dist/rendering/MapRenderer.d.ts +6 -1
- package/dist/scene/OverlayStyle.d.ts +7 -3
- package/dist/scene/Shape.d.ts +7 -0
- package/dist/scene/elements/OverlayLayout.d.ts +3 -0
- package/dist/types/Settings.d.ts +11 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -43,7 +43,8 @@ function g() {
|
|
|
43
43
|
sizeFactor: 1.425,
|
|
44
44
|
dash: [.05, .05],
|
|
45
45
|
dashEnabled: !0,
|
|
46
|
-
matchRoomShape: !0
|
|
46
|
+
matchRoomShape: !0,
|
|
47
|
+
shape: "match"
|
|
47
48
|
},
|
|
48
49
|
gridEnabled: !1,
|
|
49
50
|
gridSize: 1,
|
|
@@ -318,18 +319,23 @@ var T = class {
|
|
|
318
319
|
}
|
|
319
320
|
addHighlight(e, t) {
|
|
320
321
|
let n = this.mapReader.getRoom(e);
|
|
321
|
-
|
|
322
|
-
|
|
322
|
+
if (!n) return !1;
|
|
323
|
+
let r = Array.isArray(t) ? t.length > 0 ? [...t] : ["#ffffff"] : [t];
|
|
324
|
+
return this.highlights.set(e, {
|
|
325
|
+
colors: r,
|
|
326
|
+
color: r[0],
|
|
323
327
|
area: n.area,
|
|
324
328
|
z: n.z
|
|
325
329
|
}), this.events.emit("highlight", {
|
|
326
330
|
roomId: e,
|
|
327
|
-
|
|
328
|
-
|
|
331
|
+
colors: r,
|
|
332
|
+
color: r[0]
|
|
333
|
+
}), !0;
|
|
329
334
|
}
|
|
330
335
|
removeHighlight(e) {
|
|
331
336
|
this.highlights.has(e) && (this.highlights.delete(e), this.events.emit("highlight", {
|
|
332
337
|
roomId: e,
|
|
338
|
+
colors: void 0,
|
|
333
339
|
color: void 0
|
|
334
340
|
}));
|
|
335
341
|
}
|
|
@@ -357,7 +363,7 @@ var T = class {
|
|
|
357
363
|
let n = [...e?.highlights ?? []];
|
|
358
364
|
for (let [e, t] of this.highlights) t.area === this.currentArea && t.z === this.currentZIndex && n.push({
|
|
359
365
|
roomId: e,
|
|
360
|
-
color: t.
|
|
366
|
+
color: t.colors
|
|
361
367
|
});
|
|
362
368
|
n.length > 0 && (t.highlights = n);
|
|
363
369
|
let r = [...e?.paths ?? []];
|
|
@@ -386,10 +392,10 @@ var T = class {
|
|
|
386
392
|
};
|
|
387
393
|
}
|
|
388
394
|
};
|
|
389
|
-
function
|
|
395
|
+
function E(e) {
|
|
390
396
|
return e < .5 ? 2 * e * e : -1 + (4 - 2 * e) * e;
|
|
391
397
|
}
|
|
392
|
-
var
|
|
398
|
+
var D = class e extends S {
|
|
393
399
|
constructor(e, t) {
|
|
394
400
|
super(), this.zoom = 1, this.minZoom = .05, this.position = {
|
|
395
401
|
x: 0,
|
|
@@ -541,7 +547,7 @@ var E = class e extends S {
|
|
|
541
547
|
this.cancelAnimation();
|
|
542
548
|
let n = performance.now(), r = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(performance.now()), 16), i = (a) => {
|
|
543
549
|
let o = a - n, s = Math.min(o / e, 1);
|
|
544
|
-
t(
|
|
550
|
+
t(E(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
|
|
545
551
|
};
|
|
546
552
|
this.animationId = r(i);
|
|
547
553
|
}
|
|
@@ -566,12 +572,12 @@ var E = class e extends S {
|
|
|
566
572
|
}
|
|
567
573
|
this.emit("change", void 0);
|
|
568
574
|
}
|
|
569
|
-
},
|
|
575
|
+
}, O = (e, t) => ({
|
|
570
576
|
x: e,
|
|
571
577
|
y: t
|
|
572
|
-
}),
|
|
578
|
+
}), ee = class {
|
|
573
579
|
constructor(e, t) {
|
|
574
|
-
this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform =
|
|
580
|
+
this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform = O;
|
|
575
581
|
}
|
|
576
582
|
setCoordinateTransform(e) {
|
|
577
583
|
this.coordinateTransform = e;
|
|
@@ -590,7 +596,7 @@ var E = class e extends S {
|
|
|
590
596
|
updateCulling() {
|
|
591
597
|
this.onCullingNeeded();
|
|
592
598
|
}
|
|
593
|
-
},
|
|
599
|
+
}, k = [
|
|
594
600
|
"north",
|
|
595
601
|
"south",
|
|
596
602
|
"east",
|
|
@@ -599,7 +605,7 @@ var E = class e extends S {
|
|
|
599
605
|
"northwest",
|
|
600
606
|
"southeast",
|
|
601
607
|
"southwest"
|
|
602
|
-
],
|
|
608
|
+
], A = {
|
|
603
609
|
n: "north",
|
|
604
610
|
s: "south",
|
|
605
611
|
e: "east",
|
|
@@ -608,7 +614,7 @@ var E = class e extends S {
|
|
|
608
614
|
nw: "northwest",
|
|
609
615
|
se: "southeast",
|
|
610
616
|
sw: "southwest"
|
|
611
|
-
},
|
|
617
|
+
}, j = {
|
|
612
618
|
north: "n",
|
|
613
619
|
south: "s",
|
|
614
620
|
east: "e",
|
|
@@ -621,7 +627,7 @@ var E = class e extends S {
|
|
|
621
627
|
down: "d",
|
|
622
628
|
in: "i",
|
|
623
629
|
out: "o"
|
|
624
|
-
},
|
|
630
|
+
}, M = {
|
|
625
631
|
north: {
|
|
626
632
|
x: 0,
|
|
627
633
|
y: -1
|
|
@@ -654,7 +660,7 @@ var E = class e extends S {
|
|
|
654
660
|
x: -1,
|
|
655
661
|
y: 1
|
|
656
662
|
}
|
|
657
|
-
},
|
|
663
|
+
}, te = [
|
|
658
664
|
"north",
|
|
659
665
|
"south",
|
|
660
666
|
"east",
|
|
@@ -663,7 +669,7 @@ var E = class e extends S {
|
|
|
663
669
|
"northwest",
|
|
664
670
|
"southeast",
|
|
665
671
|
"southwest"
|
|
666
|
-
],
|
|
672
|
+
], N = {
|
|
667
673
|
north: "south",
|
|
668
674
|
south: "north",
|
|
669
675
|
east: "west",
|
|
@@ -673,39 +679,39 @@ var E = class e extends S {
|
|
|
673
679
|
southeast: "northwest",
|
|
674
680
|
southwest: "northeast"
|
|
675
681
|
};
|
|
676
|
-
function
|
|
677
|
-
return e ? Object.prototype.hasOwnProperty.call(
|
|
682
|
+
function P(e) {
|
|
683
|
+
return e ? Object.prototype.hasOwnProperty.call(M, e) : !1;
|
|
678
684
|
}
|
|
679
|
-
function
|
|
680
|
-
if (!
|
|
685
|
+
function F(e, t, n, r = 1) {
|
|
686
|
+
if (!P(n)) return {
|
|
681
687
|
x: e,
|
|
682
688
|
y: t
|
|
683
689
|
};
|
|
684
|
-
let i =
|
|
690
|
+
let i = M[n];
|
|
685
691
|
return {
|
|
686
692
|
x: e + i.x * r,
|
|
687
693
|
y: t + i.y * r
|
|
688
694
|
};
|
|
689
695
|
}
|
|
690
|
-
function
|
|
691
|
-
if (!
|
|
696
|
+
function ne(e, t, n, r = 1, i = 0) {
|
|
697
|
+
if (!P(n)) return {
|
|
692
698
|
x: e,
|
|
693
699
|
y: t
|
|
694
700
|
};
|
|
695
|
-
let a =
|
|
696
|
-
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return
|
|
701
|
+
let a = M[n];
|
|
702
|
+
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return F(e, t, n, r);
|
|
697
703
|
let o = r - i + i / Math.SQRT2;
|
|
698
704
|
return {
|
|
699
705
|
x: e + a.x * o,
|
|
700
706
|
y: t + a.y * o
|
|
701
707
|
};
|
|
702
708
|
}
|
|
703
|
-
function
|
|
704
|
-
if (!
|
|
709
|
+
function re(e, t, n, r = 1) {
|
|
710
|
+
if (!P(n)) return {
|
|
705
711
|
x: e,
|
|
706
712
|
y: t
|
|
707
713
|
};
|
|
708
|
-
let i =
|
|
714
|
+
let i = M[n], a = Math.atan2(i.y, i.x);
|
|
709
715
|
return {
|
|
710
716
|
x: e + Math.cos(a) * r,
|
|
711
717
|
y: t + Math.sin(a) * r
|
|
@@ -713,32 +719,32 @@ function ie(e, t, n, r = 1) {
|
|
|
713
719
|
}
|
|
714
720
|
//#endregion
|
|
715
721
|
//#region src/ExitRenderer.ts
|
|
716
|
-
var
|
|
722
|
+
var ie = {
|
|
717
723
|
OPEN_DOOR: "rgb(10, 155, 10)",
|
|
718
724
|
CLOSED_DOOR: "rgb(226, 205, 59)",
|
|
719
725
|
LOCKED_DOOR: "rgb(155, 10, 10)",
|
|
720
726
|
ONE_WAY_FILL: "rgb(155, 10, 10)"
|
|
721
727
|
};
|
|
722
|
-
function
|
|
728
|
+
function ae(e) {
|
|
723
729
|
switch (e) {
|
|
724
|
-
case 1: return
|
|
725
|
-
case 2: return
|
|
726
|
-
default: return
|
|
730
|
+
case 1: return ie.OPEN_DOOR;
|
|
731
|
+
case 2: return ie.CLOSED_DOOR;
|
|
732
|
+
default: return ie.LOCKED_DOOR;
|
|
727
733
|
}
|
|
728
734
|
}
|
|
729
|
-
var
|
|
735
|
+
var oe = class {
|
|
730
736
|
constructor(e, t) {
|
|
731
737
|
this.mapReader = e, this.settings = t;
|
|
732
738
|
}
|
|
733
739
|
getRoomEdgePoint(e, t, n, r) {
|
|
734
740
|
let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
|
|
735
|
-
return this.settings.roomShape === "circle" ?
|
|
741
|
+
return this.settings.roomShape === "circle" ? re(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? ne(e, t, n, i, this.settings.roomSize * .2) : F(e, t, n, i);
|
|
736
742
|
}
|
|
737
743
|
renderData(e, t) {
|
|
738
744
|
return this.renderDataWithColor(e, this.settings.lineColor, t);
|
|
739
745
|
}
|
|
740
746
|
renderDataWithColor(e, t, n) {
|
|
741
|
-
let r = e.aDir &&
|
|
747
|
+
let r = e.aDir && k.includes(e.aDir), i = e.bDir && k.includes(e.bDir);
|
|
742
748
|
if (r && i) return this.renderTwoWayExitData(e, t, n);
|
|
743
749
|
if (r || i) {
|
|
744
750
|
let n = r ? "a" : "b";
|
|
@@ -747,7 +753,7 @@ var se = class {
|
|
|
747
753
|
}
|
|
748
754
|
renderTwoWayExitData(e, t, n) {
|
|
749
755
|
let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
|
|
750
|
-
if (!r || !i || !e.aDir || !e.bDir || r.customLines[
|
|
756
|
+
if (!r || !i || !e.aDir || !e.bDir || r.customLines[j[e.aDir]] && i.customLines[j[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[j[e.aDir]] || n !== r.z && i.customLines[j[e.bDir]])) return;
|
|
751
757
|
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 = [
|
|
752
758
|
a.x,
|
|
753
759
|
a.y,
|
|
@@ -757,7 +763,7 @@ var se = class {
|
|
|
757
763
|
points: s,
|
|
758
764
|
stroke: t,
|
|
759
765
|
strokeWidth: this.settings.lineWidth
|
|
760
|
-
}], l = [], u = r.doors[
|
|
766
|
+
}], l = [], u = r.doors[j[e.aDir]] ?? i.doors[j[e.bDir]];
|
|
761
767
|
if (u) {
|
|
762
768
|
let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
|
|
763
769
|
l.push({
|
|
@@ -765,7 +771,7 @@ var se = class {
|
|
|
765
771
|
y: t - this.settings.roomSize / 4,
|
|
766
772
|
width: this.settings.roomSize / 2,
|
|
767
773
|
height: this.settings.roomSize / 2,
|
|
768
|
-
stroke:
|
|
774
|
+
stroke: ae(u),
|
|
769
775
|
strokeWidth: this.settings.lineWidth
|
|
770
776
|
});
|
|
771
777
|
}
|
|
@@ -796,9 +802,9 @@ var se = class {
|
|
|
796
802
|
}
|
|
797
803
|
renderOneWayExitData(e, t, n) {
|
|
798
804
|
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;
|
|
799
|
-
if (!o || !i || !a || !
|
|
805
|
+
if (!o || !i || !a || !k.includes(o) || i.customLines[j[o] || o]) return;
|
|
800
806
|
if (i.area != a.area && o) {
|
|
801
|
-
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n =
|
|
807
|
+
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = F(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
|
|
802
808
|
return {
|
|
803
809
|
lines: [],
|
|
804
810
|
arrows: [{
|
|
@@ -837,8 +843,8 @@ var se = class {
|
|
|
837
843
|
x: a.x,
|
|
838
844
|
y: a.y
|
|
839
845
|
};
|
|
840
|
-
s && (c =
|
|
841
|
-
let l =
|
|
846
|
+
s && (c = F(i.x, i.y, o, this.settings.roomSize / 2));
|
|
847
|
+
let l = F(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 = [
|
|
842
848
|
f.x,
|
|
843
849
|
f.y,
|
|
844
850
|
c.x,
|
|
@@ -870,7 +876,7 @@ var se = class {
|
|
|
870
876
|
pointerWidth: .35,
|
|
871
877
|
strokeWidth: this.settings.lineWidth * 1.4,
|
|
872
878
|
stroke: t,
|
|
873
|
-
fill:
|
|
879
|
+
fill: ie.ONE_WAY_FILL,
|
|
874
880
|
dash: [.1, .05]
|
|
875
881
|
}],
|
|
876
882
|
doors: [],
|
|
@@ -925,7 +931,7 @@ var se = class {
|
|
|
925
931
|
for (let [r, i] of Object.entries(e.customLines)) {
|
|
926
932
|
let a = e.specialExits[r];
|
|
927
933
|
if (a === void 0) {
|
|
928
|
-
let t =
|
|
934
|
+
let t = A[r] ?? n[r];
|
|
929
935
|
t && (a = e.exits[t] ?? e.specialExits[t]);
|
|
930
936
|
}
|
|
931
937
|
if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
|
|
@@ -957,7 +963,7 @@ var se = class {
|
|
|
957
963
|
}
|
|
958
964
|
return t;
|
|
959
965
|
}
|
|
960
|
-
},
|
|
966
|
+
}, se = {
|
|
961
967
|
1: "north",
|
|
962
968
|
2: "northeast",
|
|
963
969
|
3: "northwest",
|
|
@@ -971,15 +977,15 @@ var se = class {
|
|
|
971
977
|
11: "in",
|
|
972
978
|
12: "out"
|
|
973
979
|
};
|
|
974
|
-
function
|
|
975
|
-
return e.roomShape === "circle" ?
|
|
980
|
+
function ce(e, t, n, r, i) {
|
|
981
|
+
return e.roomShape === "circle" ? re(t, n, r, i) : e.roomShape === "roundedRectangle" ? ne(t, n, r, i, e.roomSize * .2) : F(t, n, r, i);
|
|
976
982
|
}
|
|
977
|
-
function
|
|
983
|
+
function le(e, t, n) {
|
|
978
984
|
let r = [];
|
|
979
985
|
for (let i of e.stubs) {
|
|
980
|
-
let a =
|
|
986
|
+
let a = se[i];
|
|
981
987
|
if (!a) continue;
|
|
982
|
-
let o =
|
|
988
|
+
let o = ce(t, e.x, e.y, a, t.roomSize / 2), s = F(e.x, e.y, a, t.roomSize / 2 + .5);
|
|
983
989
|
r.push({
|
|
984
990
|
roomId: e.id,
|
|
985
991
|
direction: a,
|
|
@@ -995,12 +1001,12 @@ function ue(e, t, n) {
|
|
|
995
1001
|
}
|
|
996
1002
|
//#endregion
|
|
997
1003
|
//#region src/scene/SpecialExitStyle.ts
|
|
998
|
-
var
|
|
1004
|
+
var ue = {
|
|
999
1005
|
1: "rgb(10, 155, 10)",
|
|
1000
1006
|
2: "rgb(226, 205, 59)",
|
|
1001
1007
|
3: "rgb(155, 10, 10)"
|
|
1002
1008
|
};
|
|
1003
|
-
function
|
|
1009
|
+
function de(e, t, n) {
|
|
1004
1010
|
let r = [];
|
|
1005
1011
|
for (let [i, a] of Object.entries(e.customLines)) {
|
|
1006
1012
|
let o = [e.x, e.y];
|
|
@@ -1047,7 +1053,7 @@ function fe(e, t, n) {
|
|
|
1047
1053
|
y: n - r / 2,
|
|
1048
1054
|
width: r,
|
|
1049
1055
|
height: r,
|
|
1050
|
-
stroke:
|
|
1056
|
+
stroke: ue[f] ?? ue[3],
|
|
1051
1057
|
strokeWidth: t.lineWidth
|
|
1052
1058
|
};
|
|
1053
1059
|
}
|
|
@@ -1062,33 +1068,33 @@ function fe(e, t, n) {
|
|
|
1062
1068
|
}
|
|
1063
1069
|
//#endregion
|
|
1064
1070
|
//#region src/utils/textMeasure.ts
|
|
1065
|
-
var
|
|
1066
|
-
function
|
|
1067
|
-
return
|
|
1071
|
+
var fe = 72, I = 200, pe = 120, me = /* @__PURE__ */ new Map(), L = null;
|
|
1072
|
+
function he() {
|
|
1073
|
+
return L || (L = r.Util.createCanvasElement(), L.width = I, L.height = I), L;
|
|
1068
1074
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let n = `${e}::${t}`, r =
|
|
1075
|
+
function ge(e, t) {
|
|
1076
|
+
let n = `${e}::${t}`, r = me.get(n);
|
|
1071
1077
|
if (r !== void 0) return r;
|
|
1072
|
-
let i =
|
|
1073
|
-
i.clearRect(0, 0,
|
|
1074
|
-
let { data: o } = i.getImageData(0, 0,
|
|
1075
|
-
for (let e = 0; e <
|
|
1078
|
+
let i = he().getContext("2d", { willReadFrequently: !0 }), a = `bold ${fe}px ${t}`;
|
|
1079
|
+
i.clearRect(0, 0, I, I), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, I / 2, pe);
|
|
1080
|
+
let { data: o } = i.getImageData(0, 0, I, I), s = I, c = -1;
|
|
1081
|
+
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));
|
|
1076
1082
|
if (c === -1) {
|
|
1077
1083
|
let e = {
|
|
1078
1084
|
baselineRatio: .35,
|
|
1079
1085
|
konvaCorrectionRatio: 0
|
|
1080
1086
|
};
|
|
1081
|
-
return
|
|
1087
|
+
return me.set(n, e), e;
|
|
1082
1088
|
}
|
|
1083
|
-
let l = (
|
|
1089
|
+
let l = (pe - s - Math.max(0, c - pe)) / 2 / fe, u = i.measureText("M"), d = {
|
|
1084
1090
|
baselineRatio: l,
|
|
1085
|
-
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 /
|
|
1091
|
+
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / fe - l
|
|
1086
1092
|
};
|
|
1087
|
-
return
|
|
1093
|
+
return me.set(n, d), d;
|
|
1088
1094
|
}
|
|
1089
1095
|
//#endregion
|
|
1090
1096
|
//#region src/scene/RoomStyle.ts
|
|
1091
|
-
function
|
|
1097
|
+
function _e(e, t, n, r) {
|
|
1092
1098
|
let i = t.getColorValue(e.env), a = n.coloredMode ? v(i, .5) : n.frameMode ? n.backgroundColor : i, o = n.coloredMode ? y(i, .1) : i;
|
|
1093
1099
|
return {
|
|
1094
1100
|
fillColor: a,
|
|
@@ -1098,7 +1104,7 @@ function ve(e, t, n, r) {
|
|
|
1098
1104
|
envColor: i
|
|
1099
1105
|
};
|
|
1100
1106
|
}
|
|
1101
|
-
function
|
|
1107
|
+
function ve(e, t) {
|
|
1102
1108
|
if (!t.emboss) return null;
|
|
1103
1109
|
let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a = y(e, .35), o = v(e, .45);
|
|
1104
1110
|
if (t.roomShape === "circle") {
|
|
@@ -1202,8 +1208,8 @@ function ye(e, t) {
|
|
|
1202
1208
|
}
|
|
1203
1209
|
//#endregion
|
|
1204
1210
|
//#region src/scene/elements/RoomLayout.ts
|
|
1205
|
-
function
|
|
1206
|
-
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } =
|
|
1211
|
+
function ye(e, t, n, r) {
|
|
1212
|
+
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;
|
|
1207
1213
|
if (f) {
|
|
1208
1214
|
let e = [v(a, .5), a], t = o * 2;
|
|
1209
1215
|
n.roomShape === "circle" ? l.push({
|
|
@@ -1287,7 +1293,7 @@ function be(e, t, n, r) {
|
|
|
1287
1293
|
lineCap: u.highlight.lineCap,
|
|
1288
1294
|
lineJoin: u.shadow.lineJoin
|
|
1289
1295
|
})), e.roomChar) {
|
|
1290
|
-
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } =
|
|
1296
|
+
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;
|
|
1291
1297
|
l.push({
|
|
1292
1298
|
type: "text",
|
|
1293
1299
|
x: -o,
|
|
@@ -1320,13 +1326,13 @@ function be(e, t, n, r) {
|
|
|
1320
1326
|
}
|
|
1321
1327
|
//#endregion
|
|
1322
1328
|
//#region src/scene/InnerExitStyle.ts
|
|
1323
|
-
var
|
|
1329
|
+
var be = [
|
|
1324
1330
|
"up",
|
|
1325
1331
|
"down",
|
|
1326
1332
|
"in",
|
|
1327
1333
|
"out"
|
|
1328
1334
|
];
|
|
1329
|
-
function
|
|
1335
|
+
function xe(e, t, n, r) {
|
|
1330
1336
|
let i = r * Math.PI / 180, a = [];
|
|
1331
1337
|
for (let r = 0; r < 3; r++) {
|
|
1332
1338
|
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);
|
|
@@ -1334,50 +1340,50 @@ function Se(e, t, n, r) {
|
|
|
1334
1340
|
}
|
|
1335
1341
|
return a;
|
|
1336
1342
|
}
|
|
1337
|
-
function
|
|
1343
|
+
function Se(e, t, n) {
|
|
1338
1344
|
let r = e.userData?.["system.fallback_symbol_color"];
|
|
1339
1345
|
return {
|
|
1340
1346
|
symbolColor: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env)),
|
|
1341
1347
|
symbolFill: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6))
|
|
1342
1348
|
};
|
|
1343
1349
|
}
|
|
1344
|
-
var
|
|
1350
|
+
var Ce = {
|
|
1345
1351
|
1: "rgb(10, 155, 10)",
|
|
1346
1352
|
2: "rgb(226, 205, 59)",
|
|
1347
1353
|
3: "rgb(155, 10, 10)"
|
|
1348
1354
|
};
|
|
1349
|
-
function
|
|
1355
|
+
function we(e, t, n) {
|
|
1350
1356
|
let r = n.roomSize, i = r / 5, a = (e, t, n) => ({
|
|
1351
1357
|
cx: e,
|
|
1352
1358
|
cy: t,
|
|
1353
|
-
vertices:
|
|
1359
|
+
vertices: xe(e, t, i, n)
|
|
1354
1360
|
});
|
|
1355
1361
|
switch (t) {
|
|
1356
1362
|
case "up": {
|
|
1357
|
-
let t =
|
|
1363
|
+
let t = F(e.x, e.y, "south", r / 4);
|
|
1358
1364
|
return [a(t.x, t.y, 0)];
|
|
1359
1365
|
}
|
|
1360
1366
|
case "down": {
|
|
1361
|
-
let t =
|
|
1367
|
+
let t = F(e.x, e.y, "north", r / 4);
|
|
1362
1368
|
return [a(t.x, t.y, 180)];
|
|
1363
1369
|
}
|
|
1364
1370
|
case "in": {
|
|
1365
|
-
let t =
|
|
1371
|
+
let t = F(e.x, e.y, "west", r / 4), n = F(e.x, e.y, "east", r / 4);
|
|
1366
1372
|
return [a(t.x, t.y, 90), a(n.x, n.y, -90)];
|
|
1367
1373
|
}
|
|
1368
1374
|
case "out": {
|
|
1369
|
-
let t =
|
|
1375
|
+
let t = F(e.x, e.y, "west", r / 4), n = F(e.x, e.y, "east", r / 4);
|
|
1370
1376
|
return [a(t.x, t.y, -90), a(n.x, n.y, 90)];
|
|
1371
1377
|
}
|
|
1372
1378
|
default: return [];
|
|
1373
1379
|
}
|
|
1374
1380
|
}
|
|
1375
|
-
function
|
|
1376
|
-
let r = [], { symbolColor: i, symbolFill: a } =
|
|
1377
|
-
for (let t of
|
|
1381
|
+
function Te(e, t, n) {
|
|
1382
|
+
let r = [], { symbolColor: i, symbolFill: a } = Se(e, t, n);
|
|
1383
|
+
for (let t of be) {
|
|
1378
1384
|
if (!e.exits[t]) continue;
|
|
1379
|
-
let o = e.doors[t], s = o === void 0 ? i :
|
|
1380
|
-
for (let i of
|
|
1385
|
+
let o = e.doors[t], s = o === void 0 ? i : Ce[o] ?? Ce[3];
|
|
1386
|
+
for (let i of we(e, t, n)) r.push({
|
|
1381
1387
|
cx: i.cx,
|
|
1382
1388
|
cy: i.cy,
|
|
1383
1389
|
vertices: i.vertices,
|
|
@@ -1390,8 +1396,8 @@ function Ee(e, t, n) {
|
|
|
1390
1396
|
}
|
|
1391
1397
|
//#endregion
|
|
1392
1398
|
//#region src/scene/elements/ExitLayout.ts
|
|
1393
|
-
function
|
|
1394
|
-
let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } =
|
|
1399
|
+
function Ee(e, t, n) {
|
|
1400
|
+
let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } = Te(e, t, n);
|
|
1395
1401
|
return o.map((e) => {
|
|
1396
1402
|
let t = Array(e.vertices.length);
|
|
1397
1403
|
for (let n = 0; n < e.vertices.length; n += 2) t[n] = e.vertices[n] - i, t[n + 1] = e.vertices[n + 1] - a;
|
|
@@ -1406,7 +1412,7 @@ function De(e, t, n) {
|
|
|
1406
1412
|
};
|
|
1407
1413
|
});
|
|
1408
1414
|
}
|
|
1409
|
-
function
|
|
1415
|
+
function De(e, t) {
|
|
1410
1416
|
let n = [];
|
|
1411
1417
|
for (let t of e.lines) n.push({
|
|
1412
1418
|
type: "line",
|
|
@@ -1417,7 +1423,7 @@ function Oe(e, t) {
|
|
|
1417
1423
|
dash: t.dash
|
|
1418
1424
|
}
|
|
1419
1425
|
});
|
|
1420
|
-
for (let t of e.arrows)
|
|
1426
|
+
for (let t of e.arrows) Oe(n, t);
|
|
1421
1427
|
for (let t of e.doors) n.push({
|
|
1422
1428
|
type: "rect",
|
|
1423
1429
|
x: t.x,
|
|
@@ -1438,7 +1444,7 @@ function Oe(e, t) {
|
|
|
1438
1444
|
children: n
|
|
1439
1445
|
};
|
|
1440
1446
|
}
|
|
1441
|
-
function
|
|
1447
|
+
function Oe(e, t) {
|
|
1442
1448
|
e.push({
|
|
1443
1449
|
type: "line",
|
|
1444
1450
|
points: t.points,
|
|
@@ -1468,7 +1474,7 @@ function ke(e, t) {
|
|
|
1468
1474
|
}
|
|
1469
1475
|
//#endregion
|
|
1470
1476
|
//#region src/scene/elements/SpecialExitLayout.ts
|
|
1471
|
-
function
|
|
1477
|
+
function ke(e, t) {
|
|
1472
1478
|
let n = [];
|
|
1473
1479
|
if (n.push({
|
|
1474
1480
|
type: "line",
|
|
@@ -1529,7 +1535,7 @@ function Ae(e, t) {
|
|
|
1529
1535
|
}
|
|
1530
1536
|
//#endregion
|
|
1531
1537
|
//#region src/scene/elements/StubLayout.ts
|
|
1532
|
-
function
|
|
1538
|
+
function Ae(e) {
|
|
1533
1539
|
return {
|
|
1534
1540
|
type: "group",
|
|
1535
1541
|
x: 0,
|
|
@@ -1557,11 +1563,11 @@ function je(e) {
|
|
|
1557
1563
|
}
|
|
1558
1564
|
//#endregion
|
|
1559
1565
|
//#region src/scene/elements/LabelLayout.ts
|
|
1560
|
-
function
|
|
1566
|
+
function je(e) {
|
|
1561
1567
|
let t = (e?.alpha ?? 255) / 255, n = (e) => Math.min(255, Math.max(0, e ?? 0));
|
|
1562
1568
|
return `rgba(${n(e?.r)}, ${n(e?.g)}, ${n(e?.b)}, ${t})`;
|
|
1563
1569
|
}
|
|
1564
|
-
function
|
|
1570
|
+
function Me(e, t) {
|
|
1565
1571
|
if (t.labelRenderMode === "none") return null;
|
|
1566
1572
|
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;
|
|
1567
1573
|
if (t.labelRenderMode === "image" && e.pixMap) return {
|
|
@@ -1590,7 +1596,7 @@ function Ne(e, t) {
|
|
|
1590
1596
|
y: c,
|
|
1591
1597
|
width: e.Width,
|
|
1592
1598
|
height: e.Height,
|
|
1593
|
-
paint: { fill:
|
|
1599
|
+
paint: { fill: je(e.BgColor) }
|
|
1594
1600
|
}), e.Text) {
|
|
1595
1601
|
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)));
|
|
1596
1602
|
l.push({
|
|
@@ -1601,7 +1607,7 @@ function Ne(e, t) {
|
|
|
1601
1607
|
height: e.Height,
|
|
1602
1608
|
text: e.Text,
|
|
1603
1609
|
fontSize: n,
|
|
1604
|
-
fill:
|
|
1610
|
+
fill: je(e.FgColor),
|
|
1605
1611
|
align: "center",
|
|
1606
1612
|
verticalAlign: "middle"
|
|
1607
1613
|
});
|
|
@@ -1621,11 +1627,11 @@ function Ne(e, t) {
|
|
|
1621
1627
|
}
|
|
1622
1628
|
//#endregion
|
|
1623
1629
|
//#region src/ScenePipeline.ts
|
|
1624
|
-
function
|
|
1625
|
-
let n =
|
|
1630
|
+
function Ne(e, t) {
|
|
1631
|
+
let n = Pe(e);
|
|
1626
1632
|
return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${t})` : e;
|
|
1627
1633
|
}
|
|
1628
|
-
function
|
|
1634
|
+
function Pe(e) {
|
|
1629
1635
|
let t = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
1630
1636
|
if (t) return {
|
|
1631
1637
|
r: +t[1],
|
|
@@ -1638,11 +1644,11 @@ function Fe(e) {
|
|
|
1638
1644
|
b: parseInt(e.slice(5, 7), 16)
|
|
1639
1645
|
};
|
|
1640
1646
|
}
|
|
1641
|
-
function
|
|
1642
|
-
let r =
|
|
1647
|
+
function Fe(e, t, n) {
|
|
1648
|
+
let r = Pe(e), i = Pe(t);
|
|
1643
1649
|
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))})`;
|
|
1644
1650
|
}
|
|
1645
|
-
function
|
|
1651
|
+
function Ie(e, t) {
|
|
1646
1652
|
let n = t * t, r = [];
|
|
1647
1653
|
outer: for (let t of e) {
|
|
1648
1654
|
for (let e of r) for (let r of e) {
|
|
@@ -1656,9 +1662,9 @@ function Le(e, t) {
|
|
|
1656
1662
|
}
|
|
1657
1663
|
return r;
|
|
1658
1664
|
}
|
|
1659
|
-
var
|
|
1665
|
+
var R = class {
|
|
1660
1666
|
constructor(e, t) {
|
|
1661
|
-
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new
|
|
1667
|
+
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);
|
|
1662
1668
|
}
|
|
1663
1669
|
buildScene(e, t, n, r = C) {
|
|
1664
1670
|
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.renderLabels(t.getLabels(), e.getAreaId());
|
|
@@ -1697,10 +1703,10 @@ var Re = class {
|
|
|
1697
1703
|
renderRooms(e, t) {
|
|
1698
1704
|
let n = /* @__PURE__ */ new Map(), r = [], i = [], a = [], o = [];
|
|
1699
1705
|
e.forEach((e) => {
|
|
1700
|
-
let t =
|
|
1701
|
-
t.children.push(...
|
|
1702
|
-
for (let t of
|
|
1703
|
-
let n =
|
|
1706
|
+
let t = ye(e, this.mapReader, this.settings, { flatPipeline: !0 });
|
|
1707
|
+
t.children.push(...Ee(e, this.mapReader, this.settings));
|
|
1708
|
+
for (let t of de(e, this.settings)) {
|
|
1709
|
+
let n = ke(t, e.id);
|
|
1704
1710
|
this.linkShapes.push(n);
|
|
1705
1711
|
let r = t.line.points, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
|
|
1706
1712
|
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]);
|
|
@@ -1745,8 +1751,8 @@ var Re = class {
|
|
|
1745
1751
|
arrowColor: e.arrowColor
|
|
1746
1752
|
});
|
|
1747
1753
|
});
|
|
1748
|
-
for (let t of
|
|
1749
|
-
let e =
|
|
1754
|
+
for (let t of le(e, this.settings)) {
|
|
1755
|
+
let e = Ae(t);
|
|
1750
1756
|
this.linkShapes.push(e), a.push({
|
|
1751
1757
|
roomId: t.roomId,
|
|
1752
1758
|
direction: t.direction,
|
|
@@ -1793,7 +1799,7 @@ var Re = class {
|
|
|
1793
1799
|
}
|
|
1794
1800
|
let l = this.exitRenderer.renderData(e, t);
|
|
1795
1801
|
if (!l) return;
|
|
1796
|
-
let u =
|
|
1802
|
+
let u = De(l, {
|
|
1797
1803
|
kind: "exit",
|
|
1798
1804
|
id: `${e.a}:${e.b}:${e.aDir ?? ""}:${e.bDir ?? ""}`,
|
|
1799
1805
|
payload: {
|
|
@@ -1833,8 +1839,8 @@ var Re = class {
|
|
|
1833
1839
|
let i = r.isVisible(t);
|
|
1834
1840
|
if (i === r.isVisible(n)) return;
|
|
1835
1841
|
let a = i ? t : n, o = i ? e.aDir : e.bDir;
|
|
1836
|
-
if (!o || !
|
|
1837
|
-
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l =
|
|
1842
|
+
if (!o || !k.includes(o) || a.customLines[j[o]]) return;
|
|
1843
|
+
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l = F(a.x, a.y, o, s / 2 + .5);
|
|
1838
1844
|
return {
|
|
1839
1845
|
roomId: a.id,
|
|
1840
1846
|
direction: o,
|
|
@@ -1847,7 +1853,7 @@ var Re = class {
|
|
|
1847
1853
|
};
|
|
1848
1854
|
}
|
|
1849
1855
|
emitLensStub(e) {
|
|
1850
|
-
let t =
|
|
1856
|
+
let t = Ae(e);
|
|
1851
1857
|
this.linkShapes.push(t), this.stubShapeRefs.push({
|
|
1852
1858
|
shape: t,
|
|
1853
1859
|
bounds: {
|
|
@@ -1859,14 +1865,14 @@ var Re = class {
|
|
|
1859
1865
|
});
|
|
1860
1866
|
}
|
|
1861
1867
|
getRoomEdgePoint(e, t, n, r) {
|
|
1862
|
-
return this.settings.roomShape === "circle" ?
|
|
1868
|
+
return this.settings.roomShape === "circle" ? re(e, t, n, r) : this.settings.roomShape === "roundedRectangle" ? ne(e, t, n, r, this.settings.roomSize * .2) : F(e, t, n, r);
|
|
1863
1869
|
}
|
|
1864
1870
|
buildExitShape(e) {
|
|
1865
|
-
return
|
|
1871
|
+
return De(e);
|
|
1866
1872
|
}
|
|
1867
1873
|
renderLabels(e, t) {
|
|
1868
1874
|
for (let n of e) {
|
|
1869
|
-
let e =
|
|
1875
|
+
let e = Me(n, this.settings);
|
|
1870
1876
|
e && (e.hit = {
|
|
1871
1877
|
kind: "label",
|
|
1872
1878
|
id: n.labelId,
|
|
@@ -1928,50 +1934,50 @@ var Re = class {
|
|
|
1928
1934
|
], x = (e, t, n) => {
|
|
1929
1935
|
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();
|
|
1930
1936
|
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);
|
|
1931
|
-
let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0,
|
|
1937
|
+
let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0, E = w > 0 ? p / w : 0, D = 0;
|
|
1932
1938
|
for (let t = 0; t < e.length; t++) for (let n = t + 1; n < e.length; n++) {
|
|
1933
1939
|
let r = e[t].tip.x - e[n].tip.x, i = e[t].tip.y - e[n].tip.y, a = Math.hypot(r, i);
|
|
1934
|
-
a >
|
|
1940
|
+
a > D && (D = a);
|
|
1935
1941
|
}
|
|
1936
|
-
let
|
|
1937
|
-
for (let [e, t] of S) t >
|
|
1938
|
-
let
|
|
1939
|
-
if (
|
|
1940
|
-
let e =
|
|
1941
|
-
|
|
1942
|
-
x:
|
|
1943
|
-
y:
|
|
1942
|
+
let O = D > 3, ee = w / C >= .4, k = n?.x ?? (O ? (m + _) / 2 : o / C), A = n?.y ?? (O ? (v + x) / 2 : d / C), j = "white", M = 0;
|
|
1943
|
+
for (let [e, t] of S) t > M && (j = e, M = t);
|
|
1944
|
+
let te = h.concat(g).concat(r), N = (e, t, n = 0) => .5 + n + Math.abs(e) * i / 2 + Math.abs(t) * a / 2, P = [];
|
|
1945
|
+
if (ee) {
|
|
1946
|
+
let e = N(T, E);
|
|
1947
|
+
P.push({
|
|
1948
|
+
x: k + T * e,
|
|
1949
|
+
y: A + E * e
|
|
1944
1950
|
});
|
|
1945
1951
|
}
|
|
1946
|
-
|
|
1947
|
-
x:
|
|
1948
|
-
y:
|
|
1952
|
+
P.push({
|
|
1953
|
+
x: k,
|
|
1954
|
+
y: A
|
|
1949
1955
|
});
|
|
1950
1956
|
for (let e of [
|
|
1951
1957
|
0,
|
|
1952
1958
|
.6,
|
|
1953
1959
|
1.4
|
|
1954
1960
|
]) for (let [t, n] of b) {
|
|
1955
|
-
let r =
|
|
1956
|
-
|
|
1957
|
-
x:
|
|
1958
|
-
y:
|
|
1961
|
+
let r = N(t, n, e);
|
|
1962
|
+
P.push({
|
|
1963
|
+
x: k + t * r,
|
|
1964
|
+
y: A + n * r
|
|
1959
1965
|
});
|
|
1960
1966
|
}
|
|
1961
|
-
for (let t of
|
|
1967
|
+
for (let t of P) {
|
|
1962
1968
|
let n = t.x - i / 2, r = t.y - a / 2;
|
|
1963
|
-
if (!y(n, r, i, a,
|
|
1969
|
+
if (!y(n, r, i, a, te)) return {
|
|
1964
1970
|
cluster: e,
|
|
1965
1971
|
boxX: n,
|
|
1966
1972
|
boxY: r,
|
|
1967
1973
|
boxW: i,
|
|
1968
1974
|
boxH: a,
|
|
1969
|
-
color:
|
|
1975
|
+
color: j
|
|
1970
1976
|
};
|
|
1971
1977
|
}
|
|
1972
1978
|
};
|
|
1973
1979
|
for (let [e, t] of a) {
|
|
1974
|
-
let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r =
|
|
1980
|
+
let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r = Ie(t, 10).map((e) => x(e, n)).filter((e) => e !== void 0), a = !0;
|
|
1975
1981
|
for (; a && r.length > 1;) {
|
|
1976
1982
|
a = !1;
|
|
1977
1983
|
outer: for (let e = 0; e < r.length; e++) for (let t = e + 1; t < r.length; t++) {
|
|
@@ -1997,7 +2003,7 @@ var Re = class {
|
|
|
1997
2003
|
}
|
|
1998
2004
|
}
|
|
1999
2005
|
for (let e of r) {
|
|
2000
|
-
let t =
|
|
2006
|
+
let t = Ne(e.color, f), r = _(Fe(e.color, this.settings.backgroundColor, f)) > .55 ? "#000" : "#fff", a = {
|
|
2001
2007
|
type: "group",
|
|
2002
2008
|
x: 0,
|
|
2003
2009
|
y: 0,
|
|
@@ -2073,7 +2079,7 @@ var Re = class {
|
|
|
2073
2079
|
};
|
|
2074
2080
|
//#endregion
|
|
2075
2081
|
//#region src/scene/elements/GridLayout.ts
|
|
2076
|
-
function
|
|
2082
|
+
function Le(e, t, n = {}) {
|
|
2077
2083
|
if (!t.gridEnabled) return [];
|
|
2078
2084
|
let r = n.inverseTransform ?? ((e, t) => ({
|
|
2079
2085
|
x: e,
|
|
@@ -2110,11 +2116,11 @@ function ze(e, t, n = {}) {
|
|
|
2110
2116
|
}
|
|
2111
2117
|
//#endregion
|
|
2112
2118
|
//#region src/export/clipSceneToViewport.ts
|
|
2113
|
-
function
|
|
2119
|
+
function Re(e, t, n, r) {
|
|
2114
2120
|
if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
|
|
2115
2121
|
let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
|
|
2116
2122
|
if (l) {
|
|
2117
|
-
let c =
|
|
2123
|
+
let c = ze(e, t, n, r, l);
|
|
2118
2124
|
return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
|
|
2119
2125
|
}
|
|
2120
2126
|
return n >= i && e <= a && r >= o && t <= s;
|
|
@@ -2127,7 +2133,7 @@ function Be(e, t, n, r) {
|
|
|
2127
2133
|
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));
|
|
2128
2134
|
return d;
|
|
2129
2135
|
}
|
|
2130
|
-
function
|
|
2136
|
+
function ze(e, t, n, r, i) {
|
|
2131
2137
|
let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
|
|
2132
2138
|
return {
|
|
2133
2139
|
minX: Math.min(a.x, o.x, s.x, c.x),
|
|
@@ -2136,13 +2142,13 @@ function Ve(e, t, n, r, i) {
|
|
|
2136
2142
|
maxY: Math.max(a.y, o.y, s.y, c.y)
|
|
2137
2143
|
};
|
|
2138
2144
|
}
|
|
2139
|
-
function
|
|
2140
|
-
let i =
|
|
2145
|
+
function Be(e, t, n, r) {
|
|
2146
|
+
let i = Le(t, n, { inverseTransform: r?.inverse });
|
|
2141
2147
|
if (!n.cullingEnabled) return {
|
|
2142
2148
|
...e.sceneShapes,
|
|
2143
2149
|
grid: i
|
|
2144
2150
|
};
|
|
2145
|
-
let a =
|
|
2151
|
+
let a = Re(e, t, n, r);
|
|
2146
2152
|
return {
|
|
2147
2153
|
grid: i,
|
|
2148
2154
|
link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
|
|
@@ -2152,14 +2158,14 @@ function He(e, t, n, r) {
|
|
|
2152
2158
|
}
|
|
2153
2159
|
//#endregion
|
|
2154
2160
|
//#region src/rendering/SceneManager.ts
|
|
2155
|
-
var
|
|
2161
|
+
var Ve = {
|
|
2156
2162
|
grid: [],
|
|
2157
2163
|
link: [],
|
|
2158
2164
|
room: [],
|
|
2159
2165
|
topLabel: []
|
|
2160
|
-
},
|
|
2166
|
+
}, He = class {
|
|
2161
2167
|
constructor(e, t, n) {
|
|
2162
|
-
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new
|
|
2168
|
+
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new R(n, t);
|
|
2163
2169
|
}
|
|
2164
2170
|
get exitRenderer() {
|
|
2165
2171
|
return this.pipeline.exitRenderer;
|
|
@@ -2192,23 +2198,23 @@ var Ue = {
|
|
|
2192
2198
|
this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
|
|
2193
2199
|
}
|
|
2194
2200
|
resetPipeline(e) {
|
|
2195
|
-
this.pipeline = new
|
|
2201
|
+
this.pipeline = new R(e, this.settings), this.reset();
|
|
2196
2202
|
}
|
|
2197
|
-
cullInteractive(e =
|
|
2203
|
+
cullInteractive(e = O) {
|
|
2198
2204
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
2199
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e ===
|
|
2200
|
-
return
|
|
2205
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === O ? void 0 : { forward: e };
|
|
2206
|
+
return Re(this.lastBuildResult, t, this.settings, n);
|
|
2201
2207
|
}
|
|
2202
|
-
cull(e =
|
|
2208
|
+
cull(e = O) {
|
|
2203
2209
|
if (!this.lastBuildResult) return {
|
|
2204
|
-
shapes:
|
|
2210
|
+
shapes: Ve,
|
|
2205
2211
|
stats: {
|
|
2206
2212
|
visibleRooms: 0,
|
|
2207
2213
|
totalRooms: 0,
|
|
2208
2214
|
visibleExits: 0
|
|
2209
2215
|
}
|
|
2210
2216
|
};
|
|
2211
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e ===
|
|
2217
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === O ? void 0 : { forward: e }, r = Be(this.lastBuildResult, t, this.settings, n);
|
|
2212
2218
|
return {
|
|
2213
2219
|
shapes: r,
|
|
2214
2220
|
stats: {
|
|
@@ -2218,7 +2224,7 @@ var Ue = {
|
|
|
2218
2224
|
}
|
|
2219
2225
|
};
|
|
2220
2226
|
}
|
|
2221
|
-
},
|
|
2227
|
+
}, Ue = class {
|
|
2222
2228
|
setCursor(e) {
|
|
2223
2229
|
this.container.dataset.editorCursor || (this.container.style.cursor = e);
|
|
2224
2230
|
}
|
|
@@ -2413,7 +2419,7 @@ var Ue = {
|
|
|
2413
2419
|
};
|
|
2414
2420
|
//#endregion
|
|
2415
2421
|
//#region src/render/canvasGradient.ts
|
|
2416
|
-
function
|
|
2422
|
+
function z(e, t) {
|
|
2417
2423
|
if (typeof t == "string") return t;
|
|
2418
2424
|
if (t.type === "linear") {
|
|
2419
2425
|
let n = e.createLinearGradient(t.x0, t.y0, t.x1, t.y1);
|
|
@@ -2426,13 +2432,13 @@ function L(e, t) {
|
|
|
2426
2432
|
}
|
|
2427
2433
|
//#endregion
|
|
2428
2434
|
//#region src/render/RecordingLayer.ts
|
|
2429
|
-
function
|
|
2435
|
+
function We(e, t) {
|
|
2430
2436
|
switch (t.type) {
|
|
2431
2437
|
case "rect":
|
|
2432
|
-
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 =
|
|
2438
|
+
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 = z(e, 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());
|
|
2433
2439
|
break;
|
|
2434
2440
|
case "circle":
|
|
2435
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle =
|
|
2441
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = z(e, 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());
|
|
2436
2442
|
break;
|
|
2437
2443
|
case "line": {
|
|
2438
2444
|
if (t.points.length < 4) break;
|
|
@@ -2446,7 +2452,7 @@ function Ke(e, t) {
|
|
|
2446
2452
|
if (t.vertices.length < 4) break;
|
|
2447
2453
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
2448
2454
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
2449
|
-
e.closePath(), t.fill && (e.fillStyle =
|
|
2455
|
+
e.closePath(), t.fill && (e.fillStyle = z(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
2450
2456
|
break;
|
|
2451
2457
|
case "text": {
|
|
2452
2458
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -2483,7 +2489,7 @@ function Ke(e, t) {
|
|
|
2483
2489
|
break;
|
|
2484
2490
|
}
|
|
2485
2491
|
}
|
|
2486
|
-
var
|
|
2492
|
+
var Ge = class {
|
|
2487
2493
|
constructor(e, t) {
|
|
2488
2494
|
this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
|
|
2489
2495
|
}
|
|
@@ -2524,11 +2530,11 @@ var qe = class {
|
|
|
2524
2530
|
perfectDrawEnabled: !1,
|
|
2525
2531
|
sceneFunc: (e) => {
|
|
2526
2532
|
let n = e._context;
|
|
2527
|
-
for (let e of t)
|
|
2533
|
+
for (let e of t) We(n, e);
|
|
2528
2534
|
}
|
|
2529
2535
|
})), this._konvaGroup = e, e;
|
|
2530
2536
|
}
|
|
2531
|
-
},
|
|
2537
|
+
}, Ke = class {
|
|
2532
2538
|
constructor(e) {
|
|
2533
2539
|
this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
|
|
2534
2540
|
let t = this;
|
|
@@ -2541,7 +2547,7 @@ var qe = class {
|
|
|
2541
2547
|
if (!e.visible) continue;
|
|
2542
2548
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
2543
2549
|
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
2544
|
-
for (let t of e.commands)
|
|
2550
|
+
for (let t of e.commands) We(n, t);
|
|
2545
2551
|
}
|
|
2546
2552
|
n.setTransform(r);
|
|
2547
2553
|
}
|
|
@@ -2569,7 +2575,7 @@ var qe = class {
|
|
|
2569
2575
|
ensureShape() {
|
|
2570
2576
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2571
2577
|
}
|
|
2572
|
-
},
|
|
2578
|
+
}, B = class {
|
|
2573
2579
|
constructor(e) {
|
|
2574
2580
|
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
2575
2581
|
let t = this;
|
|
@@ -2582,7 +2588,7 @@ var qe = class {
|
|
|
2582
2588
|
if (!e._visible) continue;
|
|
2583
2589
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
2584
2590
|
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
2585
|
-
for (let t of e.commands)
|
|
2591
|
+
for (let t of e.commands) We(n, t);
|
|
2586
2592
|
}
|
|
2587
2593
|
n.setTransform(r);
|
|
2588
2594
|
}
|
|
@@ -2600,7 +2606,7 @@ var qe = class {
|
|
|
2600
2606
|
ensureShape() {
|
|
2601
2607
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2602
2608
|
}
|
|
2603
|
-
},
|
|
2609
|
+
}, qe = class {
|
|
2604
2610
|
constructor(e) {
|
|
2605
2611
|
this.konvaLayer = e;
|
|
2606
2612
|
}
|
|
@@ -2616,11 +2622,14 @@ var qe = class {
|
|
|
2616
2622
|
};
|
|
2617
2623
|
//#endregion
|
|
2618
2624
|
//#region src/scene/Shape.ts
|
|
2619
|
-
function
|
|
2625
|
+
function Je(e) {
|
|
2620
2626
|
return typeof e == "object" && !!e;
|
|
2621
2627
|
}
|
|
2622
|
-
function
|
|
2623
|
-
return
|
|
2628
|
+
function Ye(e, t) {
|
|
2629
|
+
return t !== !1 && e ? e : void 0;
|
|
2630
|
+
}
|
|
2631
|
+
function V(e, t, n, r, i, a) {
|
|
2632
|
+
return Je(e) ? e.type === "linear" ? {
|
|
2624
2633
|
type: "linear",
|
|
2625
2634
|
x0: (t + e.x0) * r + i,
|
|
2626
2635
|
y0: (n + e.y0) * r + a,
|
|
@@ -2640,14 +2649,14 @@ function z(e, t, n, r, i, a) {
|
|
|
2640
2649
|
}
|
|
2641
2650
|
//#endregion
|
|
2642
2651
|
//#region src/render/shapeToRecording.ts
|
|
2643
|
-
function
|
|
2644
|
-
let t = new
|
|
2645
|
-
return e.noScale && (t.noScaling = !0),
|
|
2652
|
+
function Xe(e) {
|
|
2653
|
+
let t = new Ge(e.x, e.y);
|
|
2654
|
+
return e.noScale && (t.noScaling = !0), Ze(t, e.children, 0, 0), t;
|
|
2646
2655
|
}
|
|
2647
|
-
function
|
|
2648
|
-
for (let i of t)
|
|
2656
|
+
function Ze(e, t, n, r) {
|
|
2657
|
+
for (let i of t) Qe(e, i, n, r);
|
|
2649
2658
|
}
|
|
2650
|
-
function
|
|
2659
|
+
function Qe(e, t, n, r) {
|
|
2651
2660
|
switch (t.type) {
|
|
2652
2661
|
case "rect":
|
|
2653
2662
|
e.commands.push({
|
|
@@ -2656,11 +2665,11 @@ function $e(e, t, n, r) {
|
|
|
2656
2665
|
y: t.y + r,
|
|
2657
2666
|
w: t.width,
|
|
2658
2667
|
h: t.height,
|
|
2659
|
-
fill:
|
|
2668
|
+
fill: V(t.paint.fill, n, r, 1, 0, 0),
|
|
2660
2669
|
stroke: t.paint.stroke,
|
|
2661
2670
|
sw: t.paint.strokeWidth ?? 0,
|
|
2662
2671
|
cr: t.cornerRadius ?? 0,
|
|
2663
|
-
dash: t.paint.
|
|
2672
|
+
dash: Ye(t.paint.dash, t.paint.dashEnabled)
|
|
2664
2673
|
});
|
|
2665
2674
|
return;
|
|
2666
2675
|
case "circle":
|
|
@@ -2669,20 +2678,20 @@ function $e(e, t, n, r) {
|
|
|
2669
2678
|
cx: t.cx + n,
|
|
2670
2679
|
cy: t.cy + r,
|
|
2671
2680
|
r: t.radius,
|
|
2672
|
-
fill:
|
|
2681
|
+
fill: V(t.paint.fill, n, r, 1, 0, 0),
|
|
2673
2682
|
stroke: t.paint.stroke,
|
|
2674
2683
|
sw: t.paint.strokeWidth ?? 0,
|
|
2675
|
-
dash: t.paint.
|
|
2684
|
+
dash: Ye(t.paint.dash, t.paint.dashEnabled)
|
|
2676
2685
|
});
|
|
2677
2686
|
return;
|
|
2678
2687
|
case "line": {
|
|
2679
|
-
let i = n === 0 && r === 0 ? t.points :
|
|
2688
|
+
let i = n === 0 && r === 0 ? t.points : $e(t.points, n, r);
|
|
2680
2689
|
e.commands.push({
|
|
2681
2690
|
type: "line",
|
|
2682
2691
|
points: i,
|
|
2683
2692
|
stroke: t.paint.stroke,
|
|
2684
2693
|
sw: t.paint.strokeWidth ?? 0,
|
|
2685
|
-
dash: t.paint.dash,
|
|
2694
|
+
dash: Ye(t.paint.dash, t.paint.dashEnabled),
|
|
2686
2695
|
lineCap: t.lineCap,
|
|
2687
2696
|
lineJoin: t.lineJoin,
|
|
2688
2697
|
alpha: t.paint.alpha
|
|
@@ -2692,8 +2701,8 @@ function $e(e, t, n, r) {
|
|
|
2692
2701
|
case "polygon":
|
|
2693
2702
|
e.commands.push({
|
|
2694
2703
|
type: "polygon",
|
|
2695
|
-
vertices: n === 0 && r === 0 ? t.vertices :
|
|
2696
|
-
fill:
|
|
2704
|
+
vertices: n === 0 && r === 0 ? t.vertices : $e(t.vertices, n, r),
|
|
2705
|
+
fill: V(t.paint.fill, n, r, 1, 0, 0),
|
|
2697
2706
|
stroke: t.paint.stroke,
|
|
2698
2707
|
sw: t.paint.strokeWidth ?? 0
|
|
2699
2708
|
});
|
|
@@ -2719,7 +2728,7 @@ function $e(e, t, n, r) {
|
|
|
2719
2728
|
});
|
|
2720
2729
|
return;
|
|
2721
2730
|
case "image": {
|
|
2722
|
-
let i =
|
|
2731
|
+
let i = et(t.src);
|
|
2723
2732
|
e.commands.push({
|
|
2724
2733
|
type: "image",
|
|
2725
2734
|
x: t.x + n,
|
|
@@ -2732,35 +2741,35 @@ function $e(e, t, n, r) {
|
|
|
2732
2741
|
return;
|
|
2733
2742
|
}
|
|
2734
2743
|
case "group":
|
|
2735
|
-
|
|
2744
|
+
Ze(e, t.children, n + t.x, r + t.y);
|
|
2736
2745
|
return;
|
|
2737
2746
|
}
|
|
2738
2747
|
}
|
|
2739
|
-
function
|
|
2748
|
+
function $e(e, t, n) {
|
|
2740
2749
|
let r = Array(e.length);
|
|
2741
2750
|
for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
|
|
2742
2751
|
return r;
|
|
2743
2752
|
}
|
|
2744
|
-
function
|
|
2753
|
+
function et(e) {
|
|
2745
2754
|
let t = r === void 0 ? typeof Image < "u" ? new Image() : null : r.Util.createImageElement();
|
|
2746
2755
|
return t && (t.src = e), t;
|
|
2747
2756
|
}
|
|
2748
2757
|
//#endregion
|
|
2749
2758
|
//#region src/PathData.ts
|
|
2750
|
-
var
|
|
2759
|
+
var H = [
|
|
2751
2760
|
"up",
|
|
2752
2761
|
"down",
|
|
2753
2762
|
"in",
|
|
2754
2763
|
"out"
|
|
2755
2764
|
];
|
|
2756
|
-
function
|
|
2757
|
-
return e.roomShape === "circle" ?
|
|
2765
|
+
function tt(e, t, n, r, i) {
|
|
2766
|
+
return e.roomShape === "circle" ? re(t, n, r, i) : e.roomShape === "roundedRectangle" ? ne(t, n, r, i, e.roomSize * .2) : F(t, n, r, i);
|
|
2758
2767
|
}
|
|
2759
2768
|
function nt(e, t, n) {
|
|
2760
2769
|
for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
|
|
2761
2770
|
let r = e;
|
|
2762
|
-
if (
|
|
2763
|
-
let e =
|
|
2771
|
+
if (H.includes(r)) {
|
|
2772
|
+
let e = j[r];
|
|
2764
2773
|
return {
|
|
2765
2774
|
type: "inner",
|
|
2766
2775
|
fromDir: r,
|
|
@@ -2769,7 +2778,7 @@ function nt(e, t, n) {
|
|
|
2769
2778
|
toRoom: n
|
|
2770
2779
|
};
|
|
2771
2780
|
}
|
|
2772
|
-
let i =
|
|
2781
|
+
let i = j[r];
|
|
2773
2782
|
return t.customLines[i] ? {
|
|
2774
2783
|
type: "special",
|
|
2775
2784
|
fromDir: r,
|
|
@@ -2802,8 +2811,8 @@ function nt(e, t, n) {
|
|
|
2802
2811
|
};
|
|
2803
2812
|
for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
|
|
2804
2813
|
let r = e;
|
|
2805
|
-
if (
|
|
2806
|
-
let e =
|
|
2814
|
+
if (H.includes(r)) {
|
|
2815
|
+
let e = j[r];
|
|
2807
2816
|
return {
|
|
2808
2817
|
type: "inner",
|
|
2809
2818
|
toDir: r,
|
|
@@ -2812,7 +2821,7 @@ function nt(e, t, n) {
|
|
|
2812
2821
|
toRoom: n
|
|
2813
2822
|
};
|
|
2814
2823
|
}
|
|
2815
|
-
let i =
|
|
2824
|
+
let i = j[r];
|
|
2816
2825
|
return n.customLines[i] ? {
|
|
2817
2826
|
type: "special",
|
|
2818
2827
|
toDir: r,
|
|
@@ -2859,17 +2868,17 @@ function at(e, t) {
|
|
|
2859
2868
|
for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
|
|
2860
2869
|
}
|
|
2861
2870
|
function ot(e, t) {
|
|
2862
|
-
for (let n of
|
|
2863
|
-
for (let n of
|
|
2871
|
+
for (let n of te) if (e.exits[n] === t.id) return n;
|
|
2872
|
+
for (let n of te) if (t.exits[n] === e.id) return N[n];
|
|
2864
2873
|
}
|
|
2865
2874
|
function st(e, t, n) {
|
|
2866
2875
|
let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
|
|
2867
|
-
if (n.length === 0 && n.push(r.x, r.y), a &&
|
|
2868
|
-
let t =
|
|
2876
|
+
if (n.length === 0 && n.push(r.x, r.y), a && k.includes(a)) {
|
|
2877
|
+
let t = tt(e, r.x, r.y, a, e.roomSize / 2);
|
|
2869
2878
|
n.push(t.x, t.y);
|
|
2870
2879
|
}
|
|
2871
|
-
if (o &&
|
|
2872
|
-
let t =
|
|
2880
|
+
if (o && k.includes(o)) {
|
|
2881
|
+
let t = tt(e, i.x, i.y, o, e.roomSize / 2);
|
|
2873
2882
|
n.push(t.x, t.y);
|
|
2874
2883
|
}
|
|
2875
2884
|
n.push(i.x, i.y);
|
|
@@ -2894,10 +2903,10 @@ function lt(e, t, n, r, i) {
|
|
|
2894
2903
|
}), s.push({ points: t });
|
|
2895
2904
|
}
|
|
2896
2905
|
}
|
|
2897
|
-
r &&
|
|
2906
|
+
r && H.includes(r) && o.push({
|
|
2898
2907
|
room: t,
|
|
2899
2908
|
direction: r
|
|
2900
|
-
}), i &&
|
|
2909
|
+
}), i && H.includes(i) && o.push({
|
|
2901
2910
|
room: n,
|
|
2902
2911
|
direction: i
|
|
2903
2912
|
});
|
|
@@ -2927,20 +2936,20 @@ function lt(e, t, n, r, i) {
|
|
|
2927
2936
|
} else {
|
|
2928
2937
|
let e = f ? a : s, n = f ? s : a, r = at(e, n);
|
|
2929
2938
|
if (r) {
|
|
2930
|
-
if (
|
|
2939
|
+
if (H.includes(r.direction)) u(), o.push({
|
|
2931
2940
|
room: e,
|
|
2932
2941
|
direction: r.direction
|
|
2933
2942
|
});
|
|
2934
|
-
else if (
|
|
2943
|
+
else if (k.includes(r.direction)) {
|
|
2935
2944
|
l.length === 0 && l.push(e.x, e.y);
|
|
2936
|
-
let n =
|
|
2945
|
+
let n = tt(t, e.x, e.y, r.direction, t.roomSize / 2), i = F(e.x, e.y, r.direction, t.roomSize);
|
|
2937
2946
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2938
2947
|
}
|
|
2939
2948
|
} else {
|
|
2940
2949
|
let r = ot(e, n);
|
|
2941
2950
|
if (r) {
|
|
2942
2951
|
l.length === 0 && l.push(e.x, e.y);
|
|
2943
|
-
let n =
|
|
2952
|
+
let n = tt(t, e.x, e.y, r, t.roomSize / 2), i = F(e.x, e.y, r, t.roomSize);
|
|
2944
2953
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2945
2954
|
}
|
|
2946
2955
|
}
|
|
@@ -2954,24 +2963,27 @@ function lt(e, t, n, r, i) {
|
|
|
2954
2963
|
}
|
|
2955
2964
|
//#endregion
|
|
2956
2965
|
//#region src/scene/OverlayStyle.ts
|
|
2957
|
-
function ut(e, t
|
|
2958
|
-
let
|
|
2966
|
+
function ut(e, t) {
|
|
2967
|
+
let n = e.shape ?? "match";
|
|
2968
|
+
return n === "match" ? (e.matchRoomShape ?? !0) && t !== "circle" ? t === "roundedRectangle" ? "roundedRectangle" : "rectangle" : "circle" : n;
|
|
2969
|
+
}
|
|
2970
|
+
function dt(e, t, n) {
|
|
2971
|
+
let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = ut(r, n.roomShape), s = Array.isArray(t) ? t.length > 0 ? [...t] : ["#ffffff"] : [t];
|
|
2959
2972
|
return {
|
|
2960
|
-
shape: o ? "
|
|
2973
|
+
shape: o === "circle" ? "circle" : "rect",
|
|
2961
2974
|
cx: e.x,
|
|
2962
2975
|
cy: e.y,
|
|
2963
2976
|
size: i / 2 * a,
|
|
2964
|
-
cornerRadius: o
|
|
2965
|
-
|
|
2977
|
+
cornerRadius: o === "roundedRectangle" ? i * a * .2 : 0,
|
|
2978
|
+
colors: s,
|
|
2966
2979
|
strokeAlpha: r.strokeAlpha,
|
|
2967
2980
|
strokeWidth: r.strokeWidth,
|
|
2968
|
-
fillColor: t,
|
|
2969
2981
|
fillAlpha: r.fillAlpha,
|
|
2970
2982
|
dash: r.dash,
|
|
2971
2983
|
dashEnabled: r.dashEnabled
|
|
2972
2984
|
};
|
|
2973
2985
|
}
|
|
2974
|
-
function
|
|
2986
|
+
function ft(e, t) {
|
|
2975
2987
|
let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
|
|
2976
2988
|
return {
|
|
2977
2989
|
shape: i ? "rect" : "circle",
|
|
@@ -2988,12 +3000,12 @@ function dt(e, t) {
|
|
|
2988
3000
|
dashEnabled: n.dashEnabled
|
|
2989
3001
|
};
|
|
2990
3002
|
}
|
|
2991
|
-
function
|
|
3003
|
+
function pt(e, t, n, r, i, a) {
|
|
2992
3004
|
let o = lt(e, t, n, i, a), s = t.lineWidth, c = [];
|
|
2993
3005
|
for (let e of o.segments) e.points.length >= 4 && c.push({ points: e.points });
|
|
2994
3006
|
for (let e of o.customLines) e.points.length >= 4 && c.push({ points: e.points });
|
|
2995
3007
|
let l = [];
|
|
2996
|
-
for (let e of o.innerMarkers) for (let n of
|
|
3008
|
+
for (let e of o.innerMarkers) for (let n of we(e.room, e.direction, t)) l.push({ vertices: n.vertices });
|
|
2997
3009
|
return {
|
|
2998
3010
|
segments: c,
|
|
2999
3011
|
triangles: l,
|
|
@@ -3004,63 +3016,80 @@ function ft(e, t, n, r, i, a) {
|
|
|
3004
3016
|
}
|
|
3005
3017
|
//#endregion
|
|
3006
3018
|
//#region src/scene/elements/OverlayLayout.ts
|
|
3007
|
-
function
|
|
3008
|
-
|
|
3019
|
+
function mt(e) {
|
|
3020
|
+
if (e.colors.length > 1) return ht(e);
|
|
3021
|
+
let t = e.colors[0], n = x(t, e.strokeAlpha), r = e.fillAlpha > 0 ? x(t, e.fillAlpha) : void 0;
|
|
3009
3022
|
if (e.shape === "circle") return {
|
|
3010
3023
|
type: "circle",
|
|
3011
3024
|
cx: e.cx,
|
|
3012
3025
|
cy: e.cy,
|
|
3013
3026
|
radius: e.size,
|
|
3014
3027
|
paint: {
|
|
3015
|
-
fill:
|
|
3016
|
-
stroke:
|
|
3028
|
+
fill: r,
|
|
3029
|
+
stroke: n,
|
|
3030
|
+
strokeWidth: e.strokeWidth,
|
|
3031
|
+
dash: e.dash,
|
|
3032
|
+
dashEnabled: e.dashEnabled
|
|
3033
|
+
},
|
|
3034
|
+
layer: "overlay"
|
|
3035
|
+
};
|
|
3036
|
+
if (e.cornerRadius > 0) return {
|
|
3037
|
+
type: "rect",
|
|
3038
|
+
x: e.cx - e.size,
|
|
3039
|
+
y: e.cy - e.size,
|
|
3040
|
+
width: e.size * 2,
|
|
3041
|
+
height: e.size * 2,
|
|
3042
|
+
cornerRadius: e.cornerRadius,
|
|
3043
|
+
paint: {
|
|
3044
|
+
fill: r,
|
|
3045
|
+
stroke: n,
|
|
3017
3046
|
strokeWidth: e.strokeWidth,
|
|
3018
3047
|
dash: e.dash,
|
|
3019
3048
|
dashEnabled: e.dashEnabled
|
|
3020
3049
|
},
|
|
3021
3050
|
layer: "overlay"
|
|
3022
3051
|
};
|
|
3023
|
-
let
|
|
3052
|
+
let i = e.cx - e.size, a = e.cy - e.size, o = e.cx + e.size, s = e.cy + e.size, c = [
|
|
3024
3053
|
[
|
|
3025
|
-
r,
|
|
3026
3054
|
i,
|
|
3027
3055
|
a,
|
|
3028
|
-
|
|
3056
|
+
o,
|
|
3057
|
+
a
|
|
3029
3058
|
],
|
|
3030
3059
|
[
|
|
3060
|
+
o,
|
|
3031
3061
|
a,
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
o
|
|
3062
|
+
o,
|
|
3063
|
+
s
|
|
3035
3064
|
],
|
|
3036
3065
|
[
|
|
3037
|
-
a,
|
|
3038
3066
|
o,
|
|
3039
|
-
|
|
3040
|
-
|
|
3067
|
+
s,
|
|
3068
|
+
i,
|
|
3069
|
+
s
|
|
3041
3070
|
],
|
|
3042
3071
|
[
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3072
|
+
i,
|
|
3073
|
+
s,
|
|
3074
|
+
i,
|
|
3075
|
+
a
|
|
3047
3076
|
]
|
|
3048
|
-
],
|
|
3049
|
-
|
|
3077
|
+
], l = [];
|
|
3078
|
+
r && l.push({
|
|
3050
3079
|
type: "rect",
|
|
3051
|
-
x:
|
|
3052
|
-
y:
|
|
3080
|
+
x: i,
|
|
3081
|
+
y: a,
|
|
3053
3082
|
width: e.size * 2,
|
|
3054
3083
|
height: e.size * 2,
|
|
3055
3084
|
cornerRadius: e.cornerRadius,
|
|
3056
|
-
paint: { fill:
|
|
3085
|
+
paint: { fill: r },
|
|
3057
3086
|
layer: "overlay"
|
|
3058
3087
|
});
|
|
3059
|
-
for (let
|
|
3088
|
+
for (let t of c) l.push({
|
|
3060
3089
|
type: "line",
|
|
3061
|
-
points:
|
|
3090
|
+
points: t,
|
|
3062
3091
|
paint: {
|
|
3063
|
-
stroke:
|
|
3092
|
+
stroke: n,
|
|
3064
3093
|
strokeWidth: e.strokeWidth,
|
|
3065
3094
|
dash: e.dash,
|
|
3066
3095
|
dashEnabled: e.dashEnabled
|
|
@@ -3072,11 +3101,72 @@ function pt(e) {
|
|
|
3072
3101
|
type: "group",
|
|
3073
3102
|
x: 0,
|
|
3074
3103
|
y: 0,
|
|
3075
|
-
children:
|
|
3104
|
+
children: l,
|
|
3076
3105
|
layer: "overlay"
|
|
3077
3106
|
};
|
|
3078
3107
|
}
|
|
3079
|
-
function
|
|
3108
|
+
function ht(e) {
|
|
3109
|
+
let t = e.colors.length, n = Math.PI * 2 / t, r = -Math.PI / 2, i = [];
|
|
3110
|
+
for (let a = 0; a < t; a++) {
|
|
3111
|
+
let t = e.colors[a], o = x(t, e.strokeAlpha), s = e.fillAlpha > 0 ? x(t, e.fillAlpha) : void 0, c = r + a * n, l = _t(e, c, c + n);
|
|
3112
|
+
if (s) {
|
|
3113
|
+
let t = [e.cx, e.cy];
|
|
3114
|
+
for (let [e, n] of l) t.push(e, n);
|
|
3115
|
+
i.push({
|
|
3116
|
+
type: "polygon",
|
|
3117
|
+
vertices: t,
|
|
3118
|
+
paint: { fill: s },
|
|
3119
|
+
layer: "overlay"
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
let u = [];
|
|
3123
|
+
for (let [e, t] of l) u.push(e, t);
|
|
3124
|
+
i.push({
|
|
3125
|
+
type: "line",
|
|
3126
|
+
points: u,
|
|
3127
|
+
paint: {
|
|
3128
|
+
stroke: o,
|
|
3129
|
+
strokeWidth: e.strokeWidth,
|
|
3130
|
+
dash: e.dash,
|
|
3131
|
+
dashEnabled: e.dashEnabled
|
|
3132
|
+
},
|
|
3133
|
+
lineCap: "butt",
|
|
3134
|
+
layer: "overlay"
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3137
|
+
return {
|
|
3138
|
+
type: "group",
|
|
3139
|
+
x: 0,
|
|
3140
|
+
y: 0,
|
|
3141
|
+
children: i,
|
|
3142
|
+
layer: "overlay"
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function gt(e, t) {
|
|
3146
|
+
let n = Math.cos(t), r = Math.sin(t);
|
|
3147
|
+
if (e.shape === "circle") return [e.cx + e.size * n, e.cy + e.size * r];
|
|
3148
|
+
let i = e.size, a = Math.max(Math.abs(n), Math.abs(r)), o = i / a * n, s = i / a * r, c = Math.min(e.cornerRadius, i), l = i - c;
|
|
3149
|
+
if (c > 0 && Math.abs(o) > l && Math.abs(s) > l) {
|
|
3150
|
+
let t = Math.sign(o) * l, i = Math.sign(s) * l, a = t * n + i * r, u = t * t + i * i, d = a + Math.sqrt(Math.max(0, a * a - (u - c * c)));
|
|
3151
|
+
return [e.cx + d * n, e.cy + d * r];
|
|
3152
|
+
}
|
|
3153
|
+
return [e.cx + o, e.cy + s];
|
|
3154
|
+
}
|
|
3155
|
+
function _t(e, t, n) {
|
|
3156
|
+
let r = [t], i = e.shape !== "circle" && e.cornerRadius > 0;
|
|
3157
|
+
if (e.shape === "circle" || i) {
|
|
3158
|
+
let e = i ? Math.PI / 36 : Math.PI / 18, a = Math.max(1, Math.ceil((n - t) / e));
|
|
3159
|
+
for (let e = 1; e < a; e++) r.push(t + (n - t) * e / a);
|
|
3160
|
+
} else {
|
|
3161
|
+
let e = Math.PI / 2, i = Math.PI / 4, a = Math.ceil((t - i) / e), o = Math.floor((n - i) / e);
|
|
3162
|
+
for (let s = a; s <= o; s++) {
|
|
3163
|
+
let a = i + s * e;
|
|
3164
|
+
a > t + 1e-9 && a < n - 1e-9 && r.push(a);
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
return r.push(n), r.sort((e, t) => e - t), r.map((t) => gt(e, t));
|
|
3168
|
+
}
|
|
3169
|
+
function vt(e) {
|
|
3080
3170
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
3081
3171
|
return e.shape === "circle" ? {
|
|
3082
3172
|
type: "circle",
|
|
@@ -3108,7 +3198,7 @@ function mt(e) {
|
|
|
3108
3198
|
layer: "overlay"
|
|
3109
3199
|
};
|
|
3110
3200
|
}
|
|
3111
|
-
function
|
|
3201
|
+
function yt(e) {
|
|
3112
3202
|
let t = [];
|
|
3113
3203
|
for (let n of e.segments) t.push({
|
|
3114
3204
|
type: "line",
|
|
@@ -3147,29 +3237,29 @@ function ht(e) {
|
|
|
3147
3237
|
}
|
|
3148
3238
|
//#endregion
|
|
3149
3239
|
//#region src/hit/HitTester.ts
|
|
3150
|
-
var
|
|
3240
|
+
var bt = {
|
|
3151
3241
|
areaExit: 110,
|
|
3152
3242
|
room: 100,
|
|
3153
3243
|
label: 80,
|
|
3154
3244
|
specialExit: 60,
|
|
3155
3245
|
exit: 40,
|
|
3156
3246
|
stub: 20
|
|
3157
|
-
},
|
|
3247
|
+
}, xt = {
|
|
3158
3248
|
room: .3,
|
|
3159
3249
|
areaExit: 1,
|
|
3160
3250
|
label: 1,
|
|
3161
3251
|
specialExit: .5,
|
|
3162
3252
|
exit: .35,
|
|
3163
3253
|
stub: .3
|
|
3164
|
-
},
|
|
3254
|
+
}, St = (e, t) => ({
|
|
3165
3255
|
x: e,
|
|
3166
3256
|
y: t
|
|
3167
|
-
}),
|
|
3257
|
+
}), Ct = class {
|
|
3168
3258
|
constructor() {
|
|
3169
|
-
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform =
|
|
3259
|
+
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform = St;
|
|
3170
3260
|
}
|
|
3171
3261
|
build(e, t, n) {
|
|
3172
|
-
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ??
|
|
3262
|
+
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ?? St, this.collectHitShapes(e, 0, 0);
|
|
3173
3263
|
}
|
|
3174
3264
|
clear() {
|
|
3175
3265
|
this.entries = [], this.spatialIndex.clear();
|
|
@@ -3213,13 +3303,13 @@ var gt = {
|
|
|
3213
3303
|
forEachCandidate(e, t, n) {
|
|
3214
3304
|
let r = Math.floor(e / this.bucketSize), i = Math.floor(t / this.bucketSize), a = /* @__PURE__ */ new Set();
|
|
3215
3305
|
for (let o = -1; o <= 1; o++) for (let s = -1; s <= 1; s++) {
|
|
3216
|
-
let c = this.spatialIndex.get(
|
|
3306
|
+
let c = this.spatialIndex.get(Mt(r + o, i + s));
|
|
3217
3307
|
if (c) for (let r of c) {
|
|
3218
3308
|
if (a.has(r)) continue;
|
|
3219
3309
|
a.add(r);
|
|
3220
3310
|
let i = r.margin * this.roomSize;
|
|
3221
3311
|
if (e < r.rMinX - i || e > r.rMaxX + i || t < r.rMinY - i || t > r.rMaxY + i) continue;
|
|
3222
|
-
let o =
|
|
3312
|
+
let o = Dt(r, e, t);
|
|
3223
3313
|
o > i || n(r, o);
|
|
3224
3314
|
}
|
|
3225
3315
|
}
|
|
@@ -3238,14 +3328,14 @@ var gt = {
|
|
|
3238
3328
|
collectHitShapes(e, t, n) {
|
|
3239
3329
|
for (let r of e) {
|
|
3240
3330
|
if (r.hit) {
|
|
3241
|
-
let e = [], i =
|
|
3242
|
-
|
|
3331
|
+
let e = [], i = wt();
|
|
3332
|
+
Tt(r, t, n, this.transform, e, i), e.length > 0 && i.minX <= i.maxX && this.indexEntry(i, e, r.hit);
|
|
3243
3333
|
}
|
|
3244
3334
|
r.type === "group" && this.collectHitShapes(r.children, t + r.x, n + r.y);
|
|
3245
3335
|
}
|
|
3246
3336
|
}
|
|
3247
3337
|
indexEntry(e, t, n) {
|
|
3248
|
-
let r = n.margin ??
|
|
3338
|
+
let r = n.margin ?? xt[n.kind] ?? 1, i = n.priority ?? bt[n.kind] ?? 50, a = (e.minX + e.maxX) / 2, o = (e.minY + e.maxY) / 2, s = {
|
|
3249
3339
|
info: n,
|
|
3250
3340
|
margin: r,
|
|
3251
3341
|
priority: i,
|
|
@@ -3260,12 +3350,12 @@ var gt = {
|
|
|
3260
3350
|
this.entries.push(s);
|
|
3261
3351
|
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);
|
|
3262
3352
|
for (let e = l; e <= u; e++) for (let t = d; t <= f; t++) {
|
|
3263
|
-
let n =
|
|
3353
|
+
let n = Mt(e, t), r = this.spatialIndex.get(n);
|
|
3264
3354
|
r || (r = [], this.spatialIndex.set(n, r)), r.push(s);
|
|
3265
3355
|
}
|
|
3266
3356
|
}
|
|
3267
3357
|
};
|
|
3268
|
-
function
|
|
3358
|
+
function wt() {
|
|
3269
3359
|
return {
|
|
3270
3360
|
minX: Infinity,
|
|
3271
3361
|
minY: Infinity,
|
|
@@ -3273,17 +3363,17 @@ function bt() {
|
|
|
3273
3363
|
maxY: -Infinity
|
|
3274
3364
|
};
|
|
3275
3365
|
}
|
|
3276
|
-
function
|
|
3366
|
+
function U(e, t, n) {
|
|
3277
3367
|
t < e.minX && (e.minX = t), t > e.maxX && (e.maxX = t), n < e.minY && (e.minY = n), n > e.maxY && (e.maxY = n);
|
|
3278
3368
|
}
|
|
3279
|
-
function
|
|
3369
|
+
function Tt(e, t, n, r, i, a) {
|
|
3280
3370
|
if (e.type === "group") {
|
|
3281
|
-
for (let o of e.children) o.hit ||
|
|
3371
|
+
for (let o of e.children) o.hit || Et(o, t + e.x, n + e.y, r, i, a);
|
|
3282
3372
|
return;
|
|
3283
3373
|
}
|
|
3284
|
-
|
|
3374
|
+
Et(e, t, n, r, i, a);
|
|
3285
3375
|
}
|
|
3286
|
-
function
|
|
3376
|
+
function Et(e, t, n, r, i, a) {
|
|
3287
3377
|
switch (e.type) {
|
|
3288
3378
|
case "rect":
|
|
3289
3379
|
case "image": {
|
|
@@ -3302,14 +3392,14 @@ function St(e, t, n, r, i, a) {
|
|
|
3302
3392
|
pts: u,
|
|
3303
3393
|
closed: !0
|
|
3304
3394
|
});
|
|
3305
|
-
for (let e = 0; e < u.length; e += 2)
|
|
3395
|
+
for (let e = 0; e < u.length; e += 2) U(a, u[e], u[e + 1]);
|
|
3306
3396
|
return;
|
|
3307
3397
|
}
|
|
3308
3398
|
case "text": {
|
|
3309
3399
|
let o = e.width ?? 0, s = e.height ?? 0;
|
|
3310
3400
|
if (o === 0 || s === 0) {
|
|
3311
3401
|
let i = r(t + e.x, n + e.y);
|
|
3312
|
-
|
|
3402
|
+
U(a, i.x, i.y);
|
|
3313
3403
|
return;
|
|
3314
3404
|
}
|
|
3315
3405
|
let c = r(t + e.x, n + e.y), l = r(t + e.x + o, n + e.y), u = r(t + e.x + o, n + e.y + s), d = r(t + e.x, n + e.y + s), f = [
|
|
@@ -3327,7 +3417,7 @@ function St(e, t, n, r, i, a) {
|
|
|
3327
3417
|
pts: f,
|
|
3328
3418
|
closed: !0
|
|
3329
3419
|
});
|
|
3330
|
-
for (let e = 0; e < f.length; e += 2)
|
|
3420
|
+
for (let e = 0; e < f.length; e += 2) U(a, f[e], f[e + 1]);
|
|
3331
3421
|
return;
|
|
3332
3422
|
}
|
|
3333
3423
|
case "circle": {
|
|
@@ -3337,14 +3427,14 @@ function St(e, t, n, r, i, a) {
|
|
|
3337
3427
|
cx: o.x,
|
|
3338
3428
|
cy: o.y,
|
|
3339
3429
|
r: e.radius
|
|
3340
|
-
}),
|
|
3430
|
+
}), U(a, o.x - e.radius, o.y - e.radius), U(a, o.x + e.radius, o.y + e.radius);
|
|
3341
3431
|
return;
|
|
3342
3432
|
}
|
|
3343
3433
|
case "line": {
|
|
3344
3434
|
let o = [];
|
|
3345
3435
|
for (let i = 0; i < e.points.length; i += 2) {
|
|
3346
3436
|
let s = r(t + e.points[i], n + e.points[i + 1]);
|
|
3347
|
-
o.push(s.x, s.y),
|
|
3437
|
+
o.push(s.x, s.y), U(a, s.x, s.y);
|
|
3348
3438
|
}
|
|
3349
3439
|
o.length >= 2 && i.push({
|
|
3350
3440
|
type: "polyline",
|
|
@@ -3357,7 +3447,7 @@ function St(e, t, n, r, i, a) {
|
|
|
3357
3447
|
let o = [];
|
|
3358
3448
|
for (let i = 0; i < e.vertices.length; i += 2) {
|
|
3359
3449
|
let s = r(t + e.vertices[i], n + e.vertices[i + 1]);
|
|
3360
|
-
o.push(s.x, s.y),
|
|
3450
|
+
o.push(s.x, s.y), U(a, s.x, s.y);
|
|
3361
3451
|
}
|
|
3362
3452
|
o.length >= 2 && i.push({
|
|
3363
3453
|
type: "polyline",
|
|
@@ -3367,42 +3457,42 @@ function St(e, t, n, r, i, a) {
|
|
|
3367
3457
|
return;
|
|
3368
3458
|
}
|
|
3369
3459
|
case "group":
|
|
3370
|
-
for (let o of e.children) o.hit ||
|
|
3460
|
+
for (let o of e.children) o.hit || Et(o, t + e.x, n + e.y, r, i, a);
|
|
3371
3461
|
return;
|
|
3372
3462
|
}
|
|
3373
3463
|
}
|
|
3374
|
-
function
|
|
3464
|
+
function Dt(e, t, n) {
|
|
3375
3465
|
let r = Infinity;
|
|
3376
3466
|
for (let i of e.geoms) {
|
|
3377
|
-
let e =
|
|
3467
|
+
let e = Ot(i, t, n);
|
|
3378
3468
|
if (e < r && (r = e), r === 0) return 0;
|
|
3379
3469
|
}
|
|
3380
3470
|
return r;
|
|
3381
3471
|
}
|
|
3382
|
-
function
|
|
3472
|
+
function Ot(e, t, n) {
|
|
3383
3473
|
if (e.type === "circle") {
|
|
3384
3474
|
let r = t - e.cx, i = n - e.cy;
|
|
3385
3475
|
return Math.max(0, Math.hypot(r, i) - e.r);
|
|
3386
3476
|
}
|
|
3387
|
-
return e.closed &&
|
|
3477
|
+
return e.closed && jt(e.pts, t, n) ? 0 : kt(e.pts, t, n, e.closed);
|
|
3388
3478
|
}
|
|
3389
|
-
function
|
|
3479
|
+
function kt(e, t, n, r) {
|
|
3390
3480
|
let i = e.length / 2;
|
|
3391
3481
|
if (i < 2) return i === 1 ? Math.hypot(t - e[0], n - e[1]) : Infinity;
|
|
3392
3482
|
let a = Infinity, o = r ? i : i - 1;
|
|
3393
3483
|
for (let r = 0; r < o; r++) {
|
|
3394
|
-
let o = r * 2, s = (r + 1) % i * 2, c =
|
|
3484
|
+
let o = r * 2, s = (r + 1) % i * 2, c = At(t, n, e[o], e[o + 1], e[s], e[s + 1]);
|
|
3395
3485
|
c < a && (a = c);
|
|
3396
3486
|
}
|
|
3397
3487
|
return a;
|
|
3398
3488
|
}
|
|
3399
|
-
function
|
|
3489
|
+
function At(e, t, n, r, i, a) {
|
|
3400
3490
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : ((e - n) * o + (t - r) * s) / c;
|
|
3401
3491
|
l < 0 ? l = 0 : l > 1 && (l = 1);
|
|
3402
3492
|
let u = n + l * o, d = r + l * s;
|
|
3403
3493
|
return Math.hypot(e - u, t - d);
|
|
3404
3494
|
}
|
|
3405
|
-
function
|
|
3495
|
+
function jt(e, t, n) {
|
|
3406
3496
|
let r = !1, i = e.length / 2;
|
|
3407
3497
|
for (let a = 0, o = i - 1; a < i; o = a++) {
|
|
3408
3498
|
let i = e[a * 2], s = e[a * 2 + 1], c = e[o * 2], l = e[o * 2 + 1], u = l - s || 1e-12;
|
|
@@ -3410,14 +3500,14 @@ function Dt(e, t, n) {
|
|
|
3410
3500
|
}
|
|
3411
3501
|
return r;
|
|
3412
3502
|
}
|
|
3413
|
-
function
|
|
3503
|
+
function Mt(e, t) {
|
|
3414
3504
|
return e * 1000003 + t;
|
|
3415
3505
|
}
|
|
3416
3506
|
//#endregion
|
|
3417
3507
|
//#region src/style/Style.ts
|
|
3418
|
-
var
|
|
3419
|
-
function
|
|
3420
|
-
return e.length === 0 ?
|
|
3508
|
+
var W = { transform: (e) => e };
|
|
3509
|
+
function Nt(...e) {
|
|
3510
|
+
return e.length === 0 ? W : e.length === 1 ? e[0] : {
|
|
3421
3511
|
transform(t, n) {
|
|
3422
3512
|
let r = [t];
|
|
3423
3513
|
for (let t of e) {
|
|
@@ -3453,19 +3543,19 @@ function kt(...e) {
|
|
|
3453
3543
|
}
|
|
3454
3544
|
//#endregion
|
|
3455
3545
|
//#region src/style/applyStyle.ts
|
|
3456
|
-
function
|
|
3546
|
+
function Pt(e, t, n) {
|
|
3457
3547
|
let r = [];
|
|
3458
3548
|
for (let i of e) {
|
|
3459
|
-
let e =
|
|
3549
|
+
let e = Ft(i, t, n);
|
|
3460
3550
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3461
3551
|
}
|
|
3462
3552
|
return r;
|
|
3463
3553
|
}
|
|
3464
|
-
function
|
|
3554
|
+
function Ft(e, t, n) {
|
|
3465
3555
|
if (e.type === "group") {
|
|
3466
3556
|
let r = [];
|
|
3467
3557
|
for (let i of e.children) {
|
|
3468
|
-
let e =
|
|
3558
|
+
let e = Ft(i, t, n);
|
|
3469
3559
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3470
3560
|
}
|
|
3471
3561
|
return t.transform({
|
|
@@ -3477,27 +3567,27 @@ function At(e, t, n) {
|
|
|
3477
3567
|
}
|
|
3478
3568
|
//#endregion
|
|
3479
3569
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
3480
|
-
var
|
|
3570
|
+
var G = "rgb(120, 72, 0)", It = class {
|
|
3481
3571
|
get coordinateTransform() {
|
|
3482
3572
|
return this._coordinateTransform;
|
|
3483
3573
|
}
|
|
3484
3574
|
constructor(e, t) {
|
|
3485
|
-
this.gridCachedBounds = null, this.currentStyle =
|
|
3575
|
+
this.gridCachedBounds = null, this.currentStyle = W, this.hitTester = new Ct(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.currentRoomOverlay = [], 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({
|
|
3486
3576
|
container: t,
|
|
3487
3577
|
width: t.clientWidth,
|
|
3488
3578
|
height: t.clientHeight,
|
|
3489
3579
|
draggable: !1
|
|
3490
|
-
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new
|
|
3580
|
+
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new D(t.clientWidth, t.clientHeight)) : (this.stage = new r.Stage({
|
|
3491
3581
|
width: 1,
|
|
3492
3582
|
height: 1
|
|
3493
|
-
}), this.camera = new
|
|
3583
|
+
}), this.camera = new D(1, 1)), this.gridLayer = new r.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
3494
3584
|
let n = new r.Layer({ listening: !1 });
|
|
3495
|
-
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
|
|
3585
|
+
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 qe(this.positionLayer), this.overlayLayerNode = new qe(this.overlayLayer), this.sceneNode = new Ke(n), this.gridLayerNode = new B(this.gridLayer), this.topLabelLayerNode = new B(this.topLabelLayer), this.sceneManager = new He(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) {
|
|
3496
3586
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
3497
3587
|
let n = this.origSetSize;
|
|
3498
3588
|
this.camera.setSize = (e, t) => {
|
|
3499
3589
|
n(e, t), this.stage.width(e), this.stage.height(t);
|
|
3500
|
-
}, this.interactionHandler = new
|
|
3590
|
+
}, this.interactionHandler = new Ue(t, this.camera, e, {
|
|
3501
3591
|
clientToMapPoint: (e, n) => this.camera.clientToMapPoint(e, n, t.getBoundingClientRect()),
|
|
3502
3592
|
pickAtPoint: (e, t) => this.hitTester.pick(e, t)
|
|
3503
3593
|
}, this.events);
|
|
@@ -3505,10 +3595,10 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3505
3595
|
this.applyStyleTransforms(), this.subscribeToState(e);
|
|
3506
3596
|
}
|
|
3507
3597
|
setStyle(e) {
|
|
3508
|
-
this.currentStyle = e, this.sceneNode = new
|
|
3598
|
+
this.currentStyle = e, this.sceneNode = new Ke(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.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
|
|
3509
3599
|
}
|
|
3510
3600
|
applyStyleTransforms() {
|
|
3511
|
-
let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) :
|
|
3601
|
+
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;
|
|
3512
3602
|
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);
|
|
3513
3603
|
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);
|
|
3514
3604
|
this.camera.position = {
|
|
@@ -3638,7 +3728,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3638
3728
|
let e = this.mapPoint(r.x, r.y);
|
|
3639
3729
|
this.camera.panToMapPointAnimated(e.x, e.y, n || this.state.settings.instantMapMove);
|
|
3640
3730
|
}
|
|
3641
|
-
}), e.events.on("highlight", ({ roomId: e,
|
|
3731
|
+
}), e.events.on("highlight", ({ roomId: e, colors: t }) => {
|
|
3642
3732
|
this.syncHighlight(e, t);
|
|
3643
3733
|
}), e.events.on("path", () => {
|
|
3644
3734
|
this.syncPaths();
|
|
@@ -3663,7 +3753,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3663
3753
|
for (let e of r.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
|
|
3664
3754
|
}
|
|
3665
3755
|
addStyledShape(e, t) {
|
|
3666
|
-
let n = this.currentStyle ===
|
|
3756
|
+
let n = this.currentStyle === W ? [e] : Pt([e], this.currentStyle, this.styleContext());
|
|
3667
3757
|
if (n.length === 0) return;
|
|
3668
3758
|
let r;
|
|
3669
3759
|
r = n.length === 1 && n[0].type === "group" ? n[0] : {
|
|
@@ -3674,7 +3764,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3674
3764
|
layer: e.layer,
|
|
3675
3765
|
noScale: e.noScale
|
|
3676
3766
|
};
|
|
3677
|
-
let i =
|
|
3767
|
+
let i = Xe(r);
|
|
3678
3768
|
return t.addNode(i), i;
|
|
3679
3769
|
}
|
|
3680
3770
|
refreshGrid(e) {
|
|
@@ -3686,7 +3776,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3686
3776
|
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;
|
|
3687
3777
|
if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
|
|
3688
3778
|
this.gridLayerNode.destroyChildren();
|
|
3689
|
-
let _ =
|
|
3779
|
+
let _ = Le(e, t, { inverseTransform: this.coordinateInverse });
|
|
3690
3780
|
for (let e of _) this.addStyledShape(e, this.gridLayerNode);
|
|
3691
3781
|
this.gridCachedBounds = {
|
|
3692
3782
|
left: f,
|
|
@@ -3736,8 +3826,8 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3736
3826
|
this.positionLayerNode.batchDraw();
|
|
3737
3827
|
return;
|
|
3738
3828
|
}
|
|
3739
|
-
let t =
|
|
3740
|
-
this.positionMarker = this.addStyledShape(
|
|
3829
|
+
let t = ft(e, this.state.settings);
|
|
3830
|
+
this.positionMarker = this.addStyledShape(vt(t), this.positionLayerNode);
|
|
3741
3831
|
}
|
|
3742
3832
|
clearCurrentRoomOverlay() {
|
|
3743
3833
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3756,11 +3846,11 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3756
3846
|
n.set(e.id, e);
|
|
3757
3847
|
let r = [], i = this.sceneManager.exitRenderer, a = this.state.lens;
|
|
3758
3848
|
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) => {
|
|
3759
|
-
let t = i.renderDataWithColor(e,
|
|
3849
|
+
let t = i.renderDataWithColor(e, G, this.state.currentZIndex);
|
|
3760
3850
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3761
3851
|
});
|
|
3762
|
-
for (let n of
|
|
3763
|
-
for (let n of
|
|
3852
|
+
for (let n of de(e, t, G)) r.push(ke(n, e.id));
|
|
3853
|
+
for (let n of le(e, t, G)) r.push(Ae(n));
|
|
3764
3854
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3765
3855
|
let t = this.state.mapReader.getRoom(e);
|
|
3766
3856
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -3768,11 +3858,11 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3768
3858
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3769
3859
|
t && this.currentRoomOverlay.push(t);
|
|
3770
3860
|
}), n.forEach((n, r) => {
|
|
3771
|
-
let i = r === e.id, a =
|
|
3772
|
-
strokeOverride: i ?
|
|
3861
|
+
let i = r === e.id, a = ye(n, this.state.mapReader, t, {
|
|
3862
|
+
strokeOverride: i ? G : t.lineColor,
|
|
3773
3863
|
flatPipeline: !0
|
|
3774
3864
|
});
|
|
3775
|
-
a.children.push(...
|
|
3865
|
+
a.children.push(...Ee(n, this.state.mapReader, t));
|
|
3776
3866
|
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
3777
3867
|
o && this.currentRoomOverlay.push(o);
|
|
3778
3868
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
@@ -3782,7 +3872,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3782
3872
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3783
3873
|
let n = this.state.mapReader.getRoom(e);
|
|
3784
3874
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3785
|
-
let r =
|
|
3875
|
+
let r = dt(n, t, this.state.settings), i = this.addStyledShape(mt(r), this.overlayLayerNode);
|
|
3786
3876
|
i && this.highlightShapes.set(e, i);
|
|
3787
3877
|
}
|
|
3788
3878
|
}
|
|
@@ -3795,7 +3885,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3795
3885
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3796
3886
|
let n = this.state.mapReader.getRoom(e);
|
|
3797
3887
|
if (!n) continue;
|
|
3798
|
-
let r =
|
|
3888
|
+
let r = dt(n, t.colors, this.state.settings), i = this.addStyledShape(mt(r), this.overlayLayerNode);
|
|
3799
3889
|
i && this.highlightShapes.set(e, i);
|
|
3800
3890
|
}
|
|
3801
3891
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3805,8 +3895,8 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3805
3895
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3806
3896
|
if (!(e === void 0 || t === void 0)) {
|
|
3807
3897
|
for (let n of this.state.paths) {
|
|
3808
|
-
let r =
|
|
3809
|
-
for (let e of
|
|
3898
|
+
let r = pt(this.state.mapReader, this.state.settings, n.locations, n.color, e, t);
|
|
3899
|
+
for (let e of yt(r)) {
|
|
3810
3900
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3811
3901
|
t && this.pathShapes.push(t);
|
|
3812
3902
|
}
|
|
@@ -3825,7 +3915,7 @@ var jt = "rgb(120, 72, 0)", Mt = class {
|
|
|
3825
3915
|
};
|
|
3826
3916
|
//#endregion
|
|
3827
3917
|
//#region src/style/shape/paintMap.ts
|
|
3828
|
-
function
|
|
3918
|
+
function K(e, t) {
|
|
3829
3919
|
if (e !== void 0) return typeof e == "string" ? t(e) : {
|
|
3830
3920
|
...e,
|
|
3831
3921
|
stops: e.stops.map((e) => ({
|
|
@@ -3834,7 +3924,7 @@ function G(e, t) {
|
|
|
3834
3924
|
}))
|
|
3835
3925
|
};
|
|
3836
3926
|
}
|
|
3837
|
-
function
|
|
3927
|
+
function q(e) {
|
|
3838
3928
|
let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
3839
3929
|
return t ? {
|
|
3840
3930
|
r: parseInt(t[1]),
|
|
@@ -3848,100 +3938,100 @@ function K(e) {
|
|
|
3848
3938
|
a: 1
|
|
3849
3939
|
} : null;
|
|
3850
3940
|
}
|
|
3851
|
-
function
|
|
3941
|
+
function J(e, t, n, r = 1) {
|
|
3852
3942
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3853
3943
|
}
|
|
3854
|
-
function
|
|
3944
|
+
function Lt(e) {
|
|
3855
3945
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3856
3946
|
}
|
|
3857
3947
|
//#endregion
|
|
3858
3948
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3859
|
-
var
|
|
3860
|
-
function
|
|
3861
|
-
let t =
|
|
3862
|
-
if (!t) return
|
|
3863
|
-
let n =
|
|
3864
|
-
return
|
|
3865
|
-
}
|
|
3866
|
-
function
|
|
3867
|
-
let t =
|
|
3868
|
-
if (!t || t.a >= 1) return
|
|
3869
|
-
let n =
|
|
3870
|
-
return
|
|
3871
|
-
}
|
|
3872
|
-
function
|
|
3949
|
+
var Rt = "#4a3728", zt = "#3b2a1a", Bt = 139, Vt = 115, Ht = 85, Ut = 244, Wt = 228, Gt = 193;
|
|
3950
|
+
function Kt(e) {
|
|
3951
|
+
let t = q(e);
|
|
3952
|
+
if (!t) return J(Ut, Wt, Gt);
|
|
3953
|
+
let n = Lt(t);
|
|
3954
|
+
return J(Math.round(Bt + (Ut - Bt) * n), Math.round(Vt + (Wt - Vt) * n), Math.round(Ht + (Gt - Ht) * n), t.a);
|
|
3955
|
+
}
|
|
3956
|
+
function qt(e) {
|
|
3957
|
+
let t = q(e);
|
|
3958
|
+
if (!t || t.a >= 1) return Rt;
|
|
3959
|
+
let n = q(Rt);
|
|
3960
|
+
return J(n.r, n.g, n.b, t.a);
|
|
3961
|
+
}
|
|
3962
|
+
function Jt(e) {
|
|
3873
3963
|
return {
|
|
3874
3964
|
...e,
|
|
3875
|
-
fill:
|
|
3876
|
-
stroke: e.stroke ?
|
|
3965
|
+
fill: K(e.fill, Kt),
|
|
3966
|
+
stroke: e.stroke ? qt(e.stroke) : e.stroke
|
|
3877
3967
|
};
|
|
3878
3968
|
}
|
|
3879
|
-
var
|
|
3969
|
+
var Yt = { transform(e) {
|
|
3880
3970
|
switch (e.type) {
|
|
3881
3971
|
case "rect":
|
|
3882
3972
|
case "circle":
|
|
3883
3973
|
case "polygon": return {
|
|
3884
3974
|
...e,
|
|
3885
|
-
paint:
|
|
3975
|
+
paint: Jt(e.paint)
|
|
3886
3976
|
};
|
|
3887
3977
|
case "line": return {
|
|
3888
3978
|
...e,
|
|
3889
3979
|
paint: e.paint.stroke ? {
|
|
3890
3980
|
...e.paint,
|
|
3891
|
-
stroke:
|
|
3981
|
+
stroke: qt(e.paint.stroke)
|
|
3892
3982
|
} : e.paint
|
|
3893
3983
|
};
|
|
3894
3984
|
case "text": return {
|
|
3895
3985
|
...e,
|
|
3896
|
-
fill:
|
|
3986
|
+
fill: zt
|
|
3897
3987
|
};
|
|
3898
3988
|
case "image":
|
|
3899
3989
|
case "group": return e;
|
|
3900
3990
|
}
|
|
3901
|
-
} },
|
|
3902
|
-
function
|
|
3903
|
-
let t =
|
|
3904
|
-
if (!t) return
|
|
3905
|
-
let n =
|
|
3906
|
-
return
|
|
3991
|
+
} }, Xt = "#c0deff", Zt = "#e0f0ff", Qt = 20, $t = 40, en = 80, tn = 60, nn = 100, rn = 160;
|
|
3992
|
+
function an(e) {
|
|
3993
|
+
let t = q(e);
|
|
3994
|
+
if (!t) return J(tn, nn, rn);
|
|
3995
|
+
let n = Lt(t);
|
|
3996
|
+
return J(Math.round(Qt + (tn - Qt) * n), Math.round($t + (nn - $t) * n), Math.round(en + (rn - en) * n), t.a);
|
|
3907
3997
|
}
|
|
3908
|
-
function
|
|
3909
|
-
let t =
|
|
3910
|
-
if (!t || t.a >= 1) return
|
|
3911
|
-
let n =
|
|
3912
|
-
return
|
|
3998
|
+
function on(e) {
|
|
3999
|
+
let t = q(e);
|
|
4000
|
+
if (!t || t.a >= 1) return Xt;
|
|
4001
|
+
let n = q(Xt);
|
|
4002
|
+
return J(n.r, n.g, n.b, t.a);
|
|
3913
4003
|
}
|
|
3914
|
-
function
|
|
4004
|
+
function sn(e) {
|
|
3915
4005
|
return {
|
|
3916
4006
|
...e,
|
|
3917
|
-
fill:
|
|
3918
|
-
stroke: e.stroke ?
|
|
4007
|
+
fill: K(e.fill, an),
|
|
4008
|
+
stroke: e.stroke ? on(e.stroke) : e.stroke
|
|
3919
4009
|
};
|
|
3920
4010
|
}
|
|
3921
|
-
var
|
|
4011
|
+
var cn = { transform(e) {
|
|
3922
4012
|
switch (e.type) {
|
|
3923
4013
|
case "rect":
|
|
3924
4014
|
case "circle":
|
|
3925
4015
|
case "polygon": return {
|
|
3926
4016
|
...e,
|
|
3927
|
-
paint:
|
|
4017
|
+
paint: sn(e.paint)
|
|
3928
4018
|
};
|
|
3929
4019
|
case "line": return {
|
|
3930
4020
|
...e,
|
|
3931
4021
|
paint: e.paint.stroke ? {
|
|
3932
4022
|
...e.paint,
|
|
3933
|
-
stroke:
|
|
4023
|
+
stroke: on(e.paint.stroke)
|
|
3934
4024
|
} : e.paint
|
|
3935
4025
|
};
|
|
3936
4026
|
case "text": return {
|
|
3937
4027
|
...e,
|
|
3938
|
-
fill:
|
|
4028
|
+
fill: Zt
|
|
3939
4029
|
};
|
|
3940
4030
|
case "image":
|
|
3941
4031
|
case "group": return e;
|
|
3942
4032
|
}
|
|
3943
|
-
} },
|
|
3944
|
-
function
|
|
4033
|
+
} }, ln = "#00ffd0", un = .3, dn = 3;
|
|
4034
|
+
function fn(e, t, n) {
|
|
3945
4035
|
e /= 255, t /= 255, n /= 255;
|
|
3946
4036
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3947
4037
|
if (r === i) return [
|
|
@@ -3956,68 +4046,68 @@ function cn(e, t, n) {
|
|
|
3956
4046
|
a
|
|
3957
4047
|
];
|
|
3958
4048
|
}
|
|
3959
|
-
function
|
|
4049
|
+
function pn(e, t, n, r = 1) {
|
|
3960
4050
|
e = (e % 360 + 360) % 360;
|
|
3961
4051
|
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;
|
|
3962
4052
|
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);
|
|
3963
4053
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3964
4054
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3965
4055
|
}
|
|
3966
|
-
function
|
|
3967
|
-
let t =
|
|
4056
|
+
function mn(e) {
|
|
4057
|
+
let t = q(e);
|
|
3968
4058
|
if (!t) return {
|
|
3969
4059
|
h: 150,
|
|
3970
4060
|
a: 1
|
|
3971
4061
|
};
|
|
3972
|
-
let [n] =
|
|
4062
|
+
let [n] = fn(t.r, t.g, t.b);
|
|
3973
4063
|
return {
|
|
3974
4064
|
h: n,
|
|
3975
4065
|
a: t.a
|
|
3976
4066
|
};
|
|
3977
4067
|
}
|
|
3978
|
-
function
|
|
3979
|
-
let { h: t, a: n } =
|
|
3980
|
-
return
|
|
4068
|
+
function hn(e) {
|
|
4069
|
+
let { h: t, a: n } = mn(e);
|
|
4070
|
+
return pn(t, .95, .65, n);
|
|
3981
4071
|
}
|
|
3982
|
-
function
|
|
3983
|
-
let t =
|
|
4072
|
+
function gn(e) {
|
|
4073
|
+
let t = q(e);
|
|
3984
4074
|
if (!t) return "rgb(8, 12, 10)";
|
|
3985
|
-
let [n] =
|
|
3986
|
-
return
|
|
4075
|
+
let [n] = fn(t.r, t.g, t.b);
|
|
4076
|
+
return pn(n, .4, .1, t.a);
|
|
3987
4077
|
}
|
|
3988
|
-
function
|
|
3989
|
-
let { h: t, a: n } =
|
|
3990
|
-
return
|
|
4078
|
+
function _n(e) {
|
|
4079
|
+
let { h: t, a: n } = mn(e);
|
|
4080
|
+
return pn(t, .95, .65, Math.min(n, un));
|
|
3991
4081
|
}
|
|
3992
|
-
function
|
|
4082
|
+
function vn(e) {
|
|
3993
4083
|
return {
|
|
3994
4084
|
...e,
|
|
3995
|
-
fill:
|
|
3996
|
-
stroke: e.stroke ?
|
|
4085
|
+
fill: K(e.fill, gn),
|
|
4086
|
+
stroke: e.stroke ? hn(e.stroke) : e.stroke
|
|
3997
4087
|
};
|
|
3998
4088
|
}
|
|
3999
|
-
function
|
|
4089
|
+
function yn(e, t = !1) {
|
|
4000
4090
|
if (!e.stroke) return e;
|
|
4001
|
-
let n = (e.strokeWidth ?? 1) *
|
|
4091
|
+
let n = (e.strokeWidth ?? 1) * dn;
|
|
4002
4092
|
return {
|
|
4003
|
-
stroke:
|
|
4093
|
+
stroke: _n(e.stroke),
|
|
4004
4094
|
strokeWidth: n,
|
|
4005
4095
|
dash: e.dash,
|
|
4006
4096
|
dashEnabled: e.dashEnabled,
|
|
4007
|
-
alpha: t ?
|
|
4097
|
+
alpha: t ? un : e.alpha
|
|
4008
4098
|
};
|
|
4009
4099
|
}
|
|
4010
|
-
var
|
|
4100
|
+
var bn = { transform(e) {
|
|
4011
4101
|
switch (e.type) {
|
|
4012
4102
|
case "rect": {
|
|
4013
4103
|
let t = {
|
|
4014
4104
|
...e,
|
|
4015
|
-
paint:
|
|
4105
|
+
paint: vn(e.paint)
|
|
4016
4106
|
};
|
|
4017
4107
|
return e.paint.stroke ? [{
|
|
4018
4108
|
...e,
|
|
4019
4109
|
paint: {
|
|
4020
|
-
...
|
|
4110
|
+
...yn(e.paint),
|
|
4021
4111
|
fill: void 0
|
|
4022
4112
|
}
|
|
4023
4113
|
}, t] : t;
|
|
@@ -4025,12 +4115,12 @@ var gn = { transform(e) {
|
|
|
4025
4115
|
case "circle": {
|
|
4026
4116
|
let t = {
|
|
4027
4117
|
...e,
|
|
4028
|
-
paint:
|
|
4118
|
+
paint: vn(e.paint)
|
|
4029
4119
|
};
|
|
4030
4120
|
return e.paint.stroke ? [{
|
|
4031
4121
|
...e,
|
|
4032
4122
|
paint: {
|
|
4033
|
-
...
|
|
4123
|
+
...yn(e.paint),
|
|
4034
4124
|
fill: void 0
|
|
4035
4125
|
}
|
|
4036
4126
|
}, t] : t;
|
|
@@ -4040,21 +4130,21 @@ var gn = { transform(e) {
|
|
|
4040
4130
|
...e,
|
|
4041
4131
|
paint: e.paint.stroke ? {
|
|
4042
4132
|
...e.paint,
|
|
4043
|
-
stroke:
|
|
4133
|
+
stroke: hn(e.paint.stroke)
|
|
4044
4134
|
} : e.paint
|
|
4045
4135
|
};
|
|
4046
4136
|
return e.paint.stroke ? [{
|
|
4047
4137
|
...e,
|
|
4048
|
-
paint:
|
|
4138
|
+
paint: yn(e.paint, !0)
|
|
4049
4139
|
}, t] : t;
|
|
4050
4140
|
}
|
|
4051
4141
|
case "polygon": return {
|
|
4052
4142
|
...e,
|
|
4053
|
-
paint:
|
|
4143
|
+
paint: vn(e.paint)
|
|
4054
4144
|
};
|
|
4055
4145
|
case "text": return {
|
|
4056
4146
|
...e,
|
|
4057
|
-
fill:
|
|
4147
|
+
fill: ln
|
|
4058
4148
|
};
|
|
4059
4149
|
case "image":
|
|
4060
4150
|
case "group": return e;
|
|
@@ -4062,16 +4152,16 @@ var gn = { transform(e) {
|
|
|
4062
4152
|
} };
|
|
4063
4153
|
//#endregion
|
|
4064
4154
|
//#region src/style/shape/wobble.ts
|
|
4065
|
-
function
|
|
4155
|
+
function xn(e) {
|
|
4066
4156
|
let t = e | 0 || 1;
|
|
4067
4157
|
return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
|
|
4068
4158
|
}
|
|
4069
|
-
function
|
|
4159
|
+
function Sn(...e) {
|
|
4070
4160
|
let t = 2654435769;
|
|
4071
4161
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4072
4162
|
return t;
|
|
4073
4163
|
}
|
|
4074
|
-
function
|
|
4164
|
+
function Cn(e, t, n, r, i, a) {
|
|
4075
4165
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4076
4166
|
if (c < .001) return [
|
|
4077
4167
|
e,
|
|
@@ -4086,17 +4176,17 @@ function yn(e, t, n, r, i, a) {
|
|
|
4086
4176
|
}
|
|
4087
4177
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4088
4178
|
}
|
|
4089
|
-
function
|
|
4179
|
+
function wn(e, t, n) {
|
|
4090
4180
|
if (e.length < 4) return e;
|
|
4091
4181
|
let r = [];
|
|
4092
4182
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4093
|
-
let a =
|
|
4183
|
+
let a = Cn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4094
4184
|
if (i === 0) r.push(...a);
|
|
4095
4185
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4096
4186
|
}
|
|
4097
4187
|
return r;
|
|
4098
4188
|
}
|
|
4099
|
-
function
|
|
4189
|
+
function Tn(e, t, n, r, i, a) {
|
|
4100
4190
|
let o = [
|
|
4101
4191
|
e,
|
|
4102
4192
|
t,
|
|
@@ -4108,12 +4198,12 @@ function xn(e, t, n, r, i, a) {
|
|
|
4108
4198
|
t + r
|
|
4109
4199
|
], s = [];
|
|
4110
4200
|
for (let e = 0; e < 4; e++) {
|
|
4111
|
-
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u =
|
|
4201
|
+
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = Cn(t, n, c, l, i, a);
|
|
4112
4202
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4113
4203
|
}
|
|
4114
4204
|
return s;
|
|
4115
4205
|
}
|
|
4116
|
-
function
|
|
4206
|
+
function En(e, t, n, r, i) {
|
|
4117
4207
|
let a = [];
|
|
4118
4208
|
for (let o = 0; o < 24; o++) {
|
|
4119
4209
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4121,31 +4211,31 @@ function Sn(e, t, n, r, i) {
|
|
|
4121
4211
|
}
|
|
4122
4212
|
return a;
|
|
4123
4213
|
}
|
|
4124
|
-
function
|
|
4214
|
+
function Dn(e, t, n) {
|
|
4125
4215
|
let r = e.length / 2;
|
|
4126
4216
|
if (r < 2) return e;
|
|
4127
4217
|
let i = [];
|
|
4128
4218
|
for (let a = 0; a < r; a++) {
|
|
4129
|
-
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d =
|
|
4219
|
+
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = Cn(o, s, l, u, t, n);
|
|
4130
4220
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4131
4221
|
}
|
|
4132
4222
|
return i;
|
|
4133
4223
|
}
|
|
4134
4224
|
//#endregion
|
|
4135
4225
|
//#region src/style/shape/SketchyStyle.ts
|
|
4136
|
-
function
|
|
4226
|
+
function On(e, t) {
|
|
4137
4227
|
if (!t) return e;
|
|
4138
4228
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4139
4229
|
if (!n) return e;
|
|
4140
4230
|
let r = parseFloat(n[1]);
|
|
4141
4231
|
return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
|
|
4142
4232
|
}
|
|
4143
|
-
function
|
|
4233
|
+
function kn(e) {
|
|
4144
4234
|
let { jitter: t, color: n } = e;
|
|
4145
4235
|
return { transform(e) {
|
|
4146
4236
|
switch (e.type) {
|
|
4147
4237
|
case "rect": {
|
|
4148
|
-
let r =
|
|
4238
|
+
let r = xn(Sn(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
|
|
4149
4239
|
if (e.cornerRadius && e.cornerRadius > 0) {
|
|
4150
4240
|
let n = [];
|
|
4151
4241
|
if (i && n.push({
|
|
@@ -4158,7 +4248,7 @@ function Tn(e) {
|
|
|
4158
4248
|
}), a && e.paint.strokeWidth) {
|
|
4159
4249
|
let i = {
|
|
4160
4250
|
type: "polygon",
|
|
4161
|
-
vertices:
|
|
4251
|
+
vertices: Tn(e.x, e.y, e.width, e.height, t, r),
|
|
4162
4252
|
paint: {
|
|
4163
4253
|
stroke: a,
|
|
4164
4254
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4173,7 +4263,7 @@ function Tn(e) {
|
|
|
4173
4263
|
}
|
|
4174
4264
|
return {
|
|
4175
4265
|
type: "polygon",
|
|
4176
|
-
vertices:
|
|
4266
|
+
vertices: Tn(e.x, e.y, e.width, e.height, t, r),
|
|
4177
4267
|
paint: {
|
|
4178
4268
|
fill: i,
|
|
4179
4269
|
stroke: a,
|
|
@@ -4185,10 +4275,10 @@ function Tn(e) {
|
|
|
4185
4275
|
};
|
|
4186
4276
|
}
|
|
4187
4277
|
case "circle": {
|
|
4188
|
-
let r =
|
|
4278
|
+
let r = xn(Sn(e.cx, e.cy, e.radius));
|
|
4189
4279
|
return {
|
|
4190
4280
|
type: "polygon",
|
|
4191
|
-
vertices:
|
|
4281
|
+
vertices: En(e.cx, e.cy, e.radius, t, r),
|
|
4192
4282
|
paint: {
|
|
4193
4283
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4194
4284
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4200,7 +4290,7 @@ function Tn(e) {
|
|
|
4200
4290
|
};
|
|
4201
4291
|
}
|
|
4202
4292
|
case "line": {
|
|
4203
|
-
let r =
|
|
4293
|
+
let r = xn(Sn(...e.points.slice(0, 4))), i = wn(e.points, t, r), a = On(n, e.paint.stroke), o = {
|
|
4204
4294
|
...e.paint,
|
|
4205
4295
|
stroke: a
|
|
4206
4296
|
};
|
|
@@ -4211,7 +4301,7 @@ function Tn(e) {
|
|
|
4211
4301
|
};
|
|
4212
4302
|
}
|
|
4213
4303
|
case "polygon": {
|
|
4214
|
-
let r =
|
|
4304
|
+
let r = xn(Sn(...e.vertices.slice(0, 4))), i = Dn(e.vertices, t, r);
|
|
4215
4305
|
return {
|
|
4216
4306
|
...e,
|
|
4217
4307
|
vertices: i,
|
|
@@ -4233,10 +4323,10 @@ function Tn(e) {
|
|
|
4233
4323
|
}
|
|
4234
4324
|
//#endregion
|
|
4235
4325
|
//#region src/style/shape/IsometricStyle.ts
|
|
4236
|
-
function
|
|
4237
|
-
return
|
|
4326
|
+
function An(e, t) {
|
|
4327
|
+
return K(e, (e) => v(e, t));
|
|
4238
4328
|
}
|
|
4239
|
-
function
|
|
4329
|
+
function jn(e, t) {
|
|
4240
4330
|
if (!t || typeof t == "string") return t;
|
|
4241
4331
|
if (t.type === "linear") {
|
|
4242
4332
|
let [n, r] = e(t.x0, t.y0), [i, a] = e(t.x1, t.y1);
|
|
@@ -4259,16 +4349,16 @@ function Dn(e, t) {
|
|
|
4259
4349
|
}
|
|
4260
4350
|
return i;
|
|
4261
4351
|
}
|
|
4262
|
-
function
|
|
4352
|
+
function Mn(e) {
|
|
4263
4353
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4264
4354
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4265
4355
|
}
|
|
4266
|
-
function
|
|
4356
|
+
function Nn(e) {
|
|
4267
4357
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4268
4358
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4269
4359
|
}
|
|
4270
|
-
var
|
|
4271
|
-
function
|
|
4360
|
+
var Y = 32;
|
|
4361
|
+
function Pn(e, t) {
|
|
4272
4362
|
let n = Array(t.length);
|
|
4273
4363
|
for (let r = 0; r < t.length; r += 2) {
|
|
4274
4364
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4276,7 +4366,7 @@ function An(e, t) {
|
|
|
4276
4366
|
}
|
|
4277
4367
|
return n;
|
|
4278
4368
|
}
|
|
4279
|
-
function
|
|
4369
|
+
function Fn(e, t, n, r, i) {
|
|
4280
4370
|
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);
|
|
4281
4371
|
return [
|
|
4282
4372
|
a,
|
|
@@ -4289,8 +4379,8 @@ function jn(e, t, n, r, i) {
|
|
|
4289
4379
|
f
|
|
4290
4380
|
];
|
|
4291
4381
|
}
|
|
4292
|
-
function
|
|
4293
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
4382
|
+
function In(e = {}) {
|
|
4383
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = Mn(t), i = Nn(t);
|
|
4294
4384
|
function a(e, t, n, i) {
|
|
4295
4385
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4296
4386
|
return [
|
|
@@ -4303,7 +4393,7 @@ function Mn(e = {}) {
|
|
|
4303
4393
|
];
|
|
4304
4394
|
}
|
|
4305
4395
|
function o(e) {
|
|
4306
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
4396
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = Fn(r, t, i, a, o);
|
|
4307
4397
|
if (s.dash || s.dashEnabled) {
|
|
4308
4398
|
let t = [];
|
|
4309
4399
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4329,7 +4419,7 @@ function Mn(e = {}) {
|
|
|
4329
4419
|
if (n > 0 && s.fill) {
|
|
4330
4420
|
let t = [], i = 0;
|
|
4331
4421
|
for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[i * 2 + 1] && (i = e);
|
|
4332
|
-
let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v =
|
|
4422
|
+
let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = jn(r, s.fill);
|
|
4333
4423
|
if (t.push({
|
|
4334
4424
|
type: "polygon",
|
|
4335
4425
|
vertices: [
|
|
@@ -4342,7 +4432,7 @@ function Mn(e = {}) {
|
|
|
4342
4432
|
u,
|
|
4343
4433
|
d + n
|
|
4344
4434
|
],
|
|
4345
|
-
paint: { fill:
|
|
4435
|
+
paint: { fill: An(v, .2) },
|
|
4346
4436
|
layer: e.layer
|
|
4347
4437
|
}), t.push({
|
|
4348
4438
|
type: "polygon",
|
|
@@ -4356,7 +4446,7 @@ function Mn(e = {}) {
|
|
|
4356
4446
|
a,
|
|
4357
4447
|
o + n
|
|
4358
4448
|
],
|
|
4359
|
-
paint: { fill:
|
|
4449
|
+
paint: { fill: An(v, .4) },
|
|
4360
4450
|
layer: e.layer
|
|
4361
4451
|
}), t.push({
|
|
4362
4452
|
type: "polygon",
|
|
@@ -4412,7 +4502,7 @@ function Mn(e = {}) {
|
|
|
4412
4502
|
type: "polygon",
|
|
4413
4503
|
vertices: c,
|
|
4414
4504
|
paint: {
|
|
4415
|
-
fill:
|
|
4505
|
+
fill: jn(r, s.fill),
|
|
4416
4506
|
stroke: s.stroke,
|
|
4417
4507
|
strokeWidth: s.strokeWidth
|
|
4418
4508
|
},
|
|
@@ -4422,15 +4512,15 @@ function Mn(e = {}) {
|
|
|
4422
4512
|
};
|
|
4423
4513
|
}
|
|
4424
4514
|
function s(e) {
|
|
4425
|
-
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(
|
|
4426
|
-
for (let e = 0; e <
|
|
4427
|
-
let n = e /
|
|
4515
|
+
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(Y * 2);
|
|
4516
|
+
for (let e = 0; e < Y; e++) {
|
|
4517
|
+
let n = e / Y * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
|
|
4428
4518
|
s[e * 2] = o, s[e * 2 + 1] = c;
|
|
4429
4519
|
}
|
|
4430
4520
|
if (o.dash || o.dashEnabled) {
|
|
4431
4521
|
let t = [];
|
|
4432
|
-
for (let n = 0; n <
|
|
4433
|
-
let r = (n + 1) %
|
|
4522
|
+
for (let n = 0; n < Y; n++) {
|
|
4523
|
+
let r = (n + 1) % Y;
|
|
4434
4524
|
t.push({
|
|
4435
4525
|
type: "line",
|
|
4436
4526
|
points: [
|
|
@@ -4449,18 +4539,18 @@ function Mn(e = {}) {
|
|
|
4449
4539
|
}
|
|
4450
4540
|
return t;
|
|
4451
4541
|
}
|
|
4452
|
-
let c = [], l =
|
|
4542
|
+
let c = [], l = jn(r, o.fill);
|
|
4453
4543
|
if (n > 0 && o.fill) {
|
|
4454
4544
|
let t = 0, r = 0, i = 0, a = -Infinity, u = Infinity, d = -Infinity;
|
|
4455
|
-
for (let e = 0; e <
|
|
4545
|
+
for (let e = 0; e < Y; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
|
|
4456
4546
|
let f = [], p = t;
|
|
4457
|
-
for (let e = 0; e <=
|
|
4547
|
+
for (let e = 0; e <= Y && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % Y;
|
|
4458
4548
|
for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + n);
|
|
4459
4549
|
c.push({
|
|
4460
4550
|
type: "polygon",
|
|
4461
4551
|
vertices: f,
|
|
4462
4552
|
paint: {
|
|
4463
|
-
fill:
|
|
4553
|
+
fill: An(l, .2),
|
|
4464
4554
|
stroke: o.stroke,
|
|
4465
4555
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4466
4556
|
},
|
|
@@ -4468,13 +4558,13 @@ function Mn(e = {}) {
|
|
|
4468
4558
|
});
|
|
4469
4559
|
let m = [];
|
|
4470
4560
|
p = i;
|
|
4471
|
-
for (let e = 0; e <=
|
|
4561
|
+
for (let e = 0; e <= Y && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % Y;
|
|
4472
4562
|
for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + n);
|
|
4473
4563
|
c.push({
|
|
4474
4564
|
type: "polygon",
|
|
4475
4565
|
vertices: m,
|
|
4476
4566
|
paint: {
|
|
4477
|
-
fill:
|
|
4567
|
+
fill: An(l, .4),
|
|
4478
4568
|
stroke: o.stroke,
|
|
4479
4569
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4480
4570
|
},
|
|
@@ -4502,14 +4592,14 @@ function Mn(e = {}) {
|
|
|
4502
4592
|
case "circle": return s(e);
|
|
4503
4593
|
case "line": return {
|
|
4504
4594
|
...e,
|
|
4505
|
-
points:
|
|
4595
|
+
points: Pn(r, e.points)
|
|
4506
4596
|
};
|
|
4507
4597
|
case "polygon": return {
|
|
4508
4598
|
...e,
|
|
4509
|
-
vertices:
|
|
4599
|
+
vertices: Pn(r, e.vertices),
|
|
4510
4600
|
paint: {
|
|
4511
4601
|
...e.paint,
|
|
4512
|
-
fill:
|
|
4602
|
+
fill: jn(r, e.paint.fill)
|
|
4513
4603
|
}
|
|
4514
4604
|
};
|
|
4515
4605
|
case "text": {
|
|
@@ -4565,21 +4655,21 @@ function Mn(e = {}) {
|
|
|
4565
4655
|
}
|
|
4566
4656
|
//#endregion
|
|
4567
4657
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4568
|
-
var
|
|
4569
|
-
function
|
|
4570
|
-
let t =
|
|
4571
|
-
if (!t) return
|
|
4572
|
-
let n =
|
|
4573
|
-
return
|
|
4574
|
-
}
|
|
4575
|
-
function
|
|
4658
|
+
var X = "#1a1a1a", Ln = "#ffc200", Rn = "#ff6600", zn = 26, Bn = 26, Vn = 26, Hn = 255, Un = 194, Wn = 0;
|
|
4659
|
+
function Gn(e) {
|
|
4660
|
+
let t = q(e);
|
|
4661
|
+
if (!t) return J(Hn, Un, Wn);
|
|
4662
|
+
let n = Lt(t);
|
|
4663
|
+
return J(Math.round(zn + (Hn - zn) * n), Math.round(Bn + (Un - Bn) * n), Math.round(Vn + (Wn - Vn) * n), t.a);
|
|
4664
|
+
}
|
|
4665
|
+
function Kn(e) {
|
|
4576
4666
|
return {
|
|
4577
4667
|
...e,
|
|
4578
|
-
fill:
|
|
4579
|
-
stroke: e.stroke ?
|
|
4668
|
+
fill: K(e.fill, Gn),
|
|
4669
|
+
stroke: e.stroke ? X : e.stroke
|
|
4580
4670
|
};
|
|
4581
4671
|
}
|
|
4582
|
-
function
|
|
4672
|
+
function qn(e, t, n, r) {
|
|
4583
4673
|
let i = [], a = e.length;
|
|
4584
4674
|
for (let o = 0; o < a; o++) {
|
|
4585
4675
|
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;
|
|
@@ -4590,7 +4680,7 @@ function Un(e, t, n, r) {
|
|
|
4590
4680
|
}
|
|
4591
4681
|
return i;
|
|
4592
4682
|
}
|
|
4593
|
-
function
|
|
4683
|
+
function Jn(e, t, n, r, i) {
|
|
4594
4684
|
let a = [
|
|
4595
4685
|
[e, t],
|
|
4596
4686
|
[e + n, t],
|
|
@@ -4598,37 +4688,37 @@ function Wn(e, t, n, r, i) {
|
|
|
4598
4688
|
[e, t + r]
|
|
4599
4689
|
], 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 = [];
|
|
4600
4690
|
for (let e = u; e <= d; e++) {
|
|
4601
|
-
let t = e * o, n = t + s, r =
|
|
4602
|
-
r =
|
|
4691
|
+
let t = e * o, n = t + s, r = qn(a, 1, 1, t);
|
|
4692
|
+
r = qn(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
4603
4693
|
}
|
|
4604
4694
|
return f;
|
|
4605
4695
|
}
|
|
4606
|
-
var
|
|
4696
|
+
var Yn = { transform(e, t) {
|
|
4607
4697
|
switch (e.type) {
|
|
4608
4698
|
case "rect": {
|
|
4609
4699
|
if (!e.paint.fill) return {
|
|
4610
4700
|
...e,
|
|
4611
|
-
paint:
|
|
4701
|
+
paint: Kn(e.paint)
|
|
4612
4702
|
};
|
|
4613
4703
|
let n = {
|
|
4614
4704
|
...e,
|
|
4615
4705
|
paint: {
|
|
4616
|
-
fill:
|
|
4706
|
+
fill: X,
|
|
4617
4707
|
strokeWidth: e.paint.strokeWidth
|
|
4618
4708
|
}
|
|
4619
|
-
}, r =
|
|
4709
|
+
}, r = Jn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4620
4710
|
type: "polygon",
|
|
4621
4711
|
vertices: t,
|
|
4622
4712
|
layer: e.layer,
|
|
4623
4713
|
paint: {
|
|
4624
|
-
fill:
|
|
4714
|
+
fill: Ln,
|
|
4625
4715
|
alpha: .65
|
|
4626
4716
|
}
|
|
4627
4717
|
})), i = {
|
|
4628
4718
|
...e,
|
|
4629
4719
|
hit: void 0,
|
|
4630
4720
|
paint: {
|
|
4631
|
-
stroke:
|
|
4721
|
+
stroke: X,
|
|
4632
4722
|
strokeWidth: e.paint.strokeWidth
|
|
4633
4723
|
}
|
|
4634
4724
|
};
|
|
@@ -4640,38 +4730,38 @@ var Gn = { transform(e, t) {
|
|
|
4640
4730
|
}
|
|
4641
4731
|
case "circle": return {
|
|
4642
4732
|
...e,
|
|
4643
|
-
paint:
|
|
4733
|
+
paint: Kn(e.paint)
|
|
4644
4734
|
};
|
|
4645
4735
|
case "polygon": return {
|
|
4646
4736
|
...e,
|
|
4647
4737
|
paint: {
|
|
4648
4738
|
...e.paint,
|
|
4649
|
-
fill: e.paint.fill ?
|
|
4650
|
-
stroke: e.paint.stroke ?
|
|
4739
|
+
fill: e.paint.fill ? Rn : e.paint.fill,
|
|
4740
|
+
stroke: e.paint.stroke ? X : e.paint.stroke
|
|
4651
4741
|
}
|
|
4652
4742
|
};
|
|
4653
4743
|
case "line": return {
|
|
4654
4744
|
...e,
|
|
4655
4745
|
paint: e.paint.stroke ? {
|
|
4656
4746
|
...e.paint,
|
|
4657
|
-
stroke:
|
|
4747
|
+
stroke: Rn
|
|
4658
4748
|
} : e.paint
|
|
4659
4749
|
};
|
|
4660
4750
|
case "text": return {
|
|
4661
4751
|
...e,
|
|
4662
|
-
fill:
|
|
4663
|
-
stroke:
|
|
4752
|
+
fill: Rn,
|
|
4753
|
+
stroke: X,
|
|
4664
4754
|
strokeWidth: t.roomSize * .25
|
|
4665
4755
|
};
|
|
4666
4756
|
case "image":
|
|
4667
4757
|
case "group": return e;
|
|
4668
4758
|
}
|
|
4669
|
-
} },
|
|
4670
|
-
function
|
|
4759
|
+
} }, Xn = "#c8eeff", Zn = "#00c8ff", Qn = "#00ffaa", $n = .2, er = 5, tr = 190;
|
|
4760
|
+
function nr(e, t, n) {
|
|
4671
4761
|
e /= 255, t /= 255, n /= 255;
|
|
4672
4762
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4673
4763
|
if (r === i) return [
|
|
4674
|
-
|
|
4764
|
+
tr,
|
|
4675
4765
|
0,
|
|
4676
4766
|
a
|
|
4677
4767
|
];
|
|
@@ -4682,54 +4772,54 @@ function Qn(e, t, n) {
|
|
|
4682
4772
|
a
|
|
4683
4773
|
];
|
|
4684
4774
|
}
|
|
4685
|
-
function
|
|
4775
|
+
function rr(e, t, n, r = 1) {
|
|
4686
4776
|
e = (e % 360 + 360) % 360;
|
|
4687
4777
|
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;
|
|
4688
4778
|
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);
|
|
4689
4779
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4690
4780
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4691
4781
|
}
|
|
4692
|
-
function
|
|
4693
|
-
let t =
|
|
4694
|
-
if (!t) return
|
|
4695
|
-
let [n, r] =
|
|
4696
|
-
return
|
|
4782
|
+
function ir(e) {
|
|
4783
|
+
let t = q(e);
|
|
4784
|
+
if (!t) return rr(tr, .55, .18);
|
|
4785
|
+
let [n, r] = nr(t.r, t.g, t.b);
|
|
4786
|
+
return rr(r < .08 ? tr : n, .55, .18, t.a);
|
|
4697
4787
|
}
|
|
4698
|
-
function
|
|
4788
|
+
function ar(e) {
|
|
4699
4789
|
return {
|
|
4700
4790
|
...e,
|
|
4701
|
-
fill:
|
|
4702
|
-
stroke: e.stroke ?
|
|
4791
|
+
fill: K(e.fill, ir),
|
|
4792
|
+
stroke: e.stroke ? Zn : e.stroke
|
|
4703
4793
|
};
|
|
4704
4794
|
}
|
|
4705
|
-
function
|
|
4795
|
+
function or(e) {
|
|
4706
4796
|
return {
|
|
4707
|
-
stroke:
|
|
4708
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4709
|
-
alpha:
|
|
4797
|
+
stroke: Zn,
|
|
4798
|
+
strokeWidth: (e.strokeWidth ?? 1) * er,
|
|
4799
|
+
alpha: $n
|
|
4710
4800
|
};
|
|
4711
4801
|
}
|
|
4712
|
-
function
|
|
4802
|
+
function sr(e) {
|
|
4713
4803
|
return {
|
|
4714
|
-
stroke:
|
|
4715
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4716
|
-
alpha:
|
|
4804
|
+
stroke: Qn,
|
|
4805
|
+
strokeWidth: (e.strokeWidth ?? 1) * er,
|
|
4806
|
+
alpha: $n,
|
|
4717
4807
|
dash: e.dash,
|
|
4718
4808
|
dashEnabled: e.dashEnabled
|
|
4719
4809
|
};
|
|
4720
4810
|
}
|
|
4721
|
-
var
|
|
4811
|
+
var cr = { transform(e) {
|
|
4722
4812
|
switch (e.type) {
|
|
4723
4813
|
case "rect": {
|
|
4724
4814
|
let t = {
|
|
4725
4815
|
...e,
|
|
4726
|
-
paint:
|
|
4816
|
+
paint: ar(e.paint)
|
|
4727
4817
|
};
|
|
4728
4818
|
return e.paint.stroke ? [{
|
|
4729
4819
|
...e,
|
|
4730
4820
|
hit: void 0,
|
|
4731
4821
|
paint: {
|
|
4732
|
-
...
|
|
4822
|
+
...or(e.paint),
|
|
4733
4823
|
fill: void 0
|
|
4734
4824
|
}
|
|
4735
4825
|
}, t] : t;
|
|
@@ -4737,13 +4827,13 @@ var ir = { transform(e) {
|
|
|
4737
4827
|
case "circle": {
|
|
4738
4828
|
let t = {
|
|
4739
4829
|
...e,
|
|
4740
|
-
paint:
|
|
4830
|
+
paint: ar(e.paint)
|
|
4741
4831
|
};
|
|
4742
4832
|
return e.paint.stroke ? [{
|
|
4743
4833
|
...e,
|
|
4744
4834
|
hit: void 0,
|
|
4745
4835
|
paint: {
|
|
4746
|
-
...
|
|
4836
|
+
...or(e.paint),
|
|
4747
4837
|
fill: void 0
|
|
4748
4838
|
}
|
|
4749
4839
|
}, t] : t;
|
|
@@ -4760,36 +4850,36 @@ var ir = { transform(e) {
|
|
|
4760
4850
|
...e,
|
|
4761
4851
|
paint: e.paint.stroke ? {
|
|
4762
4852
|
...e.paint,
|
|
4763
|
-
stroke:
|
|
4853
|
+
stroke: Qn
|
|
4764
4854
|
} : e.paint
|
|
4765
4855
|
};
|
|
4766
4856
|
return e.paint.stroke ? [{
|
|
4767
4857
|
...e,
|
|
4768
4858
|
hit: void 0,
|
|
4769
|
-
paint:
|
|
4859
|
+
paint: sr(e.paint)
|
|
4770
4860
|
}, t] : t;
|
|
4771
4861
|
}
|
|
4772
4862
|
case "polygon": return {
|
|
4773
4863
|
...e,
|
|
4774
4864
|
paint: {
|
|
4775
4865
|
...e.paint,
|
|
4776
|
-
fill: e.paint.fill ?
|
|
4866
|
+
fill: e.paint.fill ? Qn : e.paint.fill,
|
|
4777
4867
|
stroke: void 0
|
|
4778
4868
|
}
|
|
4779
4869
|
};
|
|
4780
4870
|
case "text": return {
|
|
4781
4871
|
...e,
|
|
4782
|
-
fill:
|
|
4872
|
+
fill: Xn
|
|
4783
4873
|
};
|
|
4784
4874
|
case "image":
|
|
4785
4875
|
case "group": return e;
|
|
4786
4876
|
}
|
|
4787
|
-
} },
|
|
4877
|
+
} }, lr = {
|
|
4788
4878
|
lighten: .35,
|
|
4789
4879
|
darken: .25
|
|
4790
4880
|
};
|
|
4791
|
-
function
|
|
4792
|
-
let t = e.lighten ??
|
|
4881
|
+
function ur(e = {}) {
|
|
4882
|
+
let t = e.lighten ?? lr.lighten, n = e.darken ?? lr.darken;
|
|
4793
4883
|
function r(e, r, i, a, o) {
|
|
4794
4884
|
let s = e.fill;
|
|
4795
4885
|
if (typeof s != "string") return e;
|
|
@@ -4840,20 +4930,20 @@ function or(e = {}) {
|
|
|
4840
4930
|
}
|
|
4841
4931
|
//#endregion
|
|
4842
4932
|
//#region src/style/index.ts
|
|
4843
|
-
var
|
|
4844
|
-
function
|
|
4845
|
-
return
|
|
4933
|
+
var dr = Yt, fr = cn, pr = bn;
|
|
4934
|
+
function mr(e) {
|
|
4935
|
+
return kn(e);
|
|
4846
4936
|
}
|
|
4847
|
-
function
|
|
4848
|
-
return
|
|
4937
|
+
function hr(e = {}) {
|
|
4938
|
+
return In(e);
|
|
4849
4939
|
}
|
|
4850
|
-
var
|
|
4851
|
-
function
|
|
4852
|
-
return
|
|
4940
|
+
var gr = Yn, _r = cr;
|
|
4941
|
+
function vr(e = {}) {
|
|
4942
|
+
return ur(e);
|
|
4853
4943
|
}
|
|
4854
4944
|
//#endregion
|
|
4855
4945
|
//#region src/rendering/MapRenderer.ts
|
|
4856
|
-
var
|
|
4946
|
+
var yr = class {
|
|
4857
4947
|
get settings() {
|
|
4858
4948
|
return this.state.settings;
|
|
4859
4949
|
}
|
|
@@ -4870,7 +4960,7 @@ var hr = class {
|
|
|
4870
4960
|
return this.backend.events;
|
|
4871
4961
|
}
|
|
4872
4962
|
constructor(e, t, n, r) {
|
|
4873
|
-
this.currentStyle =
|
|
4963
|
+
this.currentStyle = W, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new It(this.state, n);
|
|
4874
4964
|
}
|
|
4875
4965
|
destroy() {
|
|
4876
4966
|
this.backend.destroy();
|
|
@@ -4924,7 +5014,7 @@ var hr = class {
|
|
|
4924
5014
|
this.currentStyle = e, this.backend.setStyle(e);
|
|
4925
5015
|
}
|
|
4926
5016
|
clearStyle() {
|
|
4927
|
-
this.setStyle(
|
|
5017
|
+
this.setStyle(W);
|
|
4928
5018
|
}
|
|
4929
5019
|
getStyle() {
|
|
4930
5020
|
return this.currentStyle;
|
|
@@ -4942,10 +5032,10 @@ var hr = class {
|
|
|
4942
5032
|
this.backend.removeSceneOverlay(e);
|
|
4943
5033
|
}
|
|
4944
5034
|
addLiveEffect(e, t) {
|
|
4945
|
-
this.backend instanceof
|
|
5035
|
+
this.backend instanceof It && this.backend.addLiveEffect(e, t);
|
|
4946
5036
|
}
|
|
4947
5037
|
removeLiveEffect(e) {
|
|
4948
|
-
this.backend instanceof
|
|
5038
|
+
this.backend instanceof It && this.backend.removeLiveEffect(e);
|
|
4949
5039
|
}
|
|
4950
5040
|
hitTest(e, t) {
|
|
4951
5041
|
let n = this.backend.coordinateTransform(e, t);
|
|
@@ -5026,15 +5116,15 @@ var hr = class {
|
|
|
5026
5116
|
getCullingMode() {
|
|
5027
5117
|
return this.state.settings.cullingMode;
|
|
5028
5118
|
}
|
|
5029
|
-
},
|
|
5030
|
-
function
|
|
5119
|
+
}, br = "room";
|
|
5120
|
+
function xr(e, t) {
|
|
5031
5121
|
let n = /* @__PURE__ */ new Map();
|
|
5032
5122
|
function r(e) {
|
|
5033
5123
|
let t = n.get(e);
|
|
5034
5124
|
return t || (t = [], n.set(e, t)), t;
|
|
5035
5125
|
}
|
|
5036
5126
|
function i(e, t, n, i, o, s, c) {
|
|
5037
|
-
let l = e.layer ?? c ??
|
|
5127
|
+
let l = e.layer ?? c ?? br;
|
|
5038
5128
|
switch (e.type) {
|
|
5039
5129
|
case "rect": {
|
|
5040
5130
|
let a = {
|
|
@@ -5043,11 +5133,11 @@ function _r(e, t) {
|
|
|
5043
5133
|
y: (n + e.y) * i + s,
|
|
5044
5134
|
w: e.width * i,
|
|
5045
5135
|
h: e.height * i,
|
|
5046
|
-
fill:
|
|
5136
|
+
fill: V(e.paint.fill, t, n, i, o, s),
|
|
5047
5137
|
stroke: e.paint.stroke,
|
|
5048
5138
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
5049
5139
|
cr: (e.cornerRadius ?? 0) * i,
|
|
5050
|
-
dash:
|
|
5140
|
+
dash: Cr(e.paint.dash, i, e.paint.dashEnabled)
|
|
5051
5141
|
};
|
|
5052
5142
|
r(l).push(a);
|
|
5053
5143
|
return;
|
|
@@ -5058,19 +5148,19 @@ function _r(e, t) {
|
|
|
5058
5148
|
cx: (t + e.cx) * i + o,
|
|
5059
5149
|
cy: (n + e.cy) * i + s,
|
|
5060
5150
|
r: e.radius * i,
|
|
5061
|
-
fill:
|
|
5151
|
+
fill: V(e.paint.fill, t, n, i, o, s),
|
|
5062
5152
|
stroke: e.paint.stroke,
|
|
5063
5153
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
5064
|
-
dash:
|
|
5154
|
+
dash: Cr(e.paint.dash, i, e.paint.dashEnabled)
|
|
5065
5155
|
});
|
|
5066
5156
|
return;
|
|
5067
5157
|
case "line": {
|
|
5068
5158
|
let a = {
|
|
5069
5159
|
type: "line",
|
|
5070
|
-
points:
|
|
5160
|
+
points: Sr(e.points, t, n, i, o, s),
|
|
5071
5161
|
stroke: e.paint.stroke,
|
|
5072
5162
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
5073
|
-
dash:
|
|
5163
|
+
dash: Cr(e.paint.dash, i, e.paint.dashEnabled),
|
|
5074
5164
|
lineCap: e.lineCap,
|
|
5075
5165
|
lineJoin: e.lineJoin,
|
|
5076
5166
|
alpha: e.paint.alpha
|
|
@@ -5081,8 +5171,8 @@ function _r(e, t) {
|
|
|
5081
5171
|
case "polygon": {
|
|
5082
5172
|
let a = {
|
|
5083
5173
|
type: "polygon",
|
|
5084
|
-
vertices:
|
|
5085
|
-
fill:
|
|
5174
|
+
vertices: Sr(e.vertices, t, n, i, o, s),
|
|
5175
|
+
fill: V(e.paint.fill, t, n, i, o, s),
|
|
5086
5176
|
stroke: e.paint.stroke,
|
|
5087
5177
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
5088
5178
|
};
|
|
@@ -5090,7 +5180,7 @@ function _r(e, t) {
|
|
|
5090
5180
|
return;
|
|
5091
5181
|
}
|
|
5092
5182
|
case "text": {
|
|
5093
|
-
let a =
|
|
5183
|
+
let a = wr(e.transform, t, n, i, o, s), c = {
|
|
5094
5184
|
type: "text",
|
|
5095
5185
|
x: a ? 0 : (t + e.x) * i + o,
|
|
5096
5186
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -5113,7 +5203,7 @@ function _r(e, t) {
|
|
|
5113
5203
|
return;
|
|
5114
5204
|
}
|
|
5115
5205
|
case "image": {
|
|
5116
|
-
let a =
|
|
5206
|
+
let a = wr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
|
|
5117
5207
|
r(l).push({
|
|
5118
5208
|
type: "image",
|
|
5119
5209
|
x: c,
|
|
@@ -5133,7 +5223,7 @@ function _r(e, t) {
|
|
|
5133
5223
|
function a(e, t, n, a, o, s, c) {
|
|
5134
5224
|
let l = e.layer ?? c;
|
|
5135
5225
|
if (e.noScale) {
|
|
5136
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
5226
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? br);
|
|
5137
5227
|
d.push({
|
|
5138
5228
|
type: "pushTransform",
|
|
5139
5229
|
matrix: [
|
|
@@ -5160,19 +5250,19 @@ function _r(e, t) {
|
|
|
5160
5250
|
});
|
|
5161
5251
|
return o;
|
|
5162
5252
|
}
|
|
5163
|
-
function
|
|
5253
|
+
function Sr(e, t, n, r, i, a) {
|
|
5164
5254
|
let o = Array(e.length);
|
|
5165
5255
|
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;
|
|
5166
5256
|
return o;
|
|
5167
5257
|
}
|
|
5168
|
-
function
|
|
5258
|
+
function Cr(e, t, n) {
|
|
5169
5259
|
if (n === !1) return;
|
|
5170
5260
|
if (!e || e.length === 0) return e;
|
|
5171
5261
|
let r = Array(e.length);
|
|
5172
5262
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5173
5263
|
return r;
|
|
5174
5264
|
}
|
|
5175
|
-
function
|
|
5265
|
+
function wr(e, t, n, r, i, a) {
|
|
5176
5266
|
if (!e) return;
|
|
5177
5267
|
let [o, s, c, l, u, d] = e;
|
|
5178
5268
|
return [
|
|
@@ -5186,39 +5276,39 @@ function br(e, t, n, r, i, a) {
|
|
|
5186
5276
|
}
|
|
5187
5277
|
//#endregion
|
|
5188
5278
|
//#region src/render/SvgRenderer.ts
|
|
5189
|
-
function
|
|
5279
|
+
function Z(e) {
|
|
5190
5280
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5191
5281
|
}
|
|
5192
|
-
function
|
|
5193
|
-
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ?
|
|
5282
|
+
function Q(e, t) {
|
|
5283
|
+
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? Z(t) : t}"`;
|
|
5194
5284
|
}
|
|
5195
|
-
function
|
|
5285
|
+
function Tr(e) {
|
|
5196
5286
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5197
5287
|
}
|
|
5198
|
-
var
|
|
5199
|
-
function
|
|
5200
|
-
return `mmr-grad-${++
|
|
5288
|
+
var Er = 0;
|
|
5289
|
+
function Dr() {
|
|
5290
|
+
return `mmr-grad-${++Er}`;
|
|
5201
5291
|
}
|
|
5202
|
-
function
|
|
5203
|
-
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${
|
|
5292
|
+
function Or(e, t) {
|
|
5293
|
+
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Z(e.color)}"/>`).join("");
|
|
5204
5294
|
return `<defs><linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${t.x0}" y1="${t.y0}" x2="${t.x1}" y2="${t.y1}">${n}</linearGradient></defs>`;
|
|
5205
5295
|
}
|
|
5206
|
-
function
|
|
5207
|
-
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${
|
|
5296
|
+
function kr(e, t) {
|
|
5297
|
+
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Z(e.color)}"/>`).join(""), r = (t.fx === void 0 ? "" : ` fx="${t.fx}"`) + (t.fy === void 0 ? "" : ` fy="${t.fy}"`) + (t.fr === void 0 ? "" : ` fr="${t.fr}"`);
|
|
5208
5298
|
return `<defs><radialGradient id="${e}" gradientUnits="userSpaceOnUse" cx="${t.cx}" cy="${t.cy}" r="${t.r}"${r}>${n}</radialGradient></defs>`;
|
|
5209
5299
|
}
|
|
5210
|
-
function
|
|
5300
|
+
function Ar(e, t) {
|
|
5211
5301
|
if (e === void 0) return;
|
|
5212
5302
|
if (typeof e == "string") return e;
|
|
5213
|
-
let n =
|
|
5214
|
-
return t.push(e.type === "linear" ?
|
|
5303
|
+
let n = Dr();
|
|
5304
|
+
return t.push(e.type === "linear" ? Or(n, e) : kr(n, e)), `url(#${n})`;
|
|
5215
5305
|
}
|
|
5216
|
-
function
|
|
5306
|
+
function jr(e) {
|
|
5217
5307
|
let t = [];
|
|
5218
|
-
for (let n of e)
|
|
5308
|
+
for (let n of e) Mr(n.commands, t);
|
|
5219
5309
|
return t;
|
|
5220
5310
|
}
|
|
5221
|
-
function
|
|
5311
|
+
function Mr(e, t) {
|
|
5222
5312
|
let n = [];
|
|
5223
5313
|
for (let r of e) switch (r.type) {
|
|
5224
5314
|
case "pushTransform": {
|
|
@@ -5236,21 +5326,21 @@ function Or(e, t) {
|
|
|
5236
5326
|
break;
|
|
5237
5327
|
}
|
|
5238
5328
|
default:
|
|
5239
|
-
|
|
5329
|
+
Nr(r, t);
|
|
5240
5330
|
break;
|
|
5241
5331
|
}
|
|
5242
5332
|
for (; n.length > 0;) t.push(n.pop());
|
|
5243
5333
|
}
|
|
5244
|
-
function
|
|
5334
|
+
function Nr(e, t) {
|
|
5245
5335
|
switch (e.type) {
|
|
5246
5336
|
case "rect": {
|
|
5247
|
-
let n =
|
|
5248
|
-
t.push(`<rect${
|
|
5337
|
+
let n = Ar(e.fill, t) ?? "none", r = e.cr > 0 ? `${Q("rx", e.cr)}${Q("ry", e.cr)}` : "";
|
|
5338
|
+
t.push(`<rect${Q("x", e.x)}${Q("y", e.y)}${Q("width", e.w)}${Q("height", e.h)}${Q("fill", n)}${Q("stroke", e.stroke)}${e.sw ? Q("stroke-width", e.sw) : ""}${r}${Tr(e.dash)}/>`);
|
|
5249
5339
|
return;
|
|
5250
5340
|
}
|
|
5251
5341
|
case "circle": {
|
|
5252
|
-
let n =
|
|
5253
|
-
t.push(`<circle${
|
|
5342
|
+
let n = Ar(e.fill, t) ?? "none";
|
|
5343
|
+
t.push(`<circle${Q("cx", e.cx)}${Q("cy", e.cy)}${Q("r", e.r)}${Q("fill", n)}${Q("stroke", e.stroke)}${e.sw ? Q("stroke-width", e.sw) : ""}${Tr(e.dash)}/>`);
|
|
5254
5344
|
return;
|
|
5255
5345
|
}
|
|
5256
5346
|
case "line": {
|
|
@@ -5258,7 +5348,7 @@ function kr(e, t) {
|
|
|
5258
5348
|
if (n.length < 2) return;
|
|
5259
5349
|
let r = [];
|
|
5260
5350
|
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
5261
|
-
t.push(`<polyline points="${r.join(" ")}"${
|
|
5351
|
+
t.push(`<polyline points="${r.join(" ")}"${Q("stroke", e.stroke)}${e.sw ? Q("stroke-width", e.sw) : ""}${Tr(e.dash)}${Q("stroke-linecap", e.lineCap)}${Q("stroke-linejoin", e.lineJoin)}${Q("opacity", e.alpha)} fill="none"/>`);
|
|
5262
5352
|
return;
|
|
5263
5353
|
}
|
|
5264
5354
|
case "polygon": {
|
|
@@ -5266,41 +5356,41 @@ function kr(e, t) {
|
|
|
5266
5356
|
if (n.length < 4) return;
|
|
5267
5357
|
let r = [];
|
|
5268
5358
|
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
5269
|
-
let i =
|
|
5270
|
-
t.push(`<polygon points="${r.join(" ")}"${
|
|
5359
|
+
let i = Ar(e.fill, t);
|
|
5360
|
+
t.push(`<polygon points="${r.join(" ")}"${Q("fill", i)}${Q("stroke", e.stroke)}${e.sw ? Q("stroke-width", e.sw) : ""}/>`);
|
|
5271
5361
|
return;
|
|
5272
5362
|
}
|
|
5273
5363
|
case "text": {
|
|
5274
5364
|
let n = e.x, r = e.y, i = "start", a = "auto";
|
|
5275
5365
|
e.w > 0 && (e.align === "center" ? (n = e.x + e.w / 2, i = "middle") : e.align === "right" && (n = e.x + e.w, i = "end")), e.h > 0 && e.vAlign === "middle" && (e.baselineRatio === void 0 ? (r = e.y + e.h / 2, a = "central") : r = e.y + e.h / 2 + e.baselineRatio * e.fontSize);
|
|
5276
5366
|
let o = e.transform ? ` transform="matrix(${e.transform.join(",")})"` : "", s = e.fontStyle === "bold" ? " font-weight=\"bold\"" : "", c = e.stroke && e.sw > 0 ? ` stroke="${e.stroke}" stroke-width="${e.sw}" paint-order="stroke fill"` : "";
|
|
5277
|
-
t.push(`<text${
|
|
5367
|
+
t.push(`<text${Q("x", n)}${Q("y", r)}${Q("font-size", e.fontSize)}${e.fontFamily ? Q("font-family", e.fontFamily) : ""}${s}${Q("fill", e.fill)}${c} text-anchor="${i}" dominant-baseline="${a}"${o}>${Z(e.text)}</text>`);
|
|
5278
5368
|
return;
|
|
5279
5369
|
}
|
|
5280
5370
|
case "image":
|
|
5281
5371
|
if (e.transform) {
|
|
5282
5372
|
let [n, r, i, a, o, s] = e.transform;
|
|
5283
|
-
t.push(`<image${
|
|
5373
|
+
t.push(`<image${Q("width", e.w)}${Q("height", e.h)} href="${Z(e.src)}" transform="matrix(${n},${r},${i},${a},${o},${s})"/>`);
|
|
5284
5374
|
return;
|
|
5285
5375
|
}
|
|
5286
|
-
t.push(`<image${
|
|
5376
|
+
t.push(`<image${Q("x", e.x)}${Q("y", e.y)}${Q("width", e.w)}${Q("height", e.h)} href="${Z(e.src)}"/>`);
|
|
5287
5377
|
return;
|
|
5288
5378
|
}
|
|
5289
5379
|
}
|
|
5290
5380
|
//#endregion
|
|
5291
5381
|
//#region src/render/CanvasRenderer.ts
|
|
5292
|
-
var
|
|
5382
|
+
var Pr = (e) => {
|
|
5293
5383
|
if (typeof Image < "u") {
|
|
5294
5384
|
let t = new Image();
|
|
5295
5385
|
return t.src = e, t;
|
|
5296
5386
|
}
|
|
5297
5387
|
return null;
|
|
5298
5388
|
};
|
|
5299
|
-
function
|
|
5300
|
-
let r = n.imageFactory ??
|
|
5301
|
-
for (let n of t)
|
|
5389
|
+
function Fr(e, t, n = {}) {
|
|
5390
|
+
let r = n.imageFactory ?? Pr;
|
|
5391
|
+
for (let n of t) Ir(e, n.commands, r);
|
|
5302
5392
|
}
|
|
5303
|
-
function
|
|
5393
|
+
function Ir(e, t, n) {
|
|
5304
5394
|
let r = 0;
|
|
5305
5395
|
for (let i of t) switch (i.type) {
|
|
5306
5396
|
case "pushTransform":
|
|
@@ -5314,18 +5404,18 @@ function Mr(e, t, n) {
|
|
|
5314
5404
|
r > 0 && (e.restore(), r--);
|
|
5315
5405
|
break;
|
|
5316
5406
|
default:
|
|
5317
|
-
|
|
5407
|
+
Lr(e, i, n);
|
|
5318
5408
|
break;
|
|
5319
5409
|
}
|
|
5320
5410
|
for (; r > 0;) e.restore(), r--;
|
|
5321
5411
|
}
|
|
5322
|
-
function
|
|
5412
|
+
function Lr(e, t, n) {
|
|
5323
5413
|
switch (t.type) {
|
|
5324
5414
|
case "rect":
|
|
5325
|
-
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 =
|
|
5415
|
+
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 = z(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
5326
5416
|
break;
|
|
5327
5417
|
case "circle":
|
|
5328
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle =
|
|
5418
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = z(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
5329
5419
|
break;
|
|
5330
5420
|
case "line": {
|
|
5331
5421
|
if (t.points.length < 4) break;
|
|
@@ -5339,7 +5429,7 @@ function Nr(e, t, n) {
|
|
|
5339
5429
|
if (t.vertices.length < 4) break;
|
|
5340
5430
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
5341
5431
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
5342
|
-
e.closePath(), t.fill && (e.fillStyle =
|
|
5432
|
+
e.closePath(), t.fill && (e.fillStyle = z(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
5343
5433
|
break;
|
|
5344
5434
|
case "text": {
|
|
5345
5435
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -5380,35 +5470,35 @@ function Nr(e, t, n) {
|
|
|
5380
5470
|
}
|
|
5381
5471
|
//#endregion
|
|
5382
5472
|
//#region src/export/flushSceneShapes.ts
|
|
5383
|
-
function
|
|
5384
|
-
n(e.grid), n(e.link), n(e.room), n(
|
|
5473
|
+
function Rr(e, t, n) {
|
|
5474
|
+
n(e.grid), n(e.link), n(e.room), n(zr(t.state, t.overlays));
|
|
5385
5475
|
for (let e of t.sceneOverlays) {
|
|
5386
5476
|
let r = e.render(t.state, t.viewportBounds);
|
|
5387
5477
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5388
5478
|
}
|
|
5389
5479
|
n(e.topLabel);
|
|
5390
5480
|
}
|
|
5391
|
-
function
|
|
5481
|
+
function zr(e, t) {
|
|
5392
5482
|
let n = e.getOverlaysForArea(t);
|
|
5393
5483
|
if (!n) return [];
|
|
5394
5484
|
let r = e.settings, i = [];
|
|
5395
5485
|
if (n.paths) for (let t of n.paths) {
|
|
5396
|
-
let n =
|
|
5397
|
-
i.push(...
|
|
5486
|
+
let n = pt(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5487
|
+
i.push(...yt(n));
|
|
5398
5488
|
}
|
|
5399
5489
|
if (n.highlights) for (let t of n.highlights) {
|
|
5400
5490
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5401
|
-
n && i.push(
|
|
5491
|
+
n && i.push(mt(dt(n, t.color, r)));
|
|
5402
5492
|
}
|
|
5403
5493
|
if (n.position) {
|
|
5404
5494
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5405
|
-
t && i.push(
|
|
5495
|
+
t && i.push(vt(ft(t, r)));
|
|
5406
5496
|
}
|
|
5407
5497
|
return i;
|
|
5408
5498
|
}
|
|
5409
5499
|
//#endregion
|
|
5410
5500
|
//#region src/export/sceneBounds.ts
|
|
5411
|
-
function
|
|
5501
|
+
function Br(e, t, n = 0) {
|
|
5412
5502
|
if (!t.worldToScene) return e;
|
|
5413
5503
|
let r = [
|
|
5414
5504
|
t.worldToScene(e.x, e.y),
|
|
@@ -5426,15 +5516,15 @@ function Ir(e, t, n = 0) {
|
|
|
5426
5516
|
}
|
|
5427
5517
|
//#endregion
|
|
5428
5518
|
//#region src/export/SvgExporter.ts
|
|
5429
|
-
var
|
|
5519
|
+
var Vr = {
|
|
5430
5520
|
scale: 1,
|
|
5431
5521
|
offsetX: 0,
|
|
5432
5522
|
offsetY: 0
|
|
5433
5523
|
};
|
|
5434
|
-
function
|
|
5524
|
+
function Hr(e) {
|
|
5435
5525
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5436
5526
|
}
|
|
5437
|
-
var
|
|
5527
|
+
var Ur = class {
|
|
5438
5528
|
constructor(e = {}) {
|
|
5439
5529
|
this.options = e;
|
|
5440
5530
|
}
|
|
@@ -5443,30 +5533,30 @@ var zr = class {
|
|
|
5443
5533
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5444
5534
|
let o = a, s = o.getPlane(i);
|
|
5445
5535
|
if (!s) return;
|
|
5446
|
-
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d =
|
|
5536
|
+
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 = Be(new R(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
|
|
5447
5537
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5448
5538
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5449
5539
|
}), p = {
|
|
5450
5540
|
scale: 1,
|
|
5451
5541
|
roomSize: c.roomSize
|
|
5452
|
-
}, m = (e) => t ===
|
|
5453
|
-
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="${
|
|
5542
|
+
}, m = (e) => t === W ? e : Pt(e, t, p), h = Br(u, t, c.roomSize * .5), g = [];
|
|
5543
|
+
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="${Hr(c.backgroundColor)}"/>`), Rr(f, {
|
|
5454
5544
|
state: e,
|
|
5455
5545
|
viewportBounds: d,
|
|
5456
5546
|
sceneOverlays: n,
|
|
5457
5547
|
overlays: this.options.overlays
|
|
5458
5548
|
}, (e) => {
|
|
5459
|
-
e.length !== 0 && g.push(...
|
|
5549
|
+
e.length !== 0 && g.push(...jr(xr(m(e), Vr)));
|
|
5460
5550
|
}), g.push("</svg>"), g.join("\n");
|
|
5461
5551
|
}
|
|
5462
|
-
},
|
|
5552
|
+
}, Wr = class {
|
|
5463
5553
|
constructor(e = {}) {
|
|
5464
5554
|
this.options = e;
|
|
5465
5555
|
}
|
|
5466
5556
|
render({ backend: e }) {
|
|
5467
5557
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5468
5558
|
}
|
|
5469
|
-
},
|
|
5559
|
+
}, Gr = class {
|
|
5470
5560
|
constructor(e = {}) {
|
|
5471
5561
|
this.options = e;
|
|
5472
5562
|
}
|
|
@@ -5483,14 +5573,14 @@ var zr = class {
|
|
|
5483
5573
|
};
|
|
5484
5574
|
//#endregion
|
|
5485
5575
|
//#region src/export/canvasToBytes.ts
|
|
5486
|
-
function
|
|
5576
|
+
function Kr(e, t = "image/png", n) {
|
|
5487
5577
|
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);
|
|
5488
5578
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5489
5579
|
return s;
|
|
5490
5580
|
}
|
|
5491
5581
|
//#endregion
|
|
5492
5582
|
//#region src/export/CanvasExporter.ts
|
|
5493
|
-
var
|
|
5583
|
+
var qr = class {
|
|
5494
5584
|
constructor(e) {
|
|
5495
5585
|
this.options = e;
|
|
5496
5586
|
}
|
|
@@ -5499,71 +5589,71 @@ var Ur = class {
|
|
|
5499
5589
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5500
5590
|
let s = o, c = s.getPlane(a);
|
|
5501
5591
|
if (!c) return;
|
|
5502
|
-
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 =
|
|
5592
|
+
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 = Br(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 = {
|
|
5503
5593
|
scale: h,
|
|
5504
5594
|
offsetX: v,
|
|
5505
5595
|
offsetY: y
|
|
5506
|
-
}, x =
|
|
5596
|
+
}, x = D.forRenderCamera(u, d, h, v, y), S = {
|
|
5507
5597
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5508
5598
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5509
|
-
}, C =
|
|
5599
|
+
}, C = Be(new R(e.mapReader, l).buildScene(s, c, a, e.lens), x.getViewportBounds(), l, S), w = r.Util.createCanvasElement();
|
|
5510
5600
|
w.width = u, w.height = d;
|
|
5511
5601
|
let T = w.getContext("2d");
|
|
5512
5602
|
if (!T) return;
|
|
5513
5603
|
T.fillStyle = l.backgroundColor, T.fillRect(0, 0, u, d);
|
|
5514
|
-
let
|
|
5604
|
+
let E = {
|
|
5515
5605
|
scale: h,
|
|
5516
5606
|
roomSize: l.roomSize
|
|
5517
|
-
},
|
|
5518
|
-
return
|
|
5607
|
+
}, O = (e) => t === W ? e : Pt(e, t, E);
|
|
5608
|
+
return Rr(C, {
|
|
5519
5609
|
state: e,
|
|
5520
|
-
viewportBounds:
|
|
5610
|
+
viewportBounds: D.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5521
5611
|
sceneOverlays: n,
|
|
5522
5612
|
overlays: this.options.overlays
|
|
5523
5613
|
}, (e) => {
|
|
5524
|
-
e.length !== 0 &&
|
|
5614
|
+
e.length !== 0 && Fr(T, xr(O(e), b));
|
|
5525
5615
|
}), w;
|
|
5526
5616
|
}
|
|
5527
|
-
},
|
|
5617
|
+
}, Jr = class {
|
|
5528
5618
|
constructor(e) {
|
|
5529
|
-
this.options = e, this.canvasExporter = new
|
|
5619
|
+
this.options = e, this.canvasExporter = new qr(e);
|
|
5530
5620
|
}
|
|
5531
5621
|
render(e) {
|
|
5532
5622
|
let t = this.canvasExporter.render(e);
|
|
5533
|
-
if (t) return
|
|
5623
|
+
if (t) return Kr(t, this.options.mimeType, this.options.quality);
|
|
5534
5624
|
}
|
|
5535
|
-
},
|
|
5536
|
-
function
|
|
5625
|
+
}, $, Yr, Xr = 256;
|
|
5626
|
+
function Zr(e, t, n) {
|
|
5537
5627
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5538
|
-
if (
|
|
5539
|
-
let i =
|
|
5628
|
+
if (Yr === r && $) return $;
|
|
5629
|
+
let i = Xr, a = i / 2, o = document.createElement("canvas");
|
|
5540
5630
|
o.width = i, o.height = i;
|
|
5541
5631
|
let s = o.getContext("2d");
|
|
5542
5632
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5543
5633
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5544
5634
|
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";
|
|
5545
5635
|
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);
|
|
5546
|
-
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),
|
|
5636
|
+
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), $ = o.toDataURL(), Yr = r, $;
|
|
5547
5637
|
}
|
|
5548
|
-
function
|
|
5638
|
+
function Qr(e, t, n, r) {
|
|
5549
5639
|
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);
|
|
5550
5640
|
return {
|
|
5551
5641
|
cx: e,
|
|
5552
5642
|
cy: t,
|
|
5553
5643
|
displaySize: u,
|
|
5554
|
-
src:
|
|
5644
|
+
src: Zr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5555
5645
|
};
|
|
5556
5646
|
}
|
|
5557
5647
|
//#endregion
|
|
5558
5648
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5559
|
-
var
|
|
5649
|
+
var $r = {
|
|
5560
5650
|
color: "#ffcc44",
|
|
5561
5651
|
radius: 12,
|
|
5562
5652
|
intensity: .7
|
|
5563
|
-
},
|
|
5653
|
+
}, ei = class {
|
|
5564
5654
|
constructor(e) {
|
|
5565
5655
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5566
|
-
|
|
5656
|
+
...$r,
|
|
5567
5657
|
...e
|
|
5568
5658
|
};
|
|
5569
5659
|
}
|
|
@@ -5586,7 +5676,7 @@ var Yr = {
|
|
|
5586
5676
|
if (e.positionRoomId === void 0) return;
|
|
5587
5677
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5588
5678
|
if (!n) return;
|
|
5589
|
-
let r =
|
|
5679
|
+
let r = Qr(n.x, n.y, t, this.params);
|
|
5590
5680
|
return {
|
|
5591
5681
|
type: "image",
|
|
5592
5682
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5597,7 +5687,7 @@ var Yr = {
|
|
|
5597
5687
|
layer: "overlay"
|
|
5598
5688
|
};
|
|
5599
5689
|
}
|
|
5600
|
-
},
|
|
5690
|
+
}, ti = /* @__PURE__ */ u(((e, t) => {
|
|
5601
5691
|
t.exports = class {
|
|
5602
5692
|
constructor() {
|
|
5603
5693
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5627,14 +5717,14 @@ var Yr = {
|
|
|
5627
5717
|
return this.queue.find((t) => t.key === e);
|
|
5628
5718
|
}
|
|
5629
5719
|
};
|
|
5630
|
-
})),
|
|
5720
|
+
})), ni = /* @__PURE__ */ u(((e, t) => {
|
|
5631
5721
|
function n(e, t) {
|
|
5632
5722
|
let r = /* @__PURE__ */ new Map();
|
|
5633
5723
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5634
5724
|
return r;
|
|
5635
5725
|
}
|
|
5636
5726
|
t.exports = n;
|
|
5637
|
-
})),
|
|
5727
|
+
})), ri = /* @__PURE__ */ u(((e, t) => {
|
|
5638
5728
|
function n(e) {
|
|
5639
5729
|
let t = Number(e);
|
|
5640
5730
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5649,7 +5739,7 @@ var Yr = {
|
|
|
5649
5739
|
}), t;
|
|
5650
5740
|
}
|
|
5651
5741
|
t.exports = r;
|
|
5652
|
-
})),
|
|
5742
|
+
})), ii = /* @__PURE__ */ u(((e, t) => {
|
|
5653
5743
|
function n(e) {
|
|
5654
5744
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5655
5745
|
e.forEach((e, t) => {
|
|
@@ -5661,8 +5751,8 @@ var Yr = {
|
|
|
5661
5751
|
});
|
|
5662
5752
|
}
|
|
5663
5753
|
t.exports = n;
|
|
5664
|
-
})),
|
|
5665
|
-
var n =
|
|
5754
|
+
})), ai = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5755
|
+
var n = ti(), r = ni(), i = ri(), a = ii();
|
|
5666
5756
|
t.exports = class {
|
|
5667
5757
|
constructor(e) {
|
|
5668
5758
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5712,7 +5802,7 @@ var Yr = {
|
|
|
5712
5802
|
return this.path(...e);
|
|
5713
5803
|
}
|
|
5714
5804
|
};
|
|
5715
|
-
})))(), 1),
|
|
5805
|
+
})))(), 1), oi = {
|
|
5716
5806
|
1: "north",
|
|
5717
5807
|
2: "northeast",
|
|
5718
5808
|
3: "northwest",
|
|
@@ -5725,7 +5815,7 @@ var Yr = {
|
|
|
5725
5815
|
10: "down",
|
|
5726
5816
|
11: "in",
|
|
5727
5817
|
12: "out"
|
|
5728
|
-
},
|
|
5818
|
+
}, si = {
|
|
5729
5819
|
north: "n",
|
|
5730
5820
|
northeast: "ne",
|
|
5731
5821
|
northwest: "nw",
|
|
@@ -5738,7 +5828,7 @@ var Yr = {
|
|
|
5738
5828
|
down: "down",
|
|
5739
5829
|
in: "in",
|
|
5740
5830
|
out: "out"
|
|
5741
|
-
},
|
|
5831
|
+
}, ci = class {
|
|
5742
5832
|
constructor(e) {
|
|
5743
5833
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5744
5834
|
}
|
|
@@ -5764,12 +5854,12 @@ var Yr = {
|
|
|
5764
5854
|
buildGraph() {
|
|
5765
5855
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5766
5856
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5767
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
5857
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => oi[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
5768
5858
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5769
5859
|
if (s.has(e)) return;
|
|
5770
5860
|
let c = this.mapReader.getRoom(t);
|
|
5771
5861
|
if (c) {
|
|
5772
|
-
let s =
|
|
5862
|
+
let s = si[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5773
5863
|
a.push({
|
|
5774
5864
|
id: t,
|
|
5775
5865
|
weight: l
|
|
@@ -5800,7 +5890,7 @@ var Yr = {
|
|
|
5800
5890
|
};
|
|
5801
5891
|
//#endregion
|
|
5802
5892
|
//#region src/PathFinder.ts
|
|
5803
|
-
function
|
|
5893
|
+
function li(e, t) {
|
|
5804
5894
|
e.push(t);
|
|
5805
5895
|
let n = e.length - 1;
|
|
5806
5896
|
for (; n > 0;) {
|
|
@@ -5809,7 +5899,7 @@ function ai(e, t) {
|
|
|
5809
5899
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5810
5900
|
}
|
|
5811
5901
|
}
|
|
5812
|
-
function
|
|
5902
|
+
function ui(e) {
|
|
5813
5903
|
if (e.length === 0) return;
|
|
5814
5904
|
let t = e[0], n = e.pop();
|
|
5815
5905
|
if (e.length > 0) {
|
|
@@ -5823,16 +5913,16 @@ function oi(e) {
|
|
|
5823
5913
|
}
|
|
5824
5914
|
return t;
|
|
5825
5915
|
}
|
|
5826
|
-
function
|
|
5916
|
+
function di(e, t, n) {
|
|
5827
5917
|
let r = [n], i = n;
|
|
5828
5918
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5829
5919
|
return r.reverse(), r;
|
|
5830
5920
|
}
|
|
5831
|
-
function
|
|
5921
|
+
function fi(e, t, n) {
|
|
5832
5922
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5833
5923
|
return i ? i.map((e) => Number(e)) : null;
|
|
5834
5924
|
}
|
|
5835
|
-
function
|
|
5925
|
+
function pi(e, t, n, r) {
|
|
5836
5926
|
let i = r.getRoom(n);
|
|
5837
5927
|
if (!i) return null;
|
|
5838
5928
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5841,16 +5931,16 @@ function li(e, t, n, r) {
|
|
|
5841
5931
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5842
5932
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5843
5933
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5844
|
-
for (d.set(t, 0),
|
|
5934
|
+
for (d.set(t, 0), li(p, {
|
|
5845
5935
|
id: t,
|
|
5846
5936
|
priority: u(t)
|
|
5847
5937
|
}); p.length > 0;) {
|
|
5848
|
-
let { id: r } =
|
|
5849
|
-
if (r === n) return
|
|
5938
|
+
let { id: r } = ui(p);
|
|
5939
|
+
if (r === n) return di(f, t, n);
|
|
5850
5940
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5851
5941
|
if (a) for (let e of a) {
|
|
5852
5942
|
let t = i + e.weight;
|
|
5853
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
5943
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), li(p, {
|
|
5854
5944
|
id: e.id,
|
|
5855
5945
|
priority: t + u(e.id)
|
|
5856
5946
|
}));
|
|
@@ -5858,9 +5948,9 @@ function li(e, t, n, r) {
|
|
|
5858
5948
|
}
|
|
5859
5949
|
return null;
|
|
5860
5950
|
}
|
|
5861
|
-
var
|
|
5951
|
+
var mi = class {
|
|
5862
5952
|
constructor(e, t = "dijkstra") {
|
|
5863
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
5953
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new ci(e), this.dijkstraGraph = new ai.default(this.mapGraph.getGraphDefinition());
|
|
5864
5954
|
}
|
|
5865
5955
|
get algorithm() {
|
|
5866
5956
|
return this._algorithm;
|
|
@@ -5879,23 +5969,23 @@ var ui = class {
|
|
|
5879
5969
|
let r;
|
|
5880
5970
|
switch (this._algorithm) {
|
|
5881
5971
|
case "dijkstra":
|
|
5882
|
-
r =
|
|
5972
|
+
r = fi(this.dijkstraGraph, e, t);
|
|
5883
5973
|
break;
|
|
5884
5974
|
case "astar":
|
|
5885
|
-
r =
|
|
5975
|
+
r = pi(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5886
5976
|
break;
|
|
5887
5977
|
}
|
|
5888
5978
|
return this.cache.set(n, r), r;
|
|
5889
5979
|
}
|
|
5890
|
-
},
|
|
5980
|
+
}, hi = {
|
|
5891
5981
|
hidden: 2,
|
|
5892
5982
|
stub: 1,
|
|
5893
5983
|
full: 0
|
|
5894
5984
|
};
|
|
5895
|
-
function
|
|
5896
|
-
return n === "first" ? e : n === "least-restrictive" ?
|
|
5985
|
+
function gi(e, t, n) {
|
|
5986
|
+
return n === "first" ? e : n === "least-restrictive" ? hi[e] < hi[t] ? e : t : hi[e] > hi[t] ? e : t;
|
|
5897
5987
|
}
|
|
5898
|
-
function
|
|
5988
|
+
function _i(e, ...t) {
|
|
5899
5989
|
let n = {}, r;
|
|
5900
5990
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5901
5991
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -5911,7 +6001,7 @@ function fi(e, ...t) {
|
|
|
5911
6001
|
for (let o of r) {
|
|
5912
6002
|
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5913
6003
|
if (a === void 0) a = r;
|
|
5914
|
-
else if (a =
|
|
6004
|
+
else if (a = gi(a, r, i), i === "first") break;
|
|
5915
6005
|
}
|
|
5916
6006
|
return a ?? "full";
|
|
5917
6007
|
},
|
|
@@ -5924,7 +6014,7 @@ function fi(e, ...t) {
|
|
|
5924
6014
|
}
|
|
5925
6015
|
//#endregion
|
|
5926
6016
|
//#region src/lens/ExplorationLens.ts
|
|
5927
|
-
var
|
|
6017
|
+
var vi = class {
|
|
5928
6018
|
constructor(e) {
|
|
5929
6019
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5930
6020
|
}
|
|
@@ -5959,7 +6049,7 @@ var pi = class {
|
|
|
5959
6049
|
clear() {
|
|
5960
6050
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5961
6051
|
}
|
|
5962
|
-
},
|
|
6052
|
+
}, yi = {
|
|
5963
6053
|
1: "north",
|
|
5964
6054
|
2: "northeast",
|
|
5965
6055
|
3: "northwest",
|
|
@@ -5973,7 +6063,7 @@ var pi = class {
|
|
|
5973
6063
|
11: "in",
|
|
5974
6064
|
12: "out"
|
|
5975
6065
|
};
|
|
5976
|
-
function
|
|
6066
|
+
function bi() {
|
|
5977
6067
|
return {
|
|
5978
6068
|
areaWidth: 150,
|
|
5979
6069
|
areaHeight: 80,
|
|
@@ -5987,9 +6077,9 @@ function hi() {
|
|
|
5987
6077
|
highlightColor: "#ff9900"
|
|
5988
6078
|
};
|
|
5989
6079
|
}
|
|
5990
|
-
var
|
|
6080
|
+
var xi = class {
|
|
5991
6081
|
constructor(e, t, n) {
|
|
5992
|
-
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ??
|
|
6082
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? bi(), this.stage = new r.Stage({
|
|
5993
6083
|
container: e,
|
|
5994
6084
|
width: e.clientWidth,
|
|
5995
6085
|
height: e.clientHeight,
|
|
@@ -6172,14 +6262,14 @@ var gi = class {
|
|
|
6172
6262
|
toAreaId: e.fromAreaId,
|
|
6173
6263
|
fromRoomId: e.toRoomId,
|
|
6174
6264
|
toRoomId: e.fromRoomId,
|
|
6175
|
-
direction: e.direction ?
|
|
6265
|
+
direction: e.direction ? N[e.direction] : null,
|
|
6176
6266
|
fromRoomPosition: e.toRoomPosition,
|
|
6177
6267
|
toRoomPosition: e.fromRoomPosition
|
|
6178
6268
|
});
|
|
6179
6269
|
}
|
|
6180
6270
|
}
|
|
6181
6271
|
getLockedDirections(e) {
|
|
6182
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6272
|
+
return new Set((e.exitLocks ?? []).map((e) => yi[e]).filter((e) => !!e));
|
|
6183
6273
|
}
|
|
6184
6274
|
createConnection(e, t, n) {
|
|
6185
6275
|
let r = this.toPlanarDirection(n);
|
|
@@ -6248,7 +6338,7 @@ var gi = class {
|
|
|
6248
6338
|
}[e.toLowerCase().trim()] ?? null;
|
|
6249
6339
|
}
|
|
6250
6340
|
toPlanarDirection(e) {
|
|
6251
|
-
return e &&
|
|
6341
|
+
return e && te.includes(e) ? e : null;
|
|
6252
6342
|
}
|
|
6253
6343
|
layoutAreas() {
|
|
6254
6344
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6791,6 +6881,6 @@ var gi = class {
|
|
|
6791
6881
|
}
|
|
6792
6882
|
};
|
|
6793
6883
|
//#endregion
|
|
6794
|
-
export { C as ALL_VISIBLE,
|
|
6884
|
+
export { C as ALL_VISIBLE, ei as AmbientLightOverlay, e as Area, xi as AreaMapRenderer, fr as Blueprint, D as Camera, qr as CanvasExporter, gr as Construction, ee as CullingManager, Ke as DrawCommandLayerNode, vi as ExplorationLens, vr as GradientRooms, Ct as HitTester, O as IDENTITY_TRANSFORM, hr as Isometric, ci as MapGraph, n as MapReader, yr as MapRenderer, T as MapState, qe as MaterializingLayerNode, pr as Neon, dr as Parchment, mi as PathFinder, t as Plane, Gr as PngBlobExporter, Jr as PngBytesExporter, Wr as PngExporter, Ge as RecordingGroupNode, B as RecordingLayerNode, _r as SciFi, mr as Sketchy, Ur as SvgExporter, Pt as applyStyleToShapes, xr as buildDrawCommands, Kr as canvasToBytes, _ as colorLightness, Nt as compose, _i as composeLenses, lt as computePathData, bi as createAreaMapSettings, g as createSettings, v as darkenColor, w as defaultExitTreatment, x as hexToRgba, W as identityStyle, Je as isGradientFill, Fr as renderToCanvas, Xe as shapeToRecording, jr as svgFromBatches, V as transformFill };
|
|
6795
6885
|
|
|
6796
6886
|
//# sourceMappingURL=index.mjs.map
|