mudlet-map-renderer 1.2.0 → 1.2.2
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/index.mjs +474 -508
- package/dist/index.mjs.map +1 -1
- package/dist/scene/InnerExitStyle.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -599,7 +599,7 @@ var D = class e extends S {
|
|
|
599
599
|
"northwest",
|
|
600
600
|
"southeast",
|
|
601
601
|
"southwest"
|
|
602
|
-
],
|
|
602
|
+
], A = {
|
|
603
603
|
n: "north",
|
|
604
604
|
s: "south",
|
|
605
605
|
e: "east",
|
|
@@ -608,7 +608,7 @@ var D = class e extends S {
|
|
|
608
608
|
nw: "northwest",
|
|
609
609
|
se: "southeast",
|
|
610
610
|
sw: "southwest"
|
|
611
|
-
},
|
|
611
|
+
}, j = {
|
|
612
612
|
north: "n",
|
|
613
613
|
south: "s",
|
|
614
614
|
east: "e",
|
|
@@ -621,7 +621,7 @@ var D = class e extends S {
|
|
|
621
621
|
down: "d",
|
|
622
622
|
in: "i",
|
|
623
623
|
out: "o"
|
|
624
|
-
},
|
|
624
|
+
}, M = {
|
|
625
625
|
north: {
|
|
626
626
|
x: 0,
|
|
627
627
|
y: -1
|
|
@@ -654,7 +654,7 @@ var D = class e extends S {
|
|
|
654
654
|
x: -1,
|
|
655
655
|
y: 1
|
|
656
656
|
}
|
|
657
|
-
},
|
|
657
|
+
}, N = [
|
|
658
658
|
"north",
|
|
659
659
|
"south",
|
|
660
660
|
"east",
|
|
@@ -663,7 +663,7 @@ var D = class e extends S {
|
|
|
663
663
|
"northwest",
|
|
664
664
|
"southeast",
|
|
665
665
|
"southwest"
|
|
666
|
-
],
|
|
666
|
+
], P = {
|
|
667
667
|
north: "south",
|
|
668
668
|
south: "north",
|
|
669
669
|
east: "west",
|
|
@@ -673,39 +673,39 @@ var D = class e extends S {
|
|
|
673
673
|
southeast: "northwest",
|
|
674
674
|
southwest: "northeast"
|
|
675
675
|
};
|
|
676
|
-
function
|
|
677
|
-
return e ? Object.prototype.hasOwnProperty.call(
|
|
676
|
+
function F(e) {
|
|
677
|
+
return e ? Object.prototype.hasOwnProperty.call(M, e) : !1;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
if (!
|
|
679
|
+
function I(e, t, n, r = 1) {
|
|
680
|
+
if (!F(n)) return {
|
|
681
681
|
x: e,
|
|
682
682
|
y: t
|
|
683
683
|
};
|
|
684
|
-
let i =
|
|
684
|
+
let i = M[n];
|
|
685
685
|
return {
|
|
686
686
|
x: e + i.x * r,
|
|
687
687
|
y: t + i.y * r
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
if (!
|
|
690
|
+
function L(e, t, n, r = 1, i = 0) {
|
|
691
|
+
if (!F(n)) return {
|
|
692
692
|
x: e,
|
|
693
693
|
y: t
|
|
694
694
|
};
|
|
695
|
-
let a =
|
|
696
|
-
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return
|
|
695
|
+
let a = M[n];
|
|
696
|
+
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return I(e, t, n, r);
|
|
697
697
|
let o = r - i + i / Math.SQRT2;
|
|
698
698
|
return {
|
|
699
699
|
x: e + a.x * o,
|
|
700
700
|
y: t + a.y * o
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
if (!
|
|
703
|
+
function te(e, t, n, r = 1) {
|
|
704
|
+
if (!F(n)) return {
|
|
705
705
|
x: e,
|
|
706
706
|
y: t
|
|
707
707
|
};
|
|
708
|
-
let i =
|
|
708
|
+
let i = M[n], a = Math.atan2(i.y, i.x);
|
|
709
709
|
return {
|
|
710
710
|
x: e + Math.cos(a) * r,
|
|
711
711
|
y: t + Math.sin(a) * r
|
|
@@ -713,26 +713,26 @@ function re(e, t, n, r = 1) {
|
|
|
713
713
|
}
|
|
714
714
|
//#endregion
|
|
715
715
|
//#region src/ExitRenderer.ts
|
|
716
|
-
var
|
|
716
|
+
var ne = {
|
|
717
717
|
OPEN_DOOR: "rgb(10, 155, 10)",
|
|
718
718
|
CLOSED_DOOR: "rgb(226, 205, 59)",
|
|
719
719
|
LOCKED_DOOR: "rgb(155, 10, 10)",
|
|
720
720
|
ONE_WAY_FILL: "rgb(155, 10, 10)"
|
|
721
721
|
};
|
|
722
|
-
function
|
|
722
|
+
function re(e) {
|
|
723
723
|
switch (e) {
|
|
724
|
-
case 1: return
|
|
725
|
-
case 2: return
|
|
726
|
-
default: return
|
|
724
|
+
case 1: return ne.OPEN_DOOR;
|
|
725
|
+
case 2: return ne.CLOSED_DOOR;
|
|
726
|
+
default: return ne.LOCKED_DOOR;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
var
|
|
729
|
+
var ie = class {
|
|
730
730
|
constructor(e, t) {
|
|
731
731
|
this.mapReader = e, this.settings = t;
|
|
732
732
|
}
|
|
733
733
|
getRoomEdgePoint(e, t, n, r) {
|
|
734
734
|
let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
|
|
735
|
-
return this.settings.roomShape === "circle" ?
|
|
735
|
+
return this.settings.roomShape === "circle" ? te(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? L(e, t, n, i, this.settings.roomSize * .2) : I(e, t, n, i);
|
|
736
736
|
}
|
|
737
737
|
renderData(e, t) {
|
|
738
738
|
return this.renderDataWithColor(e, this.settings.lineColor, t);
|
|
@@ -747,7 +747,7 @@ var oe = class {
|
|
|
747
747
|
}
|
|
748
748
|
renderTwoWayExitData(e, t, n) {
|
|
749
749
|
let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
|
|
750
|
-
if (!r || !i || !e.aDir || !e.bDir || r.customLines[
|
|
750
|
+
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
751
|
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
752
|
a.x,
|
|
753
753
|
a.y,
|
|
@@ -757,7 +757,7 @@ var oe = class {
|
|
|
757
757
|
points: s,
|
|
758
758
|
stroke: t,
|
|
759
759
|
strokeWidth: this.settings.lineWidth
|
|
760
|
-
}], l = [], u = r.doors[
|
|
760
|
+
}], l = [], u = r.doors[j[e.aDir]] ?? i.doors[j[e.bDir]];
|
|
761
761
|
if (u) {
|
|
762
762
|
let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
|
|
763
763
|
l.push({
|
|
@@ -765,7 +765,7 @@ var oe = class {
|
|
|
765
765
|
y: t - this.settings.roomSize / 4,
|
|
766
766
|
width: this.settings.roomSize / 2,
|
|
767
767
|
height: this.settings.roomSize / 2,
|
|
768
|
-
stroke:
|
|
768
|
+
stroke: re(u),
|
|
769
769
|
strokeWidth: this.settings.lineWidth
|
|
770
770
|
});
|
|
771
771
|
}
|
|
@@ -796,9 +796,9 @@ var oe = class {
|
|
|
796
796
|
}
|
|
797
797
|
renderOneWayExitData(e, t, n) {
|
|
798
798
|
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 || !k.includes(o) || i.customLines[
|
|
799
|
+
if (!o || !i || !a || !k.includes(o) || i.customLines[j[o] || o]) return;
|
|
800
800
|
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 =
|
|
801
|
+
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = I(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
|
|
802
802
|
return {
|
|
803
803
|
lines: [],
|
|
804
804
|
arrows: [{
|
|
@@ -837,8 +837,8 @@ var oe = class {
|
|
|
837
837
|
x: a.x,
|
|
838
838
|
y: a.y
|
|
839
839
|
};
|
|
840
|
-
s && (c =
|
|
841
|
-
let l =
|
|
840
|
+
s && (c = I(i.x, i.y, o, this.settings.roomSize / 2));
|
|
841
|
+
let l = I(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
842
|
f.x,
|
|
843
843
|
f.y,
|
|
844
844
|
c.x,
|
|
@@ -870,7 +870,7 @@ var oe = class {
|
|
|
870
870
|
pointerWidth: .35,
|
|
871
871
|
strokeWidth: this.settings.lineWidth * 1.4,
|
|
872
872
|
stroke: t,
|
|
873
|
-
fill:
|
|
873
|
+
fill: ne.ONE_WAY_FILL,
|
|
874
874
|
dash: [.1, .05]
|
|
875
875
|
}],
|
|
876
876
|
doors: [],
|
|
@@ -925,7 +925,7 @@ var oe = class {
|
|
|
925
925
|
for (let [r, i] of Object.entries(e.customLines)) {
|
|
926
926
|
let a = e.specialExits[r];
|
|
927
927
|
if (a === void 0) {
|
|
928
|
-
let t =
|
|
928
|
+
let t = A[r] ?? n[r];
|
|
929
929
|
t && (a = e.exits[t] ?? e.specialExits[t]);
|
|
930
930
|
}
|
|
931
931
|
if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
|
|
@@ -957,7 +957,7 @@ var oe = class {
|
|
|
957
957
|
}
|
|
958
958
|
return t;
|
|
959
959
|
}
|
|
960
|
-
},
|
|
960
|
+
}, ae = {
|
|
961
961
|
1: "north",
|
|
962
962
|
2: "northeast",
|
|
963
963
|
3: "northwest",
|
|
@@ -971,15 +971,15 @@ var oe = class {
|
|
|
971
971
|
11: "in",
|
|
972
972
|
12: "out"
|
|
973
973
|
};
|
|
974
|
-
function
|
|
975
|
-
return e.roomShape === "circle" ?
|
|
974
|
+
function oe(e, t, n, r, i) {
|
|
975
|
+
return e.roomShape === "circle" ? te(t, n, r, i) : e.roomShape === "roundedRectangle" ? L(t, n, r, i, e.roomSize * .2) : I(t, n, r, i);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function se(e, t, n) {
|
|
978
978
|
let r = [];
|
|
979
979
|
for (let i of e.stubs) {
|
|
980
|
-
let a =
|
|
980
|
+
let a = ae[i];
|
|
981
981
|
if (!a) continue;
|
|
982
|
-
let o =
|
|
982
|
+
let o = oe(t, e.x, e.y, a, t.roomSize / 2), s = I(e.x, e.y, a, t.roomSize / 2 + .5);
|
|
983
983
|
r.push({
|
|
984
984
|
roomId: e.id,
|
|
985
985
|
direction: a,
|
|
@@ -995,12 +995,12 @@ function le(e, t, n) {
|
|
|
995
995
|
}
|
|
996
996
|
//#endregion
|
|
997
997
|
//#region src/scene/SpecialExitStyle.ts
|
|
998
|
-
var
|
|
998
|
+
var ce = {
|
|
999
999
|
1: "rgb(10, 155, 10)",
|
|
1000
1000
|
2: "rgb(226, 205, 59)",
|
|
1001
1001
|
3: "rgb(155, 10, 10)"
|
|
1002
1002
|
};
|
|
1003
|
-
function
|
|
1003
|
+
function le(e, t, n) {
|
|
1004
1004
|
let r = [];
|
|
1005
1005
|
for (let [i, a] of Object.entries(e.customLines)) {
|
|
1006
1006
|
let o = [e.x, e.y];
|
|
@@ -1047,7 +1047,7 @@ function de(e, t, n) {
|
|
|
1047
1047
|
y: n - r / 2,
|
|
1048
1048
|
width: r,
|
|
1049
1049
|
height: r,
|
|
1050
|
-
stroke:
|
|
1050
|
+
stroke: ce[f] ?? ce[3],
|
|
1051
1051
|
strokeWidth: t.lineWidth
|
|
1052
1052
|
};
|
|
1053
1053
|
}
|
|
@@ -1062,33 +1062,33 @@ function de(e, t, n) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
//#endregion
|
|
1064
1064
|
//#region src/utils/textMeasure.ts
|
|
1065
|
-
var
|
|
1066
|
-
function
|
|
1067
|
-
return
|
|
1065
|
+
var ue = 72, R = 200, de = 120, fe = /* @__PURE__ */ new Map(), z = null;
|
|
1066
|
+
function pe() {
|
|
1067
|
+
return z || (z = r.Util.createCanvasElement(), z.width = R, z.height = R), z;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let n = `${e}::${t}`, r =
|
|
1069
|
+
function me(e, t) {
|
|
1070
|
+
let n = `${e}::${t}`, r = fe.get(n);
|
|
1071
1071
|
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 <
|
|
1072
|
+
let i = pe().getContext("2d", { willReadFrequently: !0 }), a = `bold ${ue}px ${t}`;
|
|
1073
|
+
i.clearRect(0, 0, R, R), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, R / 2, de);
|
|
1074
|
+
let { data: o } = i.getImageData(0, 0, R, R), s = R, c = -1;
|
|
1075
|
+
for (let e = 0; e < R; e++) for (let t = 0; t < R; t++) o[(e * R + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
|
|
1076
1076
|
if (c === -1) {
|
|
1077
1077
|
let e = {
|
|
1078
1078
|
baselineRatio: .35,
|
|
1079
1079
|
konvaCorrectionRatio: 0
|
|
1080
1080
|
};
|
|
1081
|
-
return
|
|
1081
|
+
return fe.set(n, e), e;
|
|
1082
1082
|
}
|
|
1083
|
-
let l = (
|
|
1083
|
+
let l = (de - s - Math.max(0, c - de)) / 2 / ue, u = i.measureText("M"), d = {
|
|
1084
1084
|
baselineRatio: l,
|
|
1085
|
-
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 /
|
|
1085
|
+
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / ue - l
|
|
1086
1086
|
};
|
|
1087
|
-
return
|
|
1087
|
+
return fe.set(n, d), d;
|
|
1088
1088
|
}
|
|
1089
1089
|
//#endregion
|
|
1090
1090
|
//#region src/scene/RoomStyle.ts
|
|
1091
|
-
function
|
|
1091
|
+
function he(e, t, n, r) {
|
|
1092
1092
|
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
1093
|
return {
|
|
1094
1094
|
fillColor: a,
|
|
@@ -1098,7 +1098,7 @@ function _e(e, t, n, r) {
|
|
|
1098
1098
|
envColor: i
|
|
1099
1099
|
};
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function ge(e, t) {
|
|
1102
1102
|
if (!t.emboss) return null;
|
|
1103
1103
|
let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a = y(e, .35), o = v(e, .45);
|
|
1104
1104
|
if (t.roomShape === "circle") {
|
|
@@ -1202,8 +1202,8 @@ function ve(e, t) {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
//#endregion
|
|
1204
1204
|
//#region src/scene/elements/RoomLayout.ts
|
|
1205
|
-
function
|
|
1206
|
-
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } =
|
|
1205
|
+
function _e(e, t, n, r) {
|
|
1206
|
+
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } = he(e, t, n, r.strokeOverride), c = n.roomSize, l = [], u = ge(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
1207
|
if (f) {
|
|
1208
1208
|
let e = [v(a, .5), a], t = o * 2;
|
|
1209
1209
|
n.roomShape === "circle" ? l.push({
|
|
@@ -1287,7 +1287,7 @@ function ye(e, t, n, r) {
|
|
|
1287
1287
|
lineCap: u.highlight.lineCap,
|
|
1288
1288
|
lineJoin: u.shadow.lineJoin
|
|
1289
1289
|
})), e.roomChar) {
|
|
1290
|
-
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } =
|
|
1290
|
+
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } = me(e.roomChar, n.fontFamily), a = Math.max(c, e.roomChar.length * t * .8), o = (a - c) / 2;
|
|
1291
1291
|
l.push({
|
|
1292
1292
|
type: "text",
|
|
1293
1293
|
x: -o,
|
|
@@ -1320,13 +1320,13 @@ function ye(e, t, n, r) {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
//#endregion
|
|
1322
1322
|
//#region src/scene/InnerExitStyle.ts
|
|
1323
|
-
var
|
|
1323
|
+
var ve = [
|
|
1324
1324
|
"up",
|
|
1325
1325
|
"down",
|
|
1326
1326
|
"in",
|
|
1327
1327
|
"out"
|
|
1328
1328
|
];
|
|
1329
|
-
function
|
|
1329
|
+
function ye(e, t, n, r) {
|
|
1330
1330
|
let i = r * Math.PI / 180, a = [];
|
|
1331
1331
|
for (let r = 0; r < 3; r++) {
|
|
1332
1332
|
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,87 +1334,57 @@ function R(e, t, n, r) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
return a;
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function be(e, t, n) {
|
|
1338
1338
|
let r = e.userData?.["system.fallback_symbol_color"];
|
|
1339
1339
|
return {
|
|
1340
1340
|
symbolColor: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env)),
|
|
1341
1341
|
symbolFill: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6))
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
var
|
|
1344
|
+
var xe = {
|
|
1345
1345
|
1: "rgb(10, 155, 10)",
|
|
1346
1346
|
2: "rgb(226, 205, 59)",
|
|
1347
1347
|
3: "rgb(155, 10, 10)"
|
|
1348
1348
|
};
|
|
1349
|
+
function Se(e, t, n) {
|
|
1350
|
+
let r = n.roomSize, i = r / 5, a = (e, t, n) => ({
|
|
1351
|
+
cx: e,
|
|
1352
|
+
cy: t,
|
|
1353
|
+
vertices: ye(e, t, i, n)
|
|
1354
|
+
});
|
|
1355
|
+
switch (t) {
|
|
1356
|
+
case "up": {
|
|
1357
|
+
let t = I(e.x, e.y, "south", r / 4);
|
|
1358
|
+
return [a(t.x, t.y, 0)];
|
|
1359
|
+
}
|
|
1360
|
+
case "down": {
|
|
1361
|
+
let t = I(e.x, e.y, "north", r / 4);
|
|
1362
|
+
return [a(t.x, t.y, 180)];
|
|
1363
|
+
}
|
|
1364
|
+
case "in": {
|
|
1365
|
+
let t = I(e.x, e.y, "west", r / 4), n = I(e.x, e.y, "east", r / 4);
|
|
1366
|
+
return [a(t.x, t.y, 90), a(n.x, n.y, -90)];
|
|
1367
|
+
}
|
|
1368
|
+
case "out": {
|
|
1369
|
+
let t = I(e.x, e.y, "west", r / 4), n = I(e.x, e.y, "east", r / 4);
|
|
1370
|
+
return [a(t.x, t.y, -90), a(n.x, n.y, 90)];
|
|
1371
|
+
}
|
|
1372
|
+
default: return [];
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1349
1375
|
function Ce(e, t, n) {
|
|
1350
|
-
let r = [],
|
|
1351
|
-
for (let t of
|
|
1376
|
+
let r = [], { symbolColor: i, symbolFill: a } = be(e, t, n);
|
|
1377
|
+
for (let t of ve) {
|
|
1352
1378
|
if (!e.exits[t]) continue;
|
|
1353
|
-
let
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
stroke: l,
|
|
1363
|
-
strokeWidth: n.lineWidth
|
|
1364
|
-
});
|
|
1365
|
-
break;
|
|
1366
|
-
}
|
|
1367
|
-
case "down": {
|
|
1368
|
-
let t = P(e.x, e.y, "north", i / 4);
|
|
1369
|
-
r.push({
|
|
1370
|
-
cx: t.x,
|
|
1371
|
-
cy: t.y,
|
|
1372
|
-
vertices: R(t.x, t.y, a, 180),
|
|
1373
|
-
fill: s,
|
|
1374
|
-
stroke: l,
|
|
1375
|
-
strokeWidth: n.lineWidth
|
|
1376
|
-
});
|
|
1377
|
-
break;
|
|
1378
|
-
}
|
|
1379
|
-
case "in": {
|
|
1380
|
-
let t = P(e.x, e.y, "west", i / 4), o = P(e.x, e.y, "east", i / 4);
|
|
1381
|
-
r.push({
|
|
1382
|
-
cx: t.x,
|
|
1383
|
-
cy: t.y,
|
|
1384
|
-
vertices: R(t.x, t.y, a, 90),
|
|
1385
|
-
fill: s,
|
|
1386
|
-
stroke: l,
|
|
1387
|
-
strokeWidth: n.lineWidth
|
|
1388
|
-
}), r.push({
|
|
1389
|
-
cx: o.x,
|
|
1390
|
-
cy: o.y,
|
|
1391
|
-
vertices: R(o.x, o.y, a, -90),
|
|
1392
|
-
fill: s,
|
|
1393
|
-
stroke: l,
|
|
1394
|
-
strokeWidth: n.lineWidth
|
|
1395
|
-
});
|
|
1396
|
-
break;
|
|
1397
|
-
}
|
|
1398
|
-
case "out": {
|
|
1399
|
-
let t = P(e.x, e.y, "west", i / 4), o = P(e.x, e.y, "east", i / 4);
|
|
1400
|
-
r.push({
|
|
1401
|
-
cx: t.x,
|
|
1402
|
-
cy: t.y,
|
|
1403
|
-
vertices: R(t.x, t.y, a, -90),
|
|
1404
|
-
fill: s,
|
|
1405
|
-
stroke: l,
|
|
1406
|
-
strokeWidth: n.lineWidth
|
|
1407
|
-
}), r.push({
|
|
1408
|
-
cx: o.x,
|
|
1409
|
-
cy: o.y,
|
|
1410
|
-
vertices: R(o.x, o.y, a, 90),
|
|
1411
|
-
fill: s,
|
|
1412
|
-
stroke: l,
|
|
1413
|
-
strokeWidth: n.lineWidth
|
|
1414
|
-
});
|
|
1415
|
-
break;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1379
|
+
let o = e.doors[t], s = o === void 0 ? i : xe[o] ?? xe[3];
|
|
1380
|
+
for (let i of Se(e, t, n)) r.push({
|
|
1381
|
+
cx: i.cx,
|
|
1382
|
+
cy: i.cy,
|
|
1383
|
+
vertices: i.vertices,
|
|
1384
|
+
fill: a,
|
|
1385
|
+
stroke: s,
|
|
1386
|
+
strokeWidth: n.lineWidth
|
|
1387
|
+
});
|
|
1418
1388
|
}
|
|
1419
1389
|
return { triangles: r };
|
|
1420
1390
|
}
|
|
@@ -1686,9 +1656,9 @@ function Pe(e, t) {
|
|
|
1686
1656
|
}
|
|
1687
1657
|
return r;
|
|
1688
1658
|
}
|
|
1689
|
-
var
|
|
1659
|
+
var B = class {
|
|
1690
1660
|
constructor(e, t) {
|
|
1691
|
-
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new
|
|
1661
|
+
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new ie(e, t);
|
|
1692
1662
|
}
|
|
1693
1663
|
buildScene(e, t, n, r = C) {
|
|
1694
1664
|
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.renderLabels(t.getLabels(), e.getAreaId());
|
|
@@ -1727,9 +1697,9 @@ var z = class {
|
|
|
1727
1697
|
renderRooms(e, t) {
|
|
1728
1698
|
let n = /* @__PURE__ */ new Map(), r = [], i = [], a = [], o = [];
|
|
1729
1699
|
e.forEach((e) => {
|
|
1730
|
-
let t =
|
|
1700
|
+
let t = _e(e, this.mapReader, this.settings, { flatPipeline: !0 });
|
|
1731
1701
|
t.children.push(...we(e, this.mapReader, this.settings));
|
|
1732
|
-
for (let t of
|
|
1702
|
+
for (let t of le(e, this.settings)) {
|
|
1733
1703
|
let n = De(t, e.id);
|
|
1734
1704
|
this.linkShapes.push(n);
|
|
1735
1705
|
let r = t.line.points, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
|
|
@@ -1775,7 +1745,7 @@ var z = class {
|
|
|
1775
1745
|
arrowColor: e.arrowColor
|
|
1776
1746
|
});
|
|
1777
1747
|
});
|
|
1778
|
-
for (let t of
|
|
1748
|
+
for (let t of se(e, this.settings)) {
|
|
1779
1749
|
let e = Oe(t);
|
|
1780
1750
|
this.linkShapes.push(e), a.push({
|
|
1781
1751
|
roomId: t.roomId,
|
|
@@ -1863,8 +1833,8 @@ var z = class {
|
|
|
1863
1833
|
let i = r.isVisible(t);
|
|
1864
1834
|
if (i === r.isVisible(n)) return;
|
|
1865
1835
|
let a = i ? t : n, o = i ? e.aDir : e.bDir;
|
|
1866
|
-
if (!o || !k.includes(o) || a.customLines[
|
|
1867
|
-
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l =
|
|
1836
|
+
if (!o || !k.includes(o) || a.customLines[j[o]]) return;
|
|
1837
|
+
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l = I(a.x, a.y, o, s / 2 + .5);
|
|
1868
1838
|
return {
|
|
1869
1839
|
roomId: a.id,
|
|
1870
1840
|
direction: o,
|
|
@@ -1889,7 +1859,7 @@ var z = class {
|
|
|
1889
1859
|
});
|
|
1890
1860
|
}
|
|
1891
1861
|
getRoomEdgePoint(e, t, n, r) {
|
|
1892
|
-
return this.settings.roomShape === "circle" ?
|
|
1862
|
+
return this.settings.roomShape === "circle" ? te(e, t, n, r) : this.settings.roomShape === "roundedRectangle" ? L(e, t, n, r, this.settings.roomSize * .2) : I(e, t, n, r);
|
|
1893
1863
|
}
|
|
1894
1864
|
buildExitShape(e) {
|
|
1895
1865
|
return Te(e);
|
|
@@ -1963,40 +1933,40 @@ var z = class {
|
|
|
1963
1933
|
let r = e[t].tip.x - e[n].tip.x, i = e[t].tip.y - e[n].tip.y, a = Math.hypot(r, i);
|
|
1964
1934
|
a > D && (D = a);
|
|
1965
1935
|
}
|
|
1966
|
-
let O = D > 3, ee = w / C >= .4, k = n?.x ?? (O ? (m + _) / 2 : o / C),
|
|
1967
|
-
for (let [e, t] of S) t >
|
|
1968
|
-
let
|
|
1936
|
+
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;
|
|
1937
|
+
for (let [e, t] of S) t > M && (j = e, M = t);
|
|
1938
|
+
let N = h.concat(g).concat(r), P = (e, t, n = 0) => .5 + n + Math.abs(e) * i / 2 + Math.abs(t) * a / 2, F = [];
|
|
1969
1939
|
if (ee) {
|
|
1970
|
-
let e =
|
|
1971
|
-
|
|
1940
|
+
let e = P(T, E);
|
|
1941
|
+
F.push({
|
|
1972
1942
|
x: k + T * e,
|
|
1973
|
-
y:
|
|
1943
|
+
y: A + E * e
|
|
1974
1944
|
});
|
|
1975
1945
|
}
|
|
1976
|
-
|
|
1946
|
+
F.push({
|
|
1977
1947
|
x: k,
|
|
1978
|
-
y:
|
|
1948
|
+
y: A
|
|
1979
1949
|
});
|
|
1980
1950
|
for (let e of [
|
|
1981
1951
|
0,
|
|
1982
1952
|
.6,
|
|
1983
1953
|
1.4
|
|
1984
1954
|
]) for (let [t, n] of b) {
|
|
1985
|
-
let r =
|
|
1986
|
-
|
|
1955
|
+
let r = P(t, n, e);
|
|
1956
|
+
F.push({
|
|
1987
1957
|
x: k + t * r,
|
|
1988
|
-
y:
|
|
1958
|
+
y: A + n * r
|
|
1989
1959
|
});
|
|
1990
1960
|
}
|
|
1991
|
-
for (let t of
|
|
1961
|
+
for (let t of F) {
|
|
1992
1962
|
let n = t.x - i / 2, r = t.y - a / 2;
|
|
1993
|
-
if (!y(n, r, i, a,
|
|
1963
|
+
if (!y(n, r, i, a, N)) return {
|
|
1994
1964
|
cluster: e,
|
|
1995
1965
|
boxX: n,
|
|
1996
1966
|
boxY: r,
|
|
1997
1967
|
boxW: i,
|
|
1998
1968
|
boxH: a,
|
|
1999
|
-
color:
|
|
1969
|
+
color: j
|
|
2000
1970
|
};
|
|
2001
1971
|
}
|
|
2002
1972
|
};
|
|
@@ -2189,7 +2159,7 @@ var ze = {
|
|
|
2189
2159
|
topLabel: []
|
|
2190
2160
|
}, Be = class {
|
|
2191
2161
|
constructor(e, t, n) {
|
|
2192
|
-
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new
|
|
2162
|
+
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new B(n, t);
|
|
2193
2163
|
}
|
|
2194
2164
|
get exitRenderer() {
|
|
2195
2165
|
return this.pipeline.exitRenderer;
|
|
@@ -2222,7 +2192,7 @@ var ze = {
|
|
|
2222
2192
|
this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
|
|
2223
2193
|
}
|
|
2224
2194
|
resetPipeline(e) {
|
|
2225
|
-
this.pipeline = new
|
|
2195
|
+
this.pipeline = new B(e, this.settings), this.reset();
|
|
2226
2196
|
}
|
|
2227
2197
|
cullInteractive(e = O) {
|
|
2228
2198
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
@@ -2586,7 +2556,7 @@ var Ue = class {
|
|
|
2586
2556
|
ensureShape() {
|
|
2587
2557
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2588
2558
|
}
|
|
2589
|
-
},
|
|
2559
|
+
}, V = class {
|
|
2590
2560
|
constructor(e) {
|
|
2591
2561
|
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
2592
2562
|
let t = this;
|
|
@@ -2740,20 +2710,20 @@ function Xe(e) {
|
|
|
2740
2710
|
}
|
|
2741
2711
|
//#endregion
|
|
2742
2712
|
//#region src/PathData.ts
|
|
2743
|
-
var
|
|
2713
|
+
var H = [
|
|
2744
2714
|
"up",
|
|
2745
2715
|
"down",
|
|
2746
2716
|
"in",
|
|
2747
2717
|
"out"
|
|
2748
2718
|
];
|
|
2749
|
-
function
|
|
2750
|
-
return e.roomShape === "circle" ?
|
|
2719
|
+
function Ze(e, t, n, r, i) {
|
|
2720
|
+
return e.roomShape === "circle" ? te(t, n, r, i) : e.roomShape === "roundedRectangle" ? L(t, n, r, i, e.roomSize * .2) : I(t, n, r, i);
|
|
2751
2721
|
}
|
|
2752
|
-
function
|
|
2722
|
+
function Qe(e, t, n) {
|
|
2753
2723
|
for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
|
|
2754
2724
|
let r = e;
|
|
2755
|
-
if (
|
|
2756
|
-
let e =
|
|
2725
|
+
if (H.includes(r)) {
|
|
2726
|
+
let e = j[r];
|
|
2757
2727
|
return {
|
|
2758
2728
|
type: "inner",
|
|
2759
2729
|
fromDir: r,
|
|
@@ -2762,7 +2732,7 @@ function Ze(e, t, n) {
|
|
|
2762
2732
|
toRoom: n
|
|
2763
2733
|
};
|
|
2764
2734
|
}
|
|
2765
|
-
let i =
|
|
2735
|
+
let i = j[r];
|
|
2766
2736
|
return t.customLines[i] ? {
|
|
2767
2737
|
type: "special",
|
|
2768
2738
|
fromDir: r,
|
|
@@ -2778,7 +2748,7 @@ function Ze(e, t, n) {
|
|
|
2778
2748
|
} : {
|
|
2779
2749
|
type: "regular",
|
|
2780
2750
|
fromDir: r,
|
|
2781
|
-
toDir:
|
|
2751
|
+
toDir: $e(n, t.id),
|
|
2782
2752
|
fromRoom: t,
|
|
2783
2753
|
toRoom: n
|
|
2784
2754
|
};
|
|
@@ -2795,8 +2765,8 @@ function Ze(e, t, n) {
|
|
|
2795
2765
|
};
|
|
2796
2766
|
for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
|
|
2797
2767
|
let r = e;
|
|
2798
|
-
if (
|
|
2799
|
-
let e =
|
|
2768
|
+
if (H.includes(r)) {
|
|
2769
|
+
let e = j[r];
|
|
2800
2770
|
return {
|
|
2801
2771
|
type: "inner",
|
|
2802
2772
|
toDir: r,
|
|
@@ -2805,7 +2775,7 @@ function Ze(e, t, n) {
|
|
|
2805
2775
|
toRoom: n
|
|
2806
2776
|
};
|
|
2807
2777
|
}
|
|
2808
|
-
let i =
|
|
2778
|
+
let i = j[r];
|
|
2809
2779
|
return n.customLines[i] ? {
|
|
2810
2780
|
type: "special",
|
|
2811
2781
|
toDir: r,
|
|
@@ -2841,39 +2811,39 @@ function Ze(e, t, n) {
|
|
|
2841
2811
|
toRoom: n
|
|
2842
2812
|
};
|
|
2843
2813
|
}
|
|
2844
|
-
function
|
|
2814
|
+
function $e(e, t) {
|
|
2845
2815
|
for (let [n, r] of Object.entries(e.exits)) if (r === t) return n;
|
|
2846
2816
|
}
|
|
2847
|
-
function
|
|
2817
|
+
function et(e, t, n) {
|
|
2848
2818
|
return e ? e.area === t && e.z === n : !1;
|
|
2849
2819
|
}
|
|
2850
|
-
function
|
|
2820
|
+
function tt(e, t) {
|
|
2851
2821
|
for (let [n, r] of Object.entries(e.exits)) if (r === t.id) return { direction: n };
|
|
2852
2822
|
for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
|
|
2853
2823
|
}
|
|
2854
|
-
function
|
|
2855
|
-
for (let n of
|
|
2856
|
-
for (let n of
|
|
2824
|
+
function nt(e, t) {
|
|
2825
|
+
for (let n of N) if (e.exits[n] === t.id) return n;
|
|
2826
|
+
for (let n of N) if (t.exits[n] === e.id) return P[n];
|
|
2857
2827
|
}
|
|
2858
|
-
function
|
|
2828
|
+
function rt(e, t, n) {
|
|
2859
2829
|
let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
|
|
2860
2830
|
if (n.length === 0 && n.push(r.x, r.y), a && k.includes(a)) {
|
|
2861
|
-
let t =
|
|
2831
|
+
let t = Ze(e, r.x, r.y, a, e.roomSize / 2);
|
|
2862
2832
|
n.push(t.x, t.y);
|
|
2863
2833
|
}
|
|
2864
2834
|
if (o && k.includes(o)) {
|
|
2865
|
-
let t =
|
|
2835
|
+
let t = Ze(e, i.x, i.y, o, e.roomSize / 2);
|
|
2866
2836
|
n.push(t.x, t.y);
|
|
2867
2837
|
}
|
|
2868
2838
|
n.push(i.x, i.y);
|
|
2869
2839
|
}
|
|
2870
|
-
function
|
|
2840
|
+
function it(e, t) {
|
|
2871
2841
|
let { fromRoom: n, toRoom: r, customLineKey: i } = e, a = n, o;
|
|
2872
2842
|
i && (o = n.customLines[i], o || (o = r.customLines[i], a = r)), t.length === 0 && t.push(a.x, a.y), o && o.points.forEach((e) => {
|
|
2873
2843
|
t.push(e.x, -e.y);
|
|
2874
2844
|
}), t.push(r.x, r.y);
|
|
2875
2845
|
}
|
|
2876
|
-
function
|
|
2846
|
+
function at(e, t, n, r, i) {
|
|
2877
2847
|
let a = [], o = [], s = [], c = n.map((t) => e.getRoom(t)).filter((e) => e !== void 0), l = [], u = () => {
|
|
2878
2848
|
l.length >= 4 && a.push({ points: [...l] }), l = [];
|
|
2879
2849
|
}, d = (e) => {
|
|
@@ -2887,28 +2857,28 @@ function it(e, t, n, r, i) {
|
|
|
2887
2857
|
}), s.push({ points: t });
|
|
2888
2858
|
}
|
|
2889
2859
|
}
|
|
2890
|
-
r &&
|
|
2860
|
+
r && H.includes(r) && o.push({
|
|
2891
2861
|
room: t,
|
|
2892
2862
|
direction: r
|
|
2893
|
-
}), i &&
|
|
2863
|
+
}), i && H.includes(i) && o.push({
|
|
2894
2864
|
room: n,
|
|
2895
2865
|
direction: i
|
|
2896
2866
|
});
|
|
2897
2867
|
};
|
|
2898
2868
|
for (let n = 0; n < c.length - 1; n++) {
|
|
2899
|
-
let a = c[n], s = c[n + 1], f =
|
|
2869
|
+
let a = c[n], s = c[n + 1], f = et(a, r, i), p = et(s, r, i);
|
|
2900
2870
|
if (!f && !p) {
|
|
2901
2871
|
u();
|
|
2902
2872
|
continue;
|
|
2903
2873
|
}
|
|
2904
2874
|
if (f && p) {
|
|
2905
|
-
let n =
|
|
2875
|
+
let n = Qe(e, a, s);
|
|
2906
2876
|
switch (n.type) {
|
|
2907
2877
|
case "regular":
|
|
2908
|
-
|
|
2878
|
+
rt(t, n, l);
|
|
2909
2879
|
break;
|
|
2910
2880
|
case "special":
|
|
2911
|
-
|
|
2881
|
+
it(n, l);
|
|
2912
2882
|
break;
|
|
2913
2883
|
case "inner":
|
|
2914
2884
|
u(), d(n);
|
|
@@ -2918,22 +2888,22 @@ function it(e, t, n, r, i) {
|
|
|
2918
2888
|
break;
|
|
2919
2889
|
}
|
|
2920
2890
|
} else {
|
|
2921
|
-
let e = f ? a : s, n = f ? s : a, r =
|
|
2891
|
+
let e = f ? a : s, n = f ? s : a, r = tt(e, n);
|
|
2922
2892
|
if (r) {
|
|
2923
|
-
if (
|
|
2893
|
+
if (H.includes(r.direction)) u(), o.push({
|
|
2924
2894
|
room: e,
|
|
2925
2895
|
direction: r.direction
|
|
2926
2896
|
});
|
|
2927
2897
|
else if (k.includes(r.direction)) {
|
|
2928
2898
|
l.length === 0 && l.push(e.x, e.y);
|
|
2929
|
-
let n =
|
|
2899
|
+
let n = Ze(t, e.x, e.y, r.direction, t.roomSize / 2), i = I(e.x, e.y, r.direction, t.roomSize);
|
|
2930
2900
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2931
2901
|
}
|
|
2932
2902
|
} else {
|
|
2933
|
-
let r =
|
|
2903
|
+
let r = nt(e, n);
|
|
2934
2904
|
if (r) {
|
|
2935
2905
|
l.length === 0 && l.push(e.x, e.y);
|
|
2936
|
-
let n =
|
|
2906
|
+
let n = Ze(t, e.x, e.y, r, t.roomSize / 2), i = I(e.x, e.y, r, t.roomSize);
|
|
2937
2907
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2938
2908
|
}
|
|
2939
2909
|
}
|
|
@@ -2947,7 +2917,7 @@ function it(e, t, n, r, i) {
|
|
|
2947
2917
|
}
|
|
2948
2918
|
//#endregion
|
|
2949
2919
|
//#region src/scene/OverlayStyle.ts
|
|
2950
|
-
function
|
|
2920
|
+
function ot(e, t, n) {
|
|
2951
2921
|
let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = r.matchRoomShape && n.roomShape !== "circle";
|
|
2952
2922
|
return {
|
|
2953
2923
|
shape: o ? "rect" : "circle",
|
|
@@ -2964,7 +2934,7 @@ function at(e, t, n) {
|
|
|
2964
2934
|
dashEnabled: r.dashEnabled
|
|
2965
2935
|
};
|
|
2966
2936
|
}
|
|
2967
|
-
function
|
|
2937
|
+
function st(e, t) {
|
|
2968
2938
|
let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
|
|
2969
2939
|
return {
|
|
2970
2940
|
shape: i ? "rect" : "circle",
|
|
@@ -2981,18 +2951,15 @@ function ot(e, t) {
|
|
|
2981
2951
|
dashEnabled: n.dashEnabled
|
|
2982
2952
|
};
|
|
2983
2953
|
}
|
|
2984
|
-
function
|
|
2985
|
-
let o =
|
|
2986
|
-
for (let e of o.segments) e.points.length >= 4 &&
|
|
2987
|
-
for (let e of o.customLines) e.points.length >= 4 &&
|
|
2988
|
-
let
|
|
2989
|
-
for (let e of o.innerMarkers) {
|
|
2990
|
-
let t = e.direction === "up" ? 0 : e.direction === "down" ? 180 : e.direction === "in" ? 90 : -90;
|
|
2991
|
-
u.push({ vertices: R(e.room.x, e.room.y, c, t) });
|
|
2992
|
-
}
|
|
2954
|
+
function ct(e, t, n, r, i, a) {
|
|
2955
|
+
let o = at(e, t, n, i, a), s = t.lineWidth, c = [];
|
|
2956
|
+
for (let e of o.segments) e.points.length >= 4 && c.push({ points: e.points });
|
|
2957
|
+
for (let e of o.customLines) e.points.length >= 4 && c.push({ points: e.points });
|
|
2958
|
+
let l = [];
|
|
2959
|
+
for (let e of o.innerMarkers) for (let n of Se(e.room, e.direction, t)) l.push({ vertices: n.vertices });
|
|
2993
2960
|
return {
|
|
2994
|
-
segments:
|
|
2995
|
-
triangles:
|
|
2961
|
+
segments: c,
|
|
2962
|
+
triangles: l,
|
|
2996
2963
|
color: r,
|
|
2997
2964
|
outlineWidth: s * 8,
|
|
2998
2965
|
lineWidth: s * 4
|
|
@@ -3000,7 +2967,7 @@ function st(e, t, n, r, i, a) {
|
|
|
3000
2967
|
}
|
|
3001
2968
|
//#endregion
|
|
3002
2969
|
//#region src/scene/elements/OverlayLayout.ts
|
|
3003
|
-
function
|
|
2970
|
+
function lt(e) {
|
|
3004
2971
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
3005
2972
|
if (e.shape === "circle") return {
|
|
3006
2973
|
type: "circle",
|
|
@@ -3072,7 +3039,7 @@ function ct(e) {
|
|
|
3072
3039
|
layer: "overlay"
|
|
3073
3040
|
};
|
|
3074
3041
|
}
|
|
3075
|
-
function
|
|
3042
|
+
function ut(e) {
|
|
3076
3043
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
3077
3044
|
return e.shape === "circle" ? {
|
|
3078
3045
|
type: "circle",
|
|
@@ -3104,7 +3071,7 @@ function lt(e) {
|
|
|
3104
3071
|
layer: "overlay"
|
|
3105
3072
|
};
|
|
3106
3073
|
}
|
|
3107
|
-
function
|
|
3074
|
+
function dt(e) {
|
|
3108
3075
|
let t = [];
|
|
3109
3076
|
for (let n of e.segments) t.push({
|
|
3110
3077
|
type: "line",
|
|
@@ -3143,29 +3110,29 @@ function ut(e) {
|
|
|
3143
3110
|
}
|
|
3144
3111
|
//#endregion
|
|
3145
3112
|
//#region src/hit/HitTester.ts
|
|
3146
|
-
var
|
|
3113
|
+
var ft = {
|
|
3147
3114
|
areaExit: 110,
|
|
3148
3115
|
room: 100,
|
|
3149
3116
|
label: 80,
|
|
3150
3117
|
specialExit: 60,
|
|
3151
3118
|
exit: 40,
|
|
3152
3119
|
stub: 20
|
|
3153
|
-
},
|
|
3120
|
+
}, pt = {
|
|
3154
3121
|
room: .3,
|
|
3155
3122
|
areaExit: 1,
|
|
3156
3123
|
label: 1,
|
|
3157
3124
|
specialExit: .5,
|
|
3158
3125
|
exit: .35,
|
|
3159
3126
|
stub: .3
|
|
3160
|
-
},
|
|
3127
|
+
}, mt = (e, t) => ({
|
|
3161
3128
|
x: e,
|
|
3162
3129
|
y: t
|
|
3163
|
-
}),
|
|
3130
|
+
}), ht = class {
|
|
3164
3131
|
constructor() {
|
|
3165
|
-
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform =
|
|
3132
|
+
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform = mt;
|
|
3166
3133
|
}
|
|
3167
3134
|
build(e, t, n) {
|
|
3168
|
-
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ??
|
|
3135
|
+
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ?? mt, this.collectHitShapes(e, 0, 0);
|
|
3169
3136
|
}
|
|
3170
3137
|
clear() {
|
|
3171
3138
|
this.entries = [], this.spatialIndex.clear();
|
|
@@ -3209,13 +3176,13 @@ var dt = {
|
|
|
3209
3176
|
forEachCandidate(e, t, n) {
|
|
3210
3177
|
let r = Math.floor(e / this.bucketSize), i = Math.floor(t / this.bucketSize), a = /* @__PURE__ */ new Set();
|
|
3211
3178
|
for (let o = -1; o <= 1; o++) for (let s = -1; s <= 1; s++) {
|
|
3212
|
-
let c = this.spatialIndex.get(
|
|
3179
|
+
let c = this.spatialIndex.get(wt(r + o, i + s));
|
|
3213
3180
|
if (c) for (let r of c) {
|
|
3214
3181
|
if (a.has(r)) continue;
|
|
3215
3182
|
a.add(r);
|
|
3216
3183
|
let i = r.margin * this.roomSize;
|
|
3217
3184
|
if (e < r.rMinX - i || e > r.rMaxX + i || t < r.rMinY - i || t > r.rMaxY + i) continue;
|
|
3218
|
-
let o =
|
|
3185
|
+
let o = yt(r, e, t);
|
|
3219
3186
|
o > i || n(r, o);
|
|
3220
3187
|
}
|
|
3221
3188
|
}
|
|
@@ -3234,14 +3201,14 @@ var dt = {
|
|
|
3234
3201
|
collectHitShapes(e, t, n) {
|
|
3235
3202
|
for (let r of e) {
|
|
3236
3203
|
if (r.hit) {
|
|
3237
|
-
let e = [], i =
|
|
3238
|
-
|
|
3204
|
+
let e = [], i = gt();
|
|
3205
|
+
_t(r, t, n, this.transform, e, i), e.length > 0 && i.minX <= i.maxX && this.indexEntry(i, e, r.hit);
|
|
3239
3206
|
}
|
|
3240
3207
|
r.type === "group" && this.collectHitShapes(r.children, t + r.x, n + r.y);
|
|
3241
3208
|
}
|
|
3242
3209
|
}
|
|
3243
3210
|
indexEntry(e, t, n) {
|
|
3244
|
-
let r = n.margin ??
|
|
3211
|
+
let r = n.margin ?? pt[n.kind] ?? 1, i = n.priority ?? ft[n.kind] ?? 50, a = (e.minX + e.maxX) / 2, o = (e.minY + e.maxY) / 2, s = {
|
|
3245
3212
|
info: n,
|
|
3246
3213
|
margin: r,
|
|
3247
3214
|
priority: i,
|
|
@@ -3256,12 +3223,12 @@ var dt = {
|
|
|
3256
3223
|
this.entries.push(s);
|
|
3257
3224
|
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);
|
|
3258
3225
|
for (let e = l; e <= u; e++) for (let t = d; t <= f; t++) {
|
|
3259
|
-
let n =
|
|
3226
|
+
let n = wt(e, t), r = this.spatialIndex.get(n);
|
|
3260
3227
|
r || (r = [], this.spatialIndex.set(n, r)), r.push(s);
|
|
3261
3228
|
}
|
|
3262
3229
|
}
|
|
3263
3230
|
};
|
|
3264
|
-
function
|
|
3231
|
+
function gt() {
|
|
3265
3232
|
return {
|
|
3266
3233
|
minX: Infinity,
|
|
3267
3234
|
minY: Infinity,
|
|
@@ -3272,14 +3239,14 @@ function ht() {
|
|
|
3272
3239
|
function U(e, t, n) {
|
|
3273
3240
|
t < e.minX && (e.minX = t), t > e.maxX && (e.maxX = t), n < e.minY && (e.minY = n), n > e.maxY && (e.maxY = n);
|
|
3274
3241
|
}
|
|
3275
|
-
function
|
|
3242
|
+
function _t(e, t, n, r, i, a) {
|
|
3276
3243
|
if (e.type === "group") {
|
|
3277
|
-
for (let o of e.children) o.hit ||
|
|
3244
|
+
for (let o of e.children) o.hit || vt(o, t + e.x, n + e.y, r, i, a);
|
|
3278
3245
|
return;
|
|
3279
3246
|
}
|
|
3280
|
-
|
|
3247
|
+
vt(e, t, n, r, i, a);
|
|
3281
3248
|
}
|
|
3282
|
-
function
|
|
3249
|
+
function vt(e, t, n, r, i, a) {
|
|
3283
3250
|
switch (e.type) {
|
|
3284
3251
|
case "rect":
|
|
3285
3252
|
case "image": {
|
|
@@ -3363,42 +3330,42 @@ function _t(e, t, n, r, i, a) {
|
|
|
3363
3330
|
return;
|
|
3364
3331
|
}
|
|
3365
3332
|
case "group":
|
|
3366
|
-
for (let o of e.children) o.hit ||
|
|
3333
|
+
for (let o of e.children) o.hit || vt(o, t + e.x, n + e.y, r, i, a);
|
|
3367
3334
|
return;
|
|
3368
3335
|
}
|
|
3369
3336
|
}
|
|
3370
|
-
function
|
|
3337
|
+
function yt(e, t, n) {
|
|
3371
3338
|
let r = Infinity;
|
|
3372
3339
|
for (let i of e.geoms) {
|
|
3373
|
-
let e =
|
|
3340
|
+
let e = bt(i, t, n);
|
|
3374
3341
|
if (e < r && (r = e), r === 0) return 0;
|
|
3375
3342
|
}
|
|
3376
3343
|
return r;
|
|
3377
3344
|
}
|
|
3378
|
-
function
|
|
3345
|
+
function bt(e, t, n) {
|
|
3379
3346
|
if (e.type === "circle") {
|
|
3380
3347
|
let r = t - e.cx, i = n - e.cy;
|
|
3381
3348
|
return Math.max(0, Math.hypot(r, i) - e.r);
|
|
3382
3349
|
}
|
|
3383
|
-
return e.closed &&
|
|
3350
|
+
return e.closed && Ct(e.pts, t, n) ? 0 : xt(e.pts, t, n, e.closed);
|
|
3384
3351
|
}
|
|
3385
|
-
function
|
|
3352
|
+
function xt(e, t, n, r) {
|
|
3386
3353
|
let i = e.length / 2;
|
|
3387
3354
|
if (i < 2) return i === 1 ? Math.hypot(t - e[0], n - e[1]) : Infinity;
|
|
3388
3355
|
let a = Infinity, o = r ? i : i - 1;
|
|
3389
3356
|
for (let r = 0; r < o; r++) {
|
|
3390
|
-
let o = r * 2, s = (r + 1) % i * 2, c =
|
|
3357
|
+
let o = r * 2, s = (r + 1) % i * 2, c = St(t, n, e[o], e[o + 1], e[s], e[s + 1]);
|
|
3391
3358
|
c < a && (a = c);
|
|
3392
3359
|
}
|
|
3393
3360
|
return a;
|
|
3394
3361
|
}
|
|
3395
|
-
function
|
|
3362
|
+
function St(e, t, n, r, i, a) {
|
|
3396
3363
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : ((e - n) * o + (t - r) * s) / c;
|
|
3397
3364
|
l < 0 ? l = 0 : l > 1 && (l = 1);
|
|
3398
3365
|
let u = n + l * o, d = r + l * s;
|
|
3399
3366
|
return Math.hypot(e - u, t - d);
|
|
3400
3367
|
}
|
|
3401
|
-
function
|
|
3368
|
+
function Ct(e, t, n) {
|
|
3402
3369
|
let r = !1, i = e.length / 2;
|
|
3403
3370
|
for (let a = 0, o = i - 1; a < i; o = a++) {
|
|
3404
3371
|
let i = e[a * 2], s = e[a * 2 + 1], c = e[o * 2], l = e[o * 2 + 1], u = l - s || 1e-12;
|
|
@@ -3406,13 +3373,13 @@ function St(e, t, n) {
|
|
|
3406
3373
|
}
|
|
3407
3374
|
return r;
|
|
3408
3375
|
}
|
|
3409
|
-
function
|
|
3376
|
+
function wt(e, t) {
|
|
3410
3377
|
return e * 1000003 + t;
|
|
3411
3378
|
}
|
|
3412
3379
|
//#endregion
|
|
3413
3380
|
//#region src/style/Style.ts
|
|
3414
3381
|
var W = { transform: (e) => e };
|
|
3415
|
-
function
|
|
3382
|
+
function Tt(...e) {
|
|
3416
3383
|
return e.length === 0 ? W : e.length === 1 ? e[0] : {
|
|
3417
3384
|
transform(t, n) {
|
|
3418
3385
|
let r = [t];
|
|
@@ -3452,16 +3419,16 @@ function wt(...e) {
|
|
|
3452
3419
|
function G(e, t, n) {
|
|
3453
3420
|
let r = [];
|
|
3454
3421
|
for (let i of e) {
|
|
3455
|
-
let e =
|
|
3422
|
+
let e = Et(i, t, n);
|
|
3456
3423
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3457
3424
|
}
|
|
3458
3425
|
return r;
|
|
3459
3426
|
}
|
|
3460
|
-
function
|
|
3427
|
+
function Et(e, t, n) {
|
|
3461
3428
|
if (e.type === "group") {
|
|
3462
3429
|
let r = [];
|
|
3463
3430
|
for (let i of e.children) {
|
|
3464
|
-
let e =
|
|
3431
|
+
let e = Et(i, t, n);
|
|
3465
3432
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3466
3433
|
}
|
|
3467
3434
|
return t.transform({
|
|
@@ -3473,12 +3440,12 @@ function Tt(e, t, n) {
|
|
|
3473
3440
|
}
|
|
3474
3441
|
//#endregion
|
|
3475
3442
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
3476
|
-
var K = "rgb(120, 72, 0)",
|
|
3443
|
+
var K = "rgb(120, 72, 0)", Dt = class {
|
|
3477
3444
|
get coordinateTransform() {
|
|
3478
3445
|
return this._coordinateTransform;
|
|
3479
3446
|
}
|
|
3480
3447
|
constructor(e, t) {
|
|
3481
|
-
this.gridCachedBounds = null, this.currentStyle = W, this.hitTester = new
|
|
3448
|
+
this.gridCachedBounds = null, this.currentStyle = W, this.hitTester = new ht(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.currentRoomOverlay = [], this.areaExitHitZones = [], this.destroyed = !1, this._coordinateTransform = O, this.coordinateInverse = O, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = e, this.container = t, t ? (this.stage = new r.Stage({
|
|
3482
3449
|
container: t,
|
|
3483
3450
|
width: t.clientWidth,
|
|
3484
3451
|
height: t.clientHeight,
|
|
@@ -3488,7 +3455,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3488
3455
|
height: 1
|
|
3489
3456
|
}), this.camera = new D(1, 1)), this.gridLayer = new r.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
3490
3457
|
let n = new r.Layer({ listening: !1 });
|
|
3491
|
-
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new r.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new r.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new r.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Ge(this.positionLayer), this.overlayLayerNode = new Ge(this.overlayLayer), this.sceneNode = new We(n), this.gridLayerNode = new
|
|
3458
|
+
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new r.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new r.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new r.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Ge(this.positionLayer), this.overlayLayerNode = new Ge(this.overlayLayer), this.sceneNode = new We(n), this.gridLayerNode = new V(this.gridLayer), this.topLabelLayerNode = new V(this.topLabelLayer), this.sceneManager = new Be(this.camera, e.settings, e.mapReader), this.events = new S(t), this.culling = new ee(e.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), t) {
|
|
3492
3459
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
3493
3460
|
let n = this.origSetSize;
|
|
3494
3461
|
this.camera.setSize = (e, t) => {
|
|
@@ -3501,7 +3468,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3501
3468
|
this.applyStyleTransforms(), this.subscribeToState(e);
|
|
3502
3469
|
}
|
|
3503
3470
|
setStyle(e) {
|
|
3504
|
-
this.currentStyle = e, this.sceneNode = new We(this.linkLayer), this.gridLayerNode = new
|
|
3471
|
+
this.currentStyle = e, this.sceneNode = new We(this.linkLayer), this.gridLayerNode = new V(this.gridLayer), this.topLabelLayerNode = new V(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.areaExitHitZones = [], this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
|
|
3505
3472
|
}
|
|
3506
3473
|
applyStyleTransforms() {
|
|
3507
3474
|
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;
|
|
@@ -3730,9 +3697,12 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3730
3697
|
}
|
|
3731
3698
|
}
|
|
3732
3699
|
applyPositionMarker(e) {
|
|
3733
|
-
this.positionMarker
|
|
3734
|
-
|
|
3735
|
-
|
|
3700
|
+
if (this.positionMarker &&= (this.positionMarker.destroy(), void 0), e.area !== this.state.currentArea || e.z !== this.state.currentZIndex) {
|
|
3701
|
+
this.positionLayerNode.batchDraw();
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
let t = st(e, this.state.settings);
|
|
3705
|
+
this.positionMarker = this.addStyledShape(ut(t), this.positionLayerNode);
|
|
3736
3706
|
}
|
|
3737
3707
|
clearCurrentRoomOverlay() {
|
|
3738
3708
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3754,8 +3724,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3754
3724
|
let t = i.renderDataWithColor(e, K, this.state.currentZIndex);
|
|
3755
3725
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3756
3726
|
});
|
|
3757
|
-
for (let n of
|
|
3758
|
-
for (let n of
|
|
3727
|
+
for (let n of le(e, t, K)) r.push(De(n, e.id));
|
|
3728
|
+
for (let n of se(e, t, K)) r.push(Oe(n));
|
|
3759
3729
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3760
3730
|
let t = this.state.mapReader.getRoom(e);
|
|
3761
3731
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -3763,17 +3733,13 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3763
3733
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3764
3734
|
t && this.currentRoomOverlay.push(t);
|
|
3765
3735
|
}), n.forEach((n, r) => {
|
|
3766
|
-
let i = r === e.id, a =
|
|
3736
|
+
let i = r === e.id, a = _e(n, this.state.mapReader, t, {
|
|
3767
3737
|
strokeOverride: i ? K : t.lineColor,
|
|
3768
3738
|
flatPipeline: !0
|
|
3769
|
-
})
|
|
3739
|
+
});
|
|
3740
|
+
a.children.push(...we(n, this.state.mapReader, t));
|
|
3741
|
+
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
3770
3742
|
o && this.currentRoomOverlay.push(o);
|
|
3771
|
-
}), n.forEach((e) => {
|
|
3772
|
-
let n = we(e, this.state.mapReader, t);
|
|
3773
|
-
for (let e of n) {
|
|
3774
|
-
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3775
|
-
t && this.currentRoomOverlay.push(t);
|
|
3776
|
-
}
|
|
3777
3743
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
3778
3744
|
}
|
|
3779
3745
|
syncHighlight(e, t) {
|
|
@@ -3781,7 +3747,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3781
3747
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3782
3748
|
let n = this.state.mapReader.getRoom(e);
|
|
3783
3749
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3784
|
-
let r =
|
|
3750
|
+
let r = ot(n, t, this.state.settings), i = this.addStyledShape(lt(r), this.overlayLayerNode);
|
|
3785
3751
|
i && this.highlightShapes.set(e, i);
|
|
3786
3752
|
}
|
|
3787
3753
|
}
|
|
@@ -3794,7 +3760,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3794
3760
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3795
3761
|
let n = this.state.mapReader.getRoom(e);
|
|
3796
3762
|
if (!n) continue;
|
|
3797
|
-
let r =
|
|
3763
|
+
let r = ot(n, t.color, this.state.settings), i = this.addStyledShape(lt(r), this.overlayLayerNode);
|
|
3798
3764
|
i && this.highlightShapes.set(e, i);
|
|
3799
3765
|
}
|
|
3800
3766
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3804,8 +3770,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3804
3770
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3805
3771
|
if (!(e === void 0 || t === void 0)) {
|
|
3806
3772
|
for (let n of this.state.paths) {
|
|
3807
|
-
let r =
|
|
3808
|
-
for (let e of
|
|
3773
|
+
let r = ct(this.state.mapReader, this.state.settings, n.locations, n.color, e, t);
|
|
3774
|
+
for (let e of dt(r)) {
|
|
3809
3775
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3810
3776
|
t && this.pathShapes.push(t);
|
|
3811
3777
|
}
|
|
@@ -3841,97 +3807,97 @@ function q(e) {
|
|
|
3841
3807
|
function J(e, t, n, r = 1) {
|
|
3842
3808
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3843
3809
|
}
|
|
3844
|
-
function
|
|
3810
|
+
function Ot(e) {
|
|
3845
3811
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3846
3812
|
}
|
|
3847
3813
|
//#endregion
|
|
3848
3814
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3849
|
-
var
|
|
3850
|
-
function
|
|
3815
|
+
var kt = "#4a3728", At = "#3b2a1a", jt = 139, Mt = 115, Nt = 85, Pt = 244, Ft = 228, It = 193;
|
|
3816
|
+
function Lt(e) {
|
|
3851
3817
|
let t = q(e);
|
|
3852
|
-
if (!t) return J(
|
|
3853
|
-
let n =
|
|
3854
|
-
return J(Math.round(
|
|
3818
|
+
if (!t) return J(Pt, Ft, It);
|
|
3819
|
+
let n = Ot(t);
|
|
3820
|
+
return J(Math.round(jt + (Pt - jt) * n), Math.round(Mt + (Ft - Mt) * n), Math.round(Nt + (It - Nt) * n), t.a);
|
|
3855
3821
|
}
|
|
3856
|
-
function
|
|
3822
|
+
function Rt(e) {
|
|
3857
3823
|
let t = q(e);
|
|
3858
|
-
if (!t || t.a >= 1) return
|
|
3859
|
-
let n = q(
|
|
3824
|
+
if (!t || t.a >= 1) return kt;
|
|
3825
|
+
let n = q(kt);
|
|
3860
3826
|
return J(n.r, n.g, n.b, t.a);
|
|
3861
3827
|
}
|
|
3862
|
-
function
|
|
3828
|
+
function zt(e) {
|
|
3863
3829
|
return {
|
|
3864
3830
|
...e,
|
|
3865
|
-
fill: e.fill ?
|
|
3866
|
-
stroke: e.stroke ?
|
|
3831
|
+
fill: e.fill ? Lt(e.fill) : e.fill,
|
|
3832
|
+
stroke: e.stroke ? Rt(e.stroke) : e.stroke
|
|
3867
3833
|
};
|
|
3868
3834
|
}
|
|
3869
|
-
var
|
|
3835
|
+
var Bt = { transform(e) {
|
|
3870
3836
|
switch (e.type) {
|
|
3871
3837
|
case "rect":
|
|
3872
3838
|
case "circle":
|
|
3873
3839
|
case "polygon": return {
|
|
3874
3840
|
...e,
|
|
3875
|
-
paint:
|
|
3841
|
+
paint: zt(e.paint)
|
|
3876
3842
|
};
|
|
3877
3843
|
case "line": return {
|
|
3878
3844
|
...e,
|
|
3879
3845
|
paint: e.paint.stroke ? {
|
|
3880
3846
|
...e.paint,
|
|
3881
|
-
stroke:
|
|
3847
|
+
stroke: Rt(e.paint.stroke)
|
|
3882
3848
|
} : e.paint
|
|
3883
3849
|
};
|
|
3884
3850
|
case "text": return {
|
|
3885
3851
|
...e,
|
|
3886
|
-
fill:
|
|
3852
|
+
fill: At
|
|
3887
3853
|
};
|
|
3888
3854
|
case "image":
|
|
3889
3855
|
case "group": return e;
|
|
3890
3856
|
}
|
|
3891
|
-
} },
|
|
3892
|
-
function
|
|
3857
|
+
} }, Vt = "#c0deff", Ht = "#e0f0ff", Ut = 20, Wt = 40, Gt = 80, Kt = 60, qt = 100, Jt = 160;
|
|
3858
|
+
function Yt(e) {
|
|
3893
3859
|
let t = q(e);
|
|
3894
|
-
if (!t) return J(
|
|
3895
|
-
let n =
|
|
3896
|
-
return J(Math.round(
|
|
3860
|
+
if (!t) return J(Kt, qt, Jt);
|
|
3861
|
+
let n = Ot(t);
|
|
3862
|
+
return J(Math.round(Ut + (Kt - Ut) * n), Math.round(Wt + (qt - Wt) * n), Math.round(Gt + (Jt - Gt) * n), t.a);
|
|
3897
3863
|
}
|
|
3898
|
-
function
|
|
3864
|
+
function Xt(e) {
|
|
3899
3865
|
let t = q(e);
|
|
3900
|
-
if (!t || t.a >= 1) return
|
|
3901
|
-
let n = q(
|
|
3866
|
+
if (!t || t.a >= 1) return Vt;
|
|
3867
|
+
let n = q(Vt);
|
|
3902
3868
|
return J(n.r, n.g, n.b, t.a);
|
|
3903
3869
|
}
|
|
3904
|
-
function
|
|
3870
|
+
function Zt(e) {
|
|
3905
3871
|
return {
|
|
3906
3872
|
...e,
|
|
3907
|
-
fill: e.fill ?
|
|
3908
|
-
stroke: e.stroke ?
|
|
3873
|
+
fill: e.fill ? Yt(e.fill) : e.fill,
|
|
3874
|
+
stroke: e.stroke ? Xt(e.stroke) : e.stroke
|
|
3909
3875
|
};
|
|
3910
3876
|
}
|
|
3911
|
-
var
|
|
3877
|
+
var Qt = { transform(e) {
|
|
3912
3878
|
switch (e.type) {
|
|
3913
3879
|
case "rect":
|
|
3914
3880
|
case "circle":
|
|
3915
3881
|
case "polygon": return {
|
|
3916
3882
|
...e,
|
|
3917
|
-
paint:
|
|
3883
|
+
paint: Zt(e.paint)
|
|
3918
3884
|
};
|
|
3919
3885
|
case "line": return {
|
|
3920
3886
|
...e,
|
|
3921
3887
|
paint: e.paint.stroke ? {
|
|
3922
3888
|
...e.paint,
|
|
3923
|
-
stroke:
|
|
3889
|
+
stroke: Xt(e.paint.stroke)
|
|
3924
3890
|
} : e.paint
|
|
3925
3891
|
};
|
|
3926
3892
|
case "text": return {
|
|
3927
3893
|
...e,
|
|
3928
|
-
fill:
|
|
3894
|
+
fill: Ht
|
|
3929
3895
|
};
|
|
3930
3896
|
case "image":
|
|
3931
3897
|
case "group": return e;
|
|
3932
3898
|
}
|
|
3933
|
-
} },
|
|
3934
|
-
function
|
|
3899
|
+
} }, $t = "#00ffd0", en = .3, tn = 3;
|
|
3900
|
+
function nn(e, t, n) {
|
|
3935
3901
|
e /= 255, t /= 255, n /= 255;
|
|
3936
3902
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3937
3903
|
if (r === i) return [
|
|
@@ -3946,68 +3912,68 @@ function tn(e, t, n) {
|
|
|
3946
3912
|
a
|
|
3947
3913
|
];
|
|
3948
3914
|
}
|
|
3949
|
-
function
|
|
3915
|
+
function rn(e, t, n, r = 1) {
|
|
3950
3916
|
e = (e % 360 + 360) % 360;
|
|
3951
3917
|
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;
|
|
3952
3918
|
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);
|
|
3953
3919
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3954
3920
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3955
3921
|
}
|
|
3956
|
-
function
|
|
3922
|
+
function an(e) {
|
|
3957
3923
|
let t = q(e);
|
|
3958
3924
|
if (!t) return {
|
|
3959
3925
|
h: 150,
|
|
3960
3926
|
a: 1
|
|
3961
3927
|
};
|
|
3962
|
-
let [n] =
|
|
3928
|
+
let [n] = nn(t.r, t.g, t.b);
|
|
3963
3929
|
return {
|
|
3964
3930
|
h: n,
|
|
3965
3931
|
a: t.a
|
|
3966
3932
|
};
|
|
3967
3933
|
}
|
|
3968
|
-
function an(e) {
|
|
3969
|
-
let { h: t, a: n } = rn(e);
|
|
3970
|
-
return nn(t, .95, .65, n);
|
|
3971
|
-
}
|
|
3972
3934
|
function on(e) {
|
|
3973
|
-
let t =
|
|
3974
|
-
|
|
3975
|
-
let [n] = tn(t.r, t.g, t.b);
|
|
3976
|
-
return nn(n, .4, .1, t.a);
|
|
3935
|
+
let { h: t, a: n } = an(e);
|
|
3936
|
+
return rn(t, .95, .65, n);
|
|
3977
3937
|
}
|
|
3978
3938
|
function sn(e) {
|
|
3979
|
-
let
|
|
3980
|
-
|
|
3939
|
+
let t = q(e);
|
|
3940
|
+
if (!t) return "rgb(8, 12, 10)";
|
|
3941
|
+
let [n] = nn(t.r, t.g, t.b);
|
|
3942
|
+
return rn(n, .4, .1, t.a);
|
|
3981
3943
|
}
|
|
3982
3944
|
function cn(e) {
|
|
3945
|
+
let { h: t, a: n } = an(e);
|
|
3946
|
+
return rn(t, .95, .65, Math.min(n, en));
|
|
3947
|
+
}
|
|
3948
|
+
function ln(e) {
|
|
3983
3949
|
return {
|
|
3984
3950
|
...e,
|
|
3985
|
-
fill: e.fill ?
|
|
3986
|
-
stroke: e.stroke ?
|
|
3951
|
+
fill: e.fill ? sn(e.fill) : e.fill,
|
|
3952
|
+
stroke: e.stroke ? on(e.stroke) : e.stroke
|
|
3987
3953
|
};
|
|
3988
3954
|
}
|
|
3989
|
-
function
|
|
3955
|
+
function un(e, t = !1) {
|
|
3990
3956
|
if (!e.stroke) return e;
|
|
3991
|
-
let n = (e.strokeWidth ?? 1) *
|
|
3957
|
+
let n = (e.strokeWidth ?? 1) * tn;
|
|
3992
3958
|
return {
|
|
3993
|
-
stroke:
|
|
3959
|
+
stroke: cn(e.stroke),
|
|
3994
3960
|
strokeWidth: n,
|
|
3995
3961
|
dash: e.dash,
|
|
3996
3962
|
dashEnabled: e.dashEnabled,
|
|
3997
|
-
alpha: t ?
|
|
3963
|
+
alpha: t ? en : e.alpha
|
|
3998
3964
|
};
|
|
3999
3965
|
}
|
|
4000
|
-
var
|
|
3966
|
+
var dn = { transform(e) {
|
|
4001
3967
|
switch (e.type) {
|
|
4002
3968
|
case "rect": {
|
|
4003
3969
|
let t = {
|
|
4004
3970
|
...e,
|
|
4005
|
-
paint:
|
|
3971
|
+
paint: ln(e.paint)
|
|
4006
3972
|
};
|
|
4007
3973
|
return e.paint.stroke ? [{
|
|
4008
3974
|
...e,
|
|
4009
3975
|
paint: {
|
|
4010
|
-
...
|
|
3976
|
+
...un(e.paint),
|
|
4011
3977
|
fill: void 0
|
|
4012
3978
|
}
|
|
4013
3979
|
}, t] : t;
|
|
@@ -4015,12 +3981,12 @@ var un = { transform(e) {
|
|
|
4015
3981
|
case "circle": {
|
|
4016
3982
|
let t = {
|
|
4017
3983
|
...e,
|
|
4018
|
-
paint:
|
|
3984
|
+
paint: ln(e.paint)
|
|
4019
3985
|
};
|
|
4020
3986
|
return e.paint.stroke ? [{
|
|
4021
3987
|
...e,
|
|
4022
3988
|
paint: {
|
|
4023
|
-
...
|
|
3989
|
+
...un(e.paint),
|
|
4024
3990
|
fill: void 0
|
|
4025
3991
|
}
|
|
4026
3992
|
}, t] : t;
|
|
@@ -4030,21 +3996,21 @@ var un = { transform(e) {
|
|
|
4030
3996
|
...e,
|
|
4031
3997
|
paint: e.paint.stroke ? {
|
|
4032
3998
|
...e.paint,
|
|
4033
|
-
stroke:
|
|
3999
|
+
stroke: on(e.paint.stroke)
|
|
4034
4000
|
} : e.paint
|
|
4035
4001
|
};
|
|
4036
4002
|
return e.paint.stroke ? [{
|
|
4037
4003
|
...e,
|
|
4038
|
-
paint:
|
|
4004
|
+
paint: un(e.paint, !0)
|
|
4039
4005
|
}, t] : t;
|
|
4040
4006
|
}
|
|
4041
4007
|
case "polygon": return {
|
|
4042
4008
|
...e,
|
|
4043
|
-
paint:
|
|
4009
|
+
paint: ln(e.paint)
|
|
4044
4010
|
};
|
|
4045
4011
|
case "text": return {
|
|
4046
4012
|
...e,
|
|
4047
|
-
fill:
|
|
4013
|
+
fill: $t
|
|
4048
4014
|
};
|
|
4049
4015
|
case "image":
|
|
4050
4016
|
case "group": return e;
|
|
@@ -4061,7 +4027,7 @@ function X(...e) {
|
|
|
4061
4027
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4062
4028
|
return t;
|
|
4063
4029
|
}
|
|
4064
|
-
function
|
|
4030
|
+
function fn(e, t, n, r, i, a) {
|
|
4065
4031
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4066
4032
|
if (c < .001) return [
|
|
4067
4033
|
e,
|
|
@@ -4076,17 +4042,17 @@ function dn(e, t, n, r, i, a) {
|
|
|
4076
4042
|
}
|
|
4077
4043
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4078
4044
|
}
|
|
4079
|
-
function
|
|
4045
|
+
function pn(e, t, n) {
|
|
4080
4046
|
if (e.length < 4) return e;
|
|
4081
4047
|
let r = [];
|
|
4082
4048
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4083
|
-
let a =
|
|
4049
|
+
let a = fn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4084
4050
|
if (i === 0) r.push(...a);
|
|
4085
4051
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4086
4052
|
}
|
|
4087
4053
|
return r;
|
|
4088
4054
|
}
|
|
4089
|
-
function
|
|
4055
|
+
function mn(e, t, n, r, i, a) {
|
|
4090
4056
|
let o = [
|
|
4091
4057
|
e,
|
|
4092
4058
|
t,
|
|
@@ -4098,12 +4064,12 @@ function pn(e, t, n, r, i, a) {
|
|
|
4098
4064
|
t + r
|
|
4099
4065
|
], s = [];
|
|
4100
4066
|
for (let e = 0; e < 4; e++) {
|
|
4101
|
-
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u =
|
|
4067
|
+
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = fn(t, n, c, l, i, a);
|
|
4102
4068
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4103
4069
|
}
|
|
4104
4070
|
return s;
|
|
4105
4071
|
}
|
|
4106
|
-
function
|
|
4072
|
+
function hn(e, t, n, r, i) {
|
|
4107
4073
|
let a = [];
|
|
4108
4074
|
for (let o = 0; o < 24; o++) {
|
|
4109
4075
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4111,26 +4077,26 @@ function mn(e, t, n, r, i) {
|
|
|
4111
4077
|
}
|
|
4112
4078
|
return a;
|
|
4113
4079
|
}
|
|
4114
|
-
function
|
|
4080
|
+
function gn(e, t, n) {
|
|
4115
4081
|
let r = e.length / 2;
|
|
4116
4082
|
if (r < 2) return e;
|
|
4117
4083
|
let i = [];
|
|
4118
4084
|
for (let a = 0; a < r; a++) {
|
|
4119
|
-
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d =
|
|
4085
|
+
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = fn(o, s, l, u, t, n);
|
|
4120
4086
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4121
4087
|
}
|
|
4122
4088
|
return i;
|
|
4123
4089
|
}
|
|
4124
4090
|
//#endregion
|
|
4125
4091
|
//#region src/style/shape/SketchyStyle.ts
|
|
4126
|
-
function
|
|
4092
|
+
function _n(e, t) {
|
|
4127
4093
|
if (!t) return e;
|
|
4128
4094
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4129
4095
|
if (!n) return e;
|
|
4130
4096
|
let r = parseFloat(n[1]);
|
|
4131
4097
|
return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
|
|
4132
4098
|
}
|
|
4133
|
-
function
|
|
4099
|
+
function vn(e) {
|
|
4134
4100
|
let { jitter: t, color: n } = e;
|
|
4135
4101
|
return { transform(e) {
|
|
4136
4102
|
switch (e.type) {
|
|
@@ -4148,7 +4114,7 @@ function _n(e) {
|
|
|
4148
4114
|
}), a && e.paint.strokeWidth) {
|
|
4149
4115
|
let i = {
|
|
4150
4116
|
type: "polygon",
|
|
4151
|
-
vertices:
|
|
4117
|
+
vertices: mn(e.x, e.y, e.width, e.height, t, r),
|
|
4152
4118
|
paint: {
|
|
4153
4119
|
stroke: a,
|
|
4154
4120
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4163,7 +4129,7 @@ function _n(e) {
|
|
|
4163
4129
|
}
|
|
4164
4130
|
return {
|
|
4165
4131
|
type: "polygon",
|
|
4166
|
-
vertices:
|
|
4132
|
+
vertices: mn(e.x, e.y, e.width, e.height, t, r),
|
|
4167
4133
|
paint: {
|
|
4168
4134
|
fill: i,
|
|
4169
4135
|
stroke: a,
|
|
@@ -4178,7 +4144,7 @@ function _n(e) {
|
|
|
4178
4144
|
let r = Y(X(e.cx, e.cy, e.radius));
|
|
4179
4145
|
return {
|
|
4180
4146
|
type: "polygon",
|
|
4181
|
-
vertices:
|
|
4147
|
+
vertices: hn(e.cx, e.cy, e.radius, t, r),
|
|
4182
4148
|
paint: {
|
|
4183
4149
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4184
4150
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4190,7 +4156,7 @@ function _n(e) {
|
|
|
4190
4156
|
};
|
|
4191
4157
|
}
|
|
4192
4158
|
case "line": {
|
|
4193
|
-
let r = Y(X(...e.points.slice(0, 4))), i =
|
|
4159
|
+
let r = Y(X(...e.points.slice(0, 4))), i = pn(e.points, t, r), a = _n(n, e.paint.stroke), o = {
|
|
4194
4160
|
...e.paint,
|
|
4195
4161
|
stroke: a
|
|
4196
4162
|
};
|
|
@@ -4201,7 +4167,7 @@ function _n(e) {
|
|
|
4201
4167
|
};
|
|
4202
4168
|
}
|
|
4203
4169
|
case "polygon": {
|
|
4204
|
-
let r = Y(X(...e.vertices.slice(0, 4))), i =
|
|
4170
|
+
let r = Y(X(...e.vertices.slice(0, 4))), i = gn(e.vertices, t, r);
|
|
4205
4171
|
return {
|
|
4206
4172
|
...e,
|
|
4207
4173
|
vertices: i,
|
|
@@ -4223,16 +4189,16 @@ function _n(e) {
|
|
|
4223
4189
|
}
|
|
4224
4190
|
//#endregion
|
|
4225
4191
|
//#region src/style/shape/IsometricStyle.ts
|
|
4226
|
-
function
|
|
4192
|
+
function yn(e) {
|
|
4227
4193
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4228
4194
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4229
4195
|
}
|
|
4230
|
-
function
|
|
4196
|
+
function bn(e) {
|
|
4231
4197
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4232
4198
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4233
4199
|
}
|
|
4234
4200
|
var Z = 32;
|
|
4235
|
-
function
|
|
4201
|
+
function xn(e, t) {
|
|
4236
4202
|
let n = Array(t.length);
|
|
4237
4203
|
for (let r = 0; r < t.length; r += 2) {
|
|
4238
4204
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4240,7 +4206,7 @@ function bn(e, t) {
|
|
|
4240
4206
|
}
|
|
4241
4207
|
return n;
|
|
4242
4208
|
}
|
|
4243
|
-
function
|
|
4209
|
+
function Sn(e, t, n, r, i) {
|
|
4244
4210
|
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);
|
|
4245
4211
|
return [
|
|
4246
4212
|
a,
|
|
@@ -4253,8 +4219,8 @@ function xn(e, t, n, r, i) {
|
|
|
4253
4219
|
f
|
|
4254
4220
|
];
|
|
4255
4221
|
}
|
|
4256
|
-
function
|
|
4257
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
4222
|
+
function Cn(e = {}) {
|
|
4223
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = yn(t), i = bn(t);
|
|
4258
4224
|
function a(e, t, n, i) {
|
|
4259
4225
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4260
4226
|
return [
|
|
@@ -4267,7 +4233,7 @@ function Sn(e = {}) {
|
|
|
4267
4233
|
];
|
|
4268
4234
|
}
|
|
4269
4235
|
function o(e) {
|
|
4270
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
4236
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = Sn(r, t, i, a, o);
|
|
4271
4237
|
if (s.dash || s.dashEnabled) {
|
|
4272
4238
|
let t = [];
|
|
4273
4239
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4466,11 +4432,11 @@ function Sn(e = {}) {
|
|
|
4466
4432
|
case "circle": return s(e);
|
|
4467
4433
|
case "line": return {
|
|
4468
4434
|
...e,
|
|
4469
|
-
points:
|
|
4435
|
+
points: xn(r, e.points)
|
|
4470
4436
|
};
|
|
4471
4437
|
case "polygon": return {
|
|
4472
4438
|
...e,
|
|
4473
|
-
vertices:
|
|
4439
|
+
vertices: xn(r, e.vertices)
|
|
4474
4440
|
};
|
|
4475
4441
|
case "text": {
|
|
4476
4442
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
@@ -4525,21 +4491,21 @@ function Sn(e = {}) {
|
|
|
4525
4491
|
}
|
|
4526
4492
|
//#endregion
|
|
4527
4493
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4528
|
-
var Q = "#1a1a1a",
|
|
4529
|
-
function
|
|
4494
|
+
var Q = "#1a1a1a", wn = "#ffc200", Tn = "#ff6600", En = 26, Dn = 26, On = 26, kn = 255, An = 194, jn = 0;
|
|
4495
|
+
function Mn(e) {
|
|
4530
4496
|
let t = q(e);
|
|
4531
|
-
if (!t) return J(
|
|
4532
|
-
let n =
|
|
4533
|
-
return J(Math.round(
|
|
4497
|
+
if (!t) return J(kn, An, jn);
|
|
4498
|
+
let n = Ot(t);
|
|
4499
|
+
return J(Math.round(En + (kn - En) * n), Math.round(Dn + (An - Dn) * n), Math.round(On + (jn - On) * n), t.a);
|
|
4534
4500
|
}
|
|
4535
|
-
function
|
|
4501
|
+
function Nn(e) {
|
|
4536
4502
|
return {
|
|
4537
4503
|
...e,
|
|
4538
|
-
fill: e.fill ?
|
|
4504
|
+
fill: e.fill ? Mn(e.fill) : e.fill,
|
|
4539
4505
|
stroke: e.stroke ? Q : e.stroke
|
|
4540
4506
|
};
|
|
4541
4507
|
}
|
|
4542
|
-
function
|
|
4508
|
+
function Pn(e, t, n, r) {
|
|
4543
4509
|
let i = [], a = e.length;
|
|
4544
4510
|
for (let o = 0; o < a; o++) {
|
|
4545
4511
|
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;
|
|
@@ -4550,7 +4516,7 @@ function Nn(e, t, n, r) {
|
|
|
4550
4516
|
}
|
|
4551
4517
|
return i;
|
|
4552
4518
|
}
|
|
4553
|
-
function
|
|
4519
|
+
function Fn(e, t, n, r, i) {
|
|
4554
4520
|
let a = [
|
|
4555
4521
|
[e, t],
|
|
4556
4522
|
[e + n, t],
|
|
@@ -4558,17 +4524,17 @@ function Pn(e, t, n, r, i) {
|
|
|
4558
4524
|
[e, t + r]
|
|
4559
4525
|
], 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 = [];
|
|
4560
4526
|
for (let e = u; e <= d; e++) {
|
|
4561
|
-
let t = e * o, n = t + s, r =
|
|
4562
|
-
r =
|
|
4527
|
+
let t = e * o, n = t + s, r = Pn(a, 1, 1, t);
|
|
4528
|
+
r = Pn(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
4563
4529
|
}
|
|
4564
4530
|
return f;
|
|
4565
4531
|
}
|
|
4566
|
-
var
|
|
4532
|
+
var In = { transform(e, t) {
|
|
4567
4533
|
switch (e.type) {
|
|
4568
4534
|
case "rect": {
|
|
4569
4535
|
if (!e.paint.fill) return {
|
|
4570
4536
|
...e,
|
|
4571
|
-
paint:
|
|
4537
|
+
paint: Nn(e.paint)
|
|
4572
4538
|
};
|
|
4573
4539
|
let n = {
|
|
4574
4540
|
...e,
|
|
@@ -4576,12 +4542,12 @@ var Fn = { transform(e, t) {
|
|
|
4576
4542
|
fill: Q,
|
|
4577
4543
|
strokeWidth: e.paint.strokeWidth
|
|
4578
4544
|
}
|
|
4579
|
-
}, r =
|
|
4545
|
+
}, r = Fn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4580
4546
|
type: "polygon",
|
|
4581
4547
|
vertices: t,
|
|
4582
4548
|
layer: e.layer,
|
|
4583
4549
|
paint: {
|
|
4584
|
-
fill:
|
|
4550
|
+
fill: wn,
|
|
4585
4551
|
alpha: .65
|
|
4586
4552
|
}
|
|
4587
4553
|
})), i = {
|
|
@@ -4600,13 +4566,13 @@ var Fn = { transform(e, t) {
|
|
|
4600
4566
|
}
|
|
4601
4567
|
case "circle": return {
|
|
4602
4568
|
...e,
|
|
4603
|
-
paint:
|
|
4569
|
+
paint: Nn(e.paint)
|
|
4604
4570
|
};
|
|
4605
4571
|
case "polygon": return {
|
|
4606
4572
|
...e,
|
|
4607
4573
|
paint: {
|
|
4608
4574
|
...e.paint,
|
|
4609
|
-
fill: e.paint.fill ?
|
|
4575
|
+
fill: e.paint.fill ? Tn : e.paint.fill,
|
|
4610
4576
|
stroke: e.paint.stroke ? Q : e.paint.stroke
|
|
4611
4577
|
}
|
|
4612
4578
|
};
|
|
@@ -4614,24 +4580,24 @@ var Fn = { transform(e, t) {
|
|
|
4614
4580
|
...e,
|
|
4615
4581
|
paint: e.paint.stroke ? {
|
|
4616
4582
|
...e.paint,
|
|
4617
|
-
stroke:
|
|
4583
|
+
stroke: Tn
|
|
4618
4584
|
} : e.paint
|
|
4619
4585
|
};
|
|
4620
4586
|
case "text": return {
|
|
4621
4587
|
...e,
|
|
4622
|
-
fill:
|
|
4588
|
+
fill: Tn,
|
|
4623
4589
|
stroke: Q,
|
|
4624
4590
|
strokeWidth: t.roomSize * .25
|
|
4625
4591
|
};
|
|
4626
4592
|
case "image":
|
|
4627
4593
|
case "group": return e;
|
|
4628
4594
|
}
|
|
4629
|
-
} },
|
|
4630
|
-
function
|
|
4595
|
+
} }, Ln = "#c8eeff", Rn = "#00c8ff", zn = "#00ffaa", Bn = .2, Vn = 5, Hn = 190;
|
|
4596
|
+
function Un(e, t, n) {
|
|
4631
4597
|
e /= 255, t /= 255, n /= 255;
|
|
4632
4598
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4633
4599
|
if (r === i) return [
|
|
4634
|
-
|
|
4600
|
+
Hn,
|
|
4635
4601
|
0,
|
|
4636
4602
|
a
|
|
4637
4603
|
];
|
|
@@ -4642,54 +4608,54 @@ function Hn(e, t, n) {
|
|
|
4642
4608
|
a
|
|
4643
4609
|
];
|
|
4644
4610
|
}
|
|
4645
|
-
function
|
|
4611
|
+
function Wn(e, t, n, r = 1) {
|
|
4646
4612
|
e = (e % 360 + 360) % 360;
|
|
4647
4613
|
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;
|
|
4648
4614
|
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);
|
|
4649
4615
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4650
4616
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4651
4617
|
}
|
|
4652
|
-
function
|
|
4618
|
+
function Gn(e) {
|
|
4653
4619
|
let t = q(e);
|
|
4654
|
-
if (!t) return
|
|
4655
|
-
let [n, r] =
|
|
4656
|
-
return
|
|
4620
|
+
if (!t) return Wn(Hn, .55, .18);
|
|
4621
|
+
let [n, r] = Un(t.r, t.g, t.b);
|
|
4622
|
+
return Wn(r < .08 ? Hn : n, .55, .18, t.a);
|
|
4657
4623
|
}
|
|
4658
|
-
function
|
|
4624
|
+
function Kn(e) {
|
|
4659
4625
|
return {
|
|
4660
4626
|
...e,
|
|
4661
|
-
fill: e.fill ?
|
|
4662
|
-
stroke: e.stroke ?
|
|
4627
|
+
fill: e.fill ? Gn(e.fill) : e.fill,
|
|
4628
|
+
stroke: e.stroke ? Rn : e.stroke
|
|
4663
4629
|
};
|
|
4664
4630
|
}
|
|
4665
|
-
function
|
|
4631
|
+
function qn(e) {
|
|
4666
4632
|
return {
|
|
4667
|
-
stroke:
|
|
4668
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4669
|
-
alpha:
|
|
4633
|
+
stroke: Rn,
|
|
4634
|
+
strokeWidth: (e.strokeWidth ?? 1) * Vn,
|
|
4635
|
+
alpha: Bn
|
|
4670
4636
|
};
|
|
4671
4637
|
}
|
|
4672
|
-
function
|
|
4638
|
+
function Jn(e) {
|
|
4673
4639
|
return {
|
|
4674
|
-
stroke:
|
|
4675
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4676
|
-
alpha:
|
|
4640
|
+
stroke: zn,
|
|
4641
|
+
strokeWidth: (e.strokeWidth ?? 1) * Vn,
|
|
4642
|
+
alpha: Bn,
|
|
4677
4643
|
dash: e.dash,
|
|
4678
4644
|
dashEnabled: e.dashEnabled
|
|
4679
4645
|
};
|
|
4680
4646
|
}
|
|
4681
|
-
var
|
|
4647
|
+
var Yn = { transform(e) {
|
|
4682
4648
|
switch (e.type) {
|
|
4683
4649
|
case "rect": {
|
|
4684
4650
|
let t = {
|
|
4685
4651
|
...e,
|
|
4686
|
-
paint:
|
|
4652
|
+
paint: Kn(e.paint)
|
|
4687
4653
|
};
|
|
4688
4654
|
return e.paint.stroke ? [{
|
|
4689
4655
|
...e,
|
|
4690
4656
|
hit: void 0,
|
|
4691
4657
|
paint: {
|
|
4692
|
-
...
|
|
4658
|
+
...qn(e.paint),
|
|
4693
4659
|
fill: void 0
|
|
4694
4660
|
}
|
|
4695
4661
|
}, t] : t;
|
|
@@ -4697,13 +4663,13 @@ var Jn = { transform(e) {
|
|
|
4697
4663
|
case "circle": {
|
|
4698
4664
|
let t = {
|
|
4699
4665
|
...e,
|
|
4700
|
-
paint:
|
|
4666
|
+
paint: Kn(e.paint)
|
|
4701
4667
|
};
|
|
4702
4668
|
return e.paint.stroke ? [{
|
|
4703
4669
|
...e,
|
|
4704
4670
|
hit: void 0,
|
|
4705
4671
|
paint: {
|
|
4706
|
-
...
|
|
4672
|
+
...qn(e.paint),
|
|
4707
4673
|
fill: void 0
|
|
4708
4674
|
}
|
|
4709
4675
|
}, t] : t;
|
|
@@ -4720,38 +4686,38 @@ var Jn = { transform(e) {
|
|
|
4720
4686
|
...e,
|
|
4721
4687
|
paint: e.paint.stroke ? {
|
|
4722
4688
|
...e.paint,
|
|
4723
|
-
stroke:
|
|
4689
|
+
stroke: zn
|
|
4724
4690
|
} : e.paint
|
|
4725
4691
|
};
|
|
4726
4692
|
return e.paint.stroke ? [{
|
|
4727
4693
|
...e,
|
|
4728
4694
|
hit: void 0,
|
|
4729
|
-
paint:
|
|
4695
|
+
paint: Jn(e.paint)
|
|
4730
4696
|
}, t] : t;
|
|
4731
4697
|
}
|
|
4732
4698
|
case "polygon": return {
|
|
4733
4699
|
...e,
|
|
4734
4700
|
paint: {
|
|
4735
4701
|
...e.paint,
|
|
4736
|
-
fill: e.paint.fill ?
|
|
4702
|
+
fill: e.paint.fill ? zn : e.paint.fill,
|
|
4737
4703
|
stroke: void 0
|
|
4738
4704
|
}
|
|
4739
4705
|
};
|
|
4740
4706
|
case "text": return {
|
|
4741
4707
|
...e,
|
|
4742
|
-
fill:
|
|
4708
|
+
fill: Ln
|
|
4743
4709
|
};
|
|
4744
4710
|
case "image":
|
|
4745
4711
|
case "group": return e;
|
|
4746
4712
|
}
|
|
4747
|
-
} },
|
|
4748
|
-
function
|
|
4749
|
-
return
|
|
4713
|
+
} }, Xn = Bt, Zn = Qt, Qn = dn;
|
|
4714
|
+
function $n(e) {
|
|
4715
|
+
return vn(e);
|
|
4750
4716
|
}
|
|
4751
|
-
function
|
|
4752
|
-
return
|
|
4717
|
+
function er(e = {}) {
|
|
4718
|
+
return Cn(e);
|
|
4753
4719
|
}
|
|
4754
|
-
var
|
|
4720
|
+
var tr = In, nr = Yn, rr = class {
|
|
4755
4721
|
get settings() {
|
|
4756
4722
|
return this.state.settings;
|
|
4757
4723
|
}
|
|
@@ -4768,7 +4734,7 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4768
4734
|
return this.backend.events;
|
|
4769
4735
|
}
|
|
4770
4736
|
constructor(e, t, n, r) {
|
|
4771
|
-
this.currentStyle = W, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new
|
|
4737
|
+
this.currentStyle = W, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new Dt(this.state, n);
|
|
4772
4738
|
}
|
|
4773
4739
|
destroy() {
|
|
4774
4740
|
this.backend.destroy();
|
|
@@ -4840,10 +4806,10 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4840
4806
|
this.backend.removeSceneOverlay(e);
|
|
4841
4807
|
}
|
|
4842
4808
|
addLiveEffect(e, t) {
|
|
4843
|
-
this.backend instanceof
|
|
4809
|
+
this.backend instanceof Dt && this.backend.addLiveEffect(e, t);
|
|
4844
4810
|
}
|
|
4845
4811
|
removeLiveEffect(e) {
|
|
4846
|
-
this.backend instanceof
|
|
4812
|
+
this.backend instanceof Dt && this.backend.removeLiveEffect(e);
|
|
4847
4813
|
}
|
|
4848
4814
|
hitTest(e, t) {
|
|
4849
4815
|
let n = this.backend.coordinateTransform(e, t);
|
|
@@ -4924,15 +4890,15 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4924
4890
|
getCullingMode() {
|
|
4925
4891
|
return this.state.settings.cullingMode;
|
|
4926
4892
|
}
|
|
4927
|
-
},
|
|
4928
|
-
function
|
|
4893
|
+
}, ir = "room";
|
|
4894
|
+
function ar(e, t) {
|
|
4929
4895
|
let n = /* @__PURE__ */ new Map();
|
|
4930
4896
|
function r(e) {
|
|
4931
4897
|
let t = n.get(e);
|
|
4932
4898
|
return t || (t = [], n.set(e, t)), t;
|
|
4933
4899
|
}
|
|
4934
4900
|
function i(e, t, n, i, o, s, c) {
|
|
4935
|
-
let l = e.layer ?? c ??
|
|
4901
|
+
let l = e.layer ?? c ?? ir;
|
|
4936
4902
|
switch (e.type) {
|
|
4937
4903
|
case "rect": {
|
|
4938
4904
|
let a = {
|
|
@@ -4945,7 +4911,7 @@ function ir(e, t) {
|
|
|
4945
4911
|
stroke: e.paint.stroke,
|
|
4946
4912
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4947
4913
|
cr: (e.cornerRadius ?? 0) * i,
|
|
4948
|
-
dash:
|
|
4914
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4949
4915
|
};
|
|
4950
4916
|
r(l).push(a);
|
|
4951
4917
|
return;
|
|
@@ -4959,16 +4925,16 @@ function ir(e, t) {
|
|
|
4959
4925
|
fill: e.paint.fill,
|
|
4960
4926
|
stroke: e.paint.stroke,
|
|
4961
4927
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4962
|
-
dash:
|
|
4928
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4963
4929
|
});
|
|
4964
4930
|
return;
|
|
4965
4931
|
case "line": {
|
|
4966
4932
|
let a = {
|
|
4967
4933
|
type: "line",
|
|
4968
|
-
points:
|
|
4934
|
+
points: or(e.points, t, n, i, o, s),
|
|
4969
4935
|
stroke: e.paint.stroke,
|
|
4970
4936
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4971
|
-
dash:
|
|
4937
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled),
|
|
4972
4938
|
lineCap: e.lineCap,
|
|
4973
4939
|
lineJoin: e.lineJoin,
|
|
4974
4940
|
alpha: e.paint.alpha
|
|
@@ -4979,7 +4945,7 @@ function ir(e, t) {
|
|
|
4979
4945
|
case "polygon": {
|
|
4980
4946
|
let a = {
|
|
4981
4947
|
type: "polygon",
|
|
4982
|
-
vertices:
|
|
4948
|
+
vertices: or(e.vertices, t, n, i, o, s),
|
|
4983
4949
|
fill: e.paint.fill,
|
|
4984
4950
|
stroke: e.paint.stroke,
|
|
4985
4951
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
@@ -4988,7 +4954,7 @@ function ir(e, t) {
|
|
|
4988
4954
|
return;
|
|
4989
4955
|
}
|
|
4990
4956
|
case "text": {
|
|
4991
|
-
let a =
|
|
4957
|
+
let a = cr(e.transform, t, n, i, o, s), c = {
|
|
4992
4958
|
type: "text",
|
|
4993
4959
|
x: a ? 0 : (t + e.x) * i + o,
|
|
4994
4960
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -5011,7 +4977,7 @@ function ir(e, t) {
|
|
|
5011
4977
|
return;
|
|
5012
4978
|
}
|
|
5013
4979
|
case "image": {
|
|
5014
|
-
let a =
|
|
4980
|
+
let a = cr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
|
|
5015
4981
|
r(l).push({
|
|
5016
4982
|
type: "image",
|
|
5017
4983
|
x: c,
|
|
@@ -5031,7 +4997,7 @@ function ir(e, t) {
|
|
|
5031
4997
|
function a(e, t, n, a, o, s, c) {
|
|
5032
4998
|
let l = e.layer ?? c;
|
|
5033
4999
|
if (e.noScale) {
|
|
5034
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
5000
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? ir);
|
|
5035
5001
|
d.push({
|
|
5036
5002
|
type: "pushTransform",
|
|
5037
5003
|
matrix: [
|
|
@@ -5058,19 +5024,19 @@ function ir(e, t) {
|
|
|
5058
5024
|
});
|
|
5059
5025
|
return o;
|
|
5060
5026
|
}
|
|
5061
|
-
function
|
|
5027
|
+
function or(e, t, n, r, i, a) {
|
|
5062
5028
|
let o = Array(e.length);
|
|
5063
5029
|
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;
|
|
5064
5030
|
return o;
|
|
5065
5031
|
}
|
|
5066
|
-
function
|
|
5032
|
+
function sr(e, t, n) {
|
|
5067
5033
|
if (n === !1) return;
|
|
5068
5034
|
if (!e || e.length === 0) return e;
|
|
5069
5035
|
let r = Array(e.length);
|
|
5070
5036
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5071
5037
|
return r;
|
|
5072
5038
|
}
|
|
5073
|
-
function
|
|
5039
|
+
function cr(e, t, n, r, i, a) {
|
|
5074
5040
|
if (!e) return;
|
|
5075
5041
|
let [o, s, c, l, u, d] = e;
|
|
5076
5042
|
return [
|
|
@@ -5084,21 +5050,21 @@ function sr(e, t, n, r, i, a) {
|
|
|
5084
5050
|
}
|
|
5085
5051
|
//#endregion
|
|
5086
5052
|
//#region src/render/SvgRenderer.ts
|
|
5087
|
-
function
|
|
5053
|
+
function lr(e) {
|
|
5088
5054
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5089
5055
|
}
|
|
5090
5056
|
function $(e, t) {
|
|
5091
|
-
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ?
|
|
5057
|
+
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? lr(t) : t}"`;
|
|
5092
5058
|
}
|
|
5093
|
-
function
|
|
5059
|
+
function ur(e) {
|
|
5094
5060
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5095
5061
|
}
|
|
5096
|
-
function
|
|
5062
|
+
function dr(e) {
|
|
5097
5063
|
let t = [];
|
|
5098
|
-
for (let n of e)
|
|
5064
|
+
for (let n of e) fr(n.commands, t);
|
|
5099
5065
|
return t;
|
|
5100
5066
|
}
|
|
5101
|
-
function
|
|
5067
|
+
function fr(e, t) {
|
|
5102
5068
|
let n = [];
|
|
5103
5069
|
for (let r of e) switch (r.type) {
|
|
5104
5070
|
case "pushTransform": {
|
|
@@ -5116,29 +5082,29 @@ function dr(e, t) {
|
|
|
5116
5082
|
break;
|
|
5117
5083
|
}
|
|
5118
5084
|
default: {
|
|
5119
|
-
let e =
|
|
5085
|
+
let e = pr(r);
|
|
5120
5086
|
e && t.push(e);
|
|
5121
5087
|
break;
|
|
5122
5088
|
}
|
|
5123
5089
|
}
|
|
5124
5090
|
for (; n.length > 0;) t.push(n.pop());
|
|
5125
5091
|
}
|
|
5126
|
-
function
|
|
5092
|
+
function pr(e) {
|
|
5127
5093
|
switch (e.type) {
|
|
5128
5094
|
case "rect": {
|
|
5129
5095
|
let t = e.fill ?? "none", n = e.cr > 0 ? `${$("rx", e.cr)}${$("ry", e.cr)}` : "";
|
|
5130
|
-
return `<rect${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${n}${
|
|
5096
|
+
return `<rect${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${n}${ur(e.dash)}/>`;
|
|
5131
5097
|
}
|
|
5132
5098
|
case "circle": {
|
|
5133
5099
|
let t = e.fill ?? "none";
|
|
5134
|
-
return `<circle${$("cx", e.cx)}${$("cy", e.cy)}${$("r", e.r)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${
|
|
5100
|
+
return `<circle${$("cx", e.cx)}${$("cy", e.cy)}${$("r", e.r)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${ur(e.dash)}/>`;
|
|
5135
5101
|
}
|
|
5136
5102
|
case "line": {
|
|
5137
5103
|
let t = e.points;
|
|
5138
5104
|
if (t.length < 2) return;
|
|
5139
5105
|
let n = [];
|
|
5140
5106
|
for (let e = 0; e < t.length; e += 2) n.push(`${t[e]},${t[e + 1]}`);
|
|
5141
|
-
return `<polyline points="${n.join(" ")}"${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${
|
|
5107
|
+
return `<polyline points="${n.join(" ")}"${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${ur(e.dash)}${$("stroke-linecap", e.lineCap)}${$("stroke-linejoin", e.lineJoin)}${$("opacity", e.alpha)} fill="none"/>`;
|
|
5142
5108
|
}
|
|
5143
5109
|
case "polygon": {
|
|
5144
5110
|
let t = e.vertices;
|
|
@@ -5151,30 +5117,30 @@ function fr(e) {
|
|
|
5151
5117
|
let t = e.x, n = e.y, r = "start", i = "auto";
|
|
5152
5118
|
e.w > 0 && (e.align === "center" ? (t = e.x + e.w / 2, r = "middle") : e.align === "right" && (t = e.x + e.w, r = "end")), e.h > 0 && e.vAlign === "middle" && (e.baselineRatio === void 0 ? (n = e.y + e.h / 2, i = "central") : n = e.y + e.h / 2 + e.baselineRatio * e.fontSize);
|
|
5153
5119
|
let a = e.transform ? ` transform="matrix(${e.transform.join(",")})"` : "", o = e.fontStyle === "bold" ? " font-weight=\"bold\"" : "", s = e.stroke && e.sw > 0 ? ` stroke="${e.stroke}" stroke-width="${e.sw}" paint-order="stroke fill"` : "";
|
|
5154
|
-
return `<text${$("x", t)}${$("y", n)}${$("font-size", e.fontSize)}${e.fontFamily ? $("font-family", e.fontFamily) : ""}${o}${$("fill", e.fill)}${s} text-anchor="${r}" dominant-baseline="${i}"${a}>${
|
|
5120
|
+
return `<text${$("x", t)}${$("y", n)}${$("font-size", e.fontSize)}${e.fontFamily ? $("font-family", e.fontFamily) : ""}${o}${$("fill", e.fill)}${s} text-anchor="${r}" dominant-baseline="${i}"${a}>${lr(e.text)}</text>`;
|
|
5155
5121
|
}
|
|
5156
5122
|
case "image":
|
|
5157
5123
|
if (e.transform) {
|
|
5158
5124
|
let [t, n, r, i, a, o] = e.transform;
|
|
5159
|
-
return `<image${$("width", e.w)}${$("height", e.h)} href="${
|
|
5125
|
+
return `<image${$("width", e.w)}${$("height", e.h)} href="${lr(e.src)}" transform="matrix(${t},${n},${r},${i},${a},${o})"/>`;
|
|
5160
5126
|
}
|
|
5161
|
-
return `<image${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)} href="${
|
|
5127
|
+
return `<image${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)} href="${lr(e.src)}"/>`;
|
|
5162
5128
|
}
|
|
5163
5129
|
}
|
|
5164
5130
|
//#endregion
|
|
5165
5131
|
//#region src/render/CanvasRenderer.ts
|
|
5166
|
-
var
|
|
5132
|
+
var mr = (e) => {
|
|
5167
5133
|
if (typeof Image < "u") {
|
|
5168
5134
|
let t = new Image();
|
|
5169
5135
|
return t.src = e, t;
|
|
5170
5136
|
}
|
|
5171
5137
|
return null;
|
|
5172
5138
|
};
|
|
5173
|
-
function
|
|
5174
|
-
let r = n.imageFactory ??
|
|
5175
|
-
for (let n of t)
|
|
5139
|
+
function hr(e, t, n = {}) {
|
|
5140
|
+
let r = n.imageFactory ?? mr;
|
|
5141
|
+
for (let n of t) gr(e, n.commands, r);
|
|
5176
5142
|
}
|
|
5177
|
-
function
|
|
5143
|
+
function gr(e, t, n) {
|
|
5178
5144
|
let r = 0;
|
|
5179
5145
|
for (let i of t) switch (i.type) {
|
|
5180
5146
|
case "pushTransform":
|
|
@@ -5188,12 +5154,12 @@ function hr(e, t, n) {
|
|
|
5188
5154
|
r > 0 && (e.restore(), r--);
|
|
5189
5155
|
break;
|
|
5190
5156
|
default:
|
|
5191
|
-
|
|
5157
|
+
_r(e, i, n);
|
|
5192
5158
|
break;
|
|
5193
5159
|
}
|
|
5194
5160
|
for (; r > 0;) e.restore(), r--;
|
|
5195
5161
|
}
|
|
5196
|
-
function
|
|
5162
|
+
function _r(e, t, n) {
|
|
5197
5163
|
switch (t.type) {
|
|
5198
5164
|
case "rect":
|
|
5199
5165
|
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
@@ -5254,35 +5220,35 @@ function gr(e, t, n) {
|
|
|
5254
5220
|
}
|
|
5255
5221
|
//#endregion
|
|
5256
5222
|
//#region src/export/flushSceneShapes.ts
|
|
5257
|
-
function
|
|
5258
|
-
n(e.grid), n(e.link), n(e.room), n(
|
|
5223
|
+
function vr(e, t, n) {
|
|
5224
|
+
n(e.grid), n(e.link), n(e.room), n(yr(t.state, t.overlays));
|
|
5259
5225
|
for (let e of t.sceneOverlays) {
|
|
5260
5226
|
let r = e.render(t.state, t.viewportBounds);
|
|
5261
5227
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5262
5228
|
}
|
|
5263
5229
|
n(e.topLabel);
|
|
5264
5230
|
}
|
|
5265
|
-
function
|
|
5231
|
+
function yr(e, t) {
|
|
5266
5232
|
let n = e.getOverlaysForArea(t);
|
|
5267
5233
|
if (!n) return [];
|
|
5268
5234
|
let r = e.settings, i = [];
|
|
5269
5235
|
if (n.paths) for (let t of n.paths) {
|
|
5270
|
-
let n =
|
|
5271
|
-
i.push(...
|
|
5236
|
+
let n = ct(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5237
|
+
i.push(...dt(n));
|
|
5272
5238
|
}
|
|
5273
5239
|
if (n.highlights) for (let t of n.highlights) {
|
|
5274
5240
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5275
|
-
n && i.push(
|
|
5241
|
+
n && i.push(lt(ot(n, t.color, r)));
|
|
5276
5242
|
}
|
|
5277
5243
|
if (n.position) {
|
|
5278
5244
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5279
|
-
t && i.push(
|
|
5245
|
+
t && i.push(ut(st(t, r)));
|
|
5280
5246
|
}
|
|
5281
5247
|
return i;
|
|
5282
5248
|
}
|
|
5283
5249
|
//#endregion
|
|
5284
5250
|
//#region src/export/sceneBounds.ts
|
|
5285
|
-
function
|
|
5251
|
+
function br(e, t, n = 0) {
|
|
5286
5252
|
if (!t.worldToScene) return e;
|
|
5287
5253
|
let r = [
|
|
5288
5254
|
t.worldToScene(e.x, e.y),
|
|
@@ -5300,15 +5266,15 @@ function yr(e, t, n = 0) {
|
|
|
5300
5266
|
}
|
|
5301
5267
|
//#endregion
|
|
5302
5268
|
//#region src/export/SvgExporter.ts
|
|
5303
|
-
var
|
|
5269
|
+
var xr = {
|
|
5304
5270
|
scale: 1,
|
|
5305
5271
|
offsetX: 0,
|
|
5306
5272
|
offsetY: 0
|
|
5307
5273
|
};
|
|
5308
|
-
function
|
|
5274
|
+
function Sr(e) {
|
|
5309
5275
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5310
5276
|
}
|
|
5311
|
-
var
|
|
5277
|
+
var Cr = class {
|
|
5312
5278
|
constructor(e = {}) {
|
|
5313
5279
|
this.options = e;
|
|
5314
5280
|
}
|
|
@@ -5317,30 +5283,30 @@ var Sr = class {
|
|
|
5317
5283
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5318
5284
|
let o = a, s = o.getPlane(i);
|
|
5319
5285
|
if (!s) return;
|
|
5320
|
-
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Re(new
|
|
5286
|
+
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Re(new B(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
|
|
5321
5287
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5322
5288
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5323
5289
|
}), p = {
|
|
5324
5290
|
scale: 1,
|
|
5325
5291
|
roomSize: c.roomSize
|
|
5326
|
-
}, m = (e) => t === W ? e : G(e, t, p), h =
|
|
5327
|
-
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="${
|
|
5292
|
+
}, m = (e) => t === W ? e : G(e, t, p), h = br(u, t, c.roomSize * .5), g = [];
|
|
5293
|
+
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="${Sr(c.backgroundColor)}"/>`), vr(f, {
|
|
5328
5294
|
state: e,
|
|
5329
5295
|
viewportBounds: d,
|
|
5330
5296
|
sceneOverlays: n,
|
|
5331
5297
|
overlays: this.options.overlays
|
|
5332
5298
|
}, (e) => {
|
|
5333
|
-
e.length !== 0 && g.push(...
|
|
5299
|
+
e.length !== 0 && g.push(...dr(ar(m(e), xr)));
|
|
5334
5300
|
}), g.push("</svg>"), g.join("\n");
|
|
5335
5301
|
}
|
|
5336
|
-
},
|
|
5302
|
+
}, wr = class {
|
|
5337
5303
|
constructor(e = {}) {
|
|
5338
5304
|
this.options = e;
|
|
5339
5305
|
}
|
|
5340
5306
|
render({ backend: e }) {
|
|
5341
5307
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5342
5308
|
}
|
|
5343
|
-
},
|
|
5309
|
+
}, Tr = class {
|
|
5344
5310
|
constructor(e = {}) {
|
|
5345
5311
|
this.options = e;
|
|
5346
5312
|
}
|
|
@@ -5357,14 +5323,14 @@ var Sr = class {
|
|
|
5357
5323
|
};
|
|
5358
5324
|
//#endregion
|
|
5359
5325
|
//#region src/export/canvasToBytes.ts
|
|
5360
|
-
function
|
|
5326
|
+
function Er(e, t = "image/png", n) {
|
|
5361
5327
|
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);
|
|
5362
5328
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5363
5329
|
return s;
|
|
5364
5330
|
}
|
|
5365
5331
|
//#endregion
|
|
5366
5332
|
//#region src/export/CanvasExporter.ts
|
|
5367
|
-
var
|
|
5333
|
+
var Dr = class {
|
|
5368
5334
|
constructor(e) {
|
|
5369
5335
|
this.options = e;
|
|
5370
5336
|
}
|
|
@@ -5373,14 +5339,14 @@ var Er = class {
|
|
|
5373
5339
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5374
5340
|
let s = o, c = s.getPlane(a);
|
|
5375
5341
|
if (!c) return;
|
|
5376
|
-
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 =
|
|
5342
|
+
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 = {
|
|
5377
5343
|
scale: h,
|
|
5378
5344
|
offsetX: v,
|
|
5379
5345
|
offsetY: y
|
|
5380
5346
|
}, x = D.forRenderCamera(u, d, h, v, y), S = {
|
|
5381
5347
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5382
5348
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5383
|
-
}, C = Re(new
|
|
5349
|
+
}, C = Re(new B(e.mapReader, l).buildScene(s, c, a, e.lens), x.getViewportBounds(), l, S), w = r.Util.createCanvasElement();
|
|
5384
5350
|
w.width = u, w.height = d;
|
|
5385
5351
|
let T = w.getContext("2d");
|
|
5386
5352
|
if (!T) return;
|
|
@@ -5389,55 +5355,55 @@ var Er = class {
|
|
|
5389
5355
|
scale: h,
|
|
5390
5356
|
roomSize: l.roomSize
|
|
5391
5357
|
}, O = (e) => t === W ? e : G(e, t, E);
|
|
5392
|
-
return
|
|
5358
|
+
return vr(C, {
|
|
5393
5359
|
state: e,
|
|
5394
5360
|
viewportBounds: D.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5395
5361
|
sceneOverlays: n,
|
|
5396
5362
|
overlays: this.options.overlays
|
|
5397
5363
|
}, (e) => {
|
|
5398
|
-
e.length !== 0 &&
|
|
5364
|
+
e.length !== 0 && hr(T, ar(O(e), b));
|
|
5399
5365
|
}), w;
|
|
5400
5366
|
}
|
|
5401
|
-
},
|
|
5367
|
+
}, Or = class {
|
|
5402
5368
|
constructor(e) {
|
|
5403
|
-
this.options = e, this.canvasExporter = new
|
|
5369
|
+
this.options = e, this.canvasExporter = new Dr(e);
|
|
5404
5370
|
}
|
|
5405
5371
|
render(e) {
|
|
5406
5372
|
let t = this.canvasExporter.render(e);
|
|
5407
|
-
if (t) return
|
|
5373
|
+
if (t) return Er(t, this.options.mimeType, this.options.quality);
|
|
5408
5374
|
}
|
|
5409
|
-
},
|
|
5410
|
-
function
|
|
5375
|
+
}, kr, Ar, jr = 256;
|
|
5376
|
+
function Mr(e, t, n) {
|
|
5411
5377
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5412
|
-
if (
|
|
5413
|
-
let i =
|
|
5378
|
+
if (Ar === r && kr) return kr;
|
|
5379
|
+
let i = jr, a = i / 2, o = document.createElement("canvas");
|
|
5414
5380
|
o.width = i, o.height = i;
|
|
5415
5381
|
let s = o.getContext("2d");
|
|
5416
5382
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5417
5383
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5418
5384
|
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";
|
|
5419
5385
|
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);
|
|
5420
|
-
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),
|
|
5386
|
+
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), kr = o.toDataURL(), Ar = r, kr;
|
|
5421
5387
|
}
|
|
5422
|
-
function
|
|
5388
|
+
function Nr(e, t, n, r) {
|
|
5423
5389
|
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);
|
|
5424
5390
|
return {
|
|
5425
5391
|
cx: e,
|
|
5426
5392
|
cy: t,
|
|
5427
5393
|
displaySize: u,
|
|
5428
|
-
src:
|
|
5394
|
+
src: Mr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5429
5395
|
};
|
|
5430
5396
|
}
|
|
5431
5397
|
//#endregion
|
|
5432
5398
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5433
|
-
var
|
|
5399
|
+
var Pr = {
|
|
5434
5400
|
color: "#ffcc44",
|
|
5435
5401
|
radius: 12,
|
|
5436
5402
|
intensity: .7
|
|
5437
|
-
},
|
|
5403
|
+
}, Fr = class {
|
|
5438
5404
|
constructor(e) {
|
|
5439
5405
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5440
|
-
...
|
|
5406
|
+
...Pr,
|
|
5441
5407
|
...e
|
|
5442
5408
|
};
|
|
5443
5409
|
}
|
|
@@ -5460,7 +5426,7 @@ var Nr = {
|
|
|
5460
5426
|
if (e.positionRoomId === void 0) return;
|
|
5461
5427
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5462
5428
|
if (!n) return;
|
|
5463
|
-
let r =
|
|
5429
|
+
let r = Nr(n.x, n.y, t, this.params);
|
|
5464
5430
|
return {
|
|
5465
5431
|
type: "image",
|
|
5466
5432
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5471,7 +5437,7 @@ var Nr = {
|
|
|
5471
5437
|
layer: "overlay"
|
|
5472
5438
|
};
|
|
5473
5439
|
}
|
|
5474
|
-
},
|
|
5440
|
+
}, Ir = /* @__PURE__ */ u(((e, t) => {
|
|
5475
5441
|
t.exports = class {
|
|
5476
5442
|
constructor() {
|
|
5477
5443
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5501,14 +5467,14 @@ var Nr = {
|
|
|
5501
5467
|
return this.queue.find((t) => t.key === e);
|
|
5502
5468
|
}
|
|
5503
5469
|
};
|
|
5504
|
-
})),
|
|
5470
|
+
})), Lr = /* @__PURE__ */ u(((e, t) => {
|
|
5505
5471
|
function n(e, t) {
|
|
5506
5472
|
let r = /* @__PURE__ */ new Map();
|
|
5507
5473
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5508
5474
|
return r;
|
|
5509
5475
|
}
|
|
5510
5476
|
t.exports = n;
|
|
5511
|
-
})),
|
|
5477
|
+
})), Rr = /* @__PURE__ */ u(((e, t) => {
|
|
5512
5478
|
function n(e) {
|
|
5513
5479
|
let t = Number(e);
|
|
5514
5480
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5523,7 +5489,7 @@ var Nr = {
|
|
|
5523
5489
|
}), t;
|
|
5524
5490
|
}
|
|
5525
5491
|
t.exports = r;
|
|
5526
|
-
})),
|
|
5492
|
+
})), zr = /* @__PURE__ */ u(((e, t) => {
|
|
5527
5493
|
function n(e) {
|
|
5528
5494
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5529
5495
|
e.forEach((e, t) => {
|
|
@@ -5535,8 +5501,8 @@ var Nr = {
|
|
|
5535
5501
|
});
|
|
5536
5502
|
}
|
|
5537
5503
|
t.exports = n;
|
|
5538
|
-
})),
|
|
5539
|
-
var n =
|
|
5504
|
+
})), Br = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5505
|
+
var n = Ir(), r = Lr(), i = Rr(), a = zr();
|
|
5540
5506
|
t.exports = class {
|
|
5541
5507
|
constructor(e) {
|
|
5542
5508
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5586,7 +5552,7 @@ var Nr = {
|
|
|
5586
5552
|
return this.path(...e);
|
|
5587
5553
|
}
|
|
5588
5554
|
};
|
|
5589
|
-
})))(), 1),
|
|
5555
|
+
})))(), 1), Vr = {
|
|
5590
5556
|
1: "north",
|
|
5591
5557
|
2: "northeast",
|
|
5592
5558
|
3: "northwest",
|
|
@@ -5599,7 +5565,7 @@ var Nr = {
|
|
|
5599
5565
|
10: "down",
|
|
5600
5566
|
11: "in",
|
|
5601
5567
|
12: "out"
|
|
5602
|
-
},
|
|
5568
|
+
}, Hr = {
|
|
5603
5569
|
north: "n",
|
|
5604
5570
|
northeast: "ne",
|
|
5605
5571
|
northwest: "nw",
|
|
@@ -5612,7 +5578,7 @@ var Nr = {
|
|
|
5612
5578
|
down: "down",
|
|
5613
5579
|
in: "in",
|
|
5614
5580
|
out: "out"
|
|
5615
|
-
},
|
|
5581
|
+
}, Ur = class {
|
|
5616
5582
|
constructor(e) {
|
|
5617
5583
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5618
5584
|
}
|
|
@@ -5638,12 +5604,12 @@ var Nr = {
|
|
|
5638
5604
|
buildGraph() {
|
|
5639
5605
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5640
5606
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5641
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
5607
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Vr[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
5642
5608
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5643
5609
|
if (s.has(e)) return;
|
|
5644
5610
|
let c = this.mapReader.getRoom(t);
|
|
5645
5611
|
if (c) {
|
|
5646
|
-
let s =
|
|
5612
|
+
let s = Hr[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5647
5613
|
a.push({
|
|
5648
5614
|
id: t,
|
|
5649
5615
|
weight: l
|
|
@@ -5674,7 +5640,7 @@ var Nr = {
|
|
|
5674
5640
|
};
|
|
5675
5641
|
//#endregion
|
|
5676
5642
|
//#region src/PathFinder.ts
|
|
5677
|
-
function
|
|
5643
|
+
function Wr(e, t) {
|
|
5678
5644
|
e.push(t);
|
|
5679
5645
|
let n = e.length - 1;
|
|
5680
5646
|
for (; n > 0;) {
|
|
@@ -5683,7 +5649,7 @@ function Ur(e, t) {
|
|
|
5683
5649
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5684
5650
|
}
|
|
5685
5651
|
}
|
|
5686
|
-
function
|
|
5652
|
+
function Gr(e) {
|
|
5687
5653
|
if (e.length === 0) return;
|
|
5688
5654
|
let t = e[0], n = e.pop();
|
|
5689
5655
|
if (e.length > 0) {
|
|
@@ -5697,16 +5663,16 @@ function Wr(e) {
|
|
|
5697
5663
|
}
|
|
5698
5664
|
return t;
|
|
5699
5665
|
}
|
|
5700
|
-
function
|
|
5666
|
+
function Kr(e, t, n) {
|
|
5701
5667
|
let r = [n], i = n;
|
|
5702
5668
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5703
5669
|
return r.reverse(), r;
|
|
5704
5670
|
}
|
|
5705
|
-
function
|
|
5671
|
+
function qr(e, t, n) {
|
|
5706
5672
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5707
5673
|
return i ? i.map((e) => Number(e)) : null;
|
|
5708
5674
|
}
|
|
5709
|
-
function
|
|
5675
|
+
function Jr(e, t, n, r) {
|
|
5710
5676
|
let i = r.getRoom(n);
|
|
5711
5677
|
if (!i) return null;
|
|
5712
5678
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5715,16 +5681,16 @@ function qr(e, t, n, r) {
|
|
|
5715
5681
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5716
5682
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5717
5683
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5718
|
-
for (d.set(t, 0),
|
|
5684
|
+
for (d.set(t, 0), Wr(p, {
|
|
5719
5685
|
id: t,
|
|
5720
5686
|
priority: u(t)
|
|
5721
5687
|
}); p.length > 0;) {
|
|
5722
|
-
let { id: r } =
|
|
5723
|
-
if (r === n) return
|
|
5688
|
+
let { id: r } = Gr(p);
|
|
5689
|
+
if (r === n) return Kr(f, t, n);
|
|
5724
5690
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5725
5691
|
if (a) for (let e of a) {
|
|
5726
5692
|
let t = i + e.weight;
|
|
5727
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
5693
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), Wr(p, {
|
|
5728
5694
|
id: e.id,
|
|
5729
5695
|
priority: t + u(e.id)
|
|
5730
5696
|
}));
|
|
@@ -5732,9 +5698,9 @@ function qr(e, t, n, r) {
|
|
|
5732
5698
|
}
|
|
5733
5699
|
return null;
|
|
5734
5700
|
}
|
|
5735
|
-
var
|
|
5701
|
+
var Yr = class {
|
|
5736
5702
|
constructor(e, t = "dijkstra") {
|
|
5737
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
5703
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Ur(e), this.dijkstraGraph = new Br.default(this.mapGraph.getGraphDefinition());
|
|
5738
5704
|
}
|
|
5739
5705
|
get algorithm() {
|
|
5740
5706
|
return this._algorithm;
|
|
@@ -5753,23 +5719,23 @@ var Jr = class {
|
|
|
5753
5719
|
let r;
|
|
5754
5720
|
switch (this._algorithm) {
|
|
5755
5721
|
case "dijkstra":
|
|
5756
|
-
r =
|
|
5722
|
+
r = qr(this.dijkstraGraph, e, t);
|
|
5757
5723
|
break;
|
|
5758
5724
|
case "astar":
|
|
5759
|
-
r =
|
|
5725
|
+
r = Jr(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5760
5726
|
break;
|
|
5761
5727
|
}
|
|
5762
5728
|
return this.cache.set(n, r), r;
|
|
5763
5729
|
}
|
|
5764
|
-
},
|
|
5730
|
+
}, Xr = {
|
|
5765
5731
|
hidden: 2,
|
|
5766
5732
|
stub: 1,
|
|
5767
5733
|
full: 0
|
|
5768
5734
|
};
|
|
5769
|
-
function
|
|
5770
|
-
return n === "first" ? e : n === "least-restrictive" ?
|
|
5735
|
+
function Zr(e, t, n) {
|
|
5736
|
+
return n === "first" ? e : n === "least-restrictive" ? Xr[e] < Xr[t] ? e : t : Xr[e] > Xr[t] ? e : t;
|
|
5771
5737
|
}
|
|
5772
|
-
function
|
|
5738
|
+
function Qr(e, ...t) {
|
|
5773
5739
|
let n = {}, r;
|
|
5774
5740
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5775
5741
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -5785,7 +5751,7 @@ function Zr(e, ...t) {
|
|
|
5785
5751
|
for (let o of r) {
|
|
5786
5752
|
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5787
5753
|
if (a === void 0) a = r;
|
|
5788
|
-
else if (a =
|
|
5754
|
+
else if (a = Zr(a, r, i), i === "first") break;
|
|
5789
5755
|
}
|
|
5790
5756
|
return a ?? "full";
|
|
5791
5757
|
},
|
|
@@ -5798,7 +5764,7 @@ function Zr(e, ...t) {
|
|
|
5798
5764
|
}
|
|
5799
5765
|
//#endregion
|
|
5800
5766
|
//#region src/lens/ExplorationLens.ts
|
|
5801
|
-
var
|
|
5767
|
+
var $r = class {
|
|
5802
5768
|
constructor(e) {
|
|
5803
5769
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5804
5770
|
}
|
|
@@ -5833,7 +5799,7 @@ var Qr = class {
|
|
|
5833
5799
|
clear() {
|
|
5834
5800
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5835
5801
|
}
|
|
5836
|
-
},
|
|
5802
|
+
}, ei = {
|
|
5837
5803
|
1: "north",
|
|
5838
5804
|
2: "northeast",
|
|
5839
5805
|
3: "northwest",
|
|
@@ -5847,7 +5813,7 @@ var Qr = class {
|
|
|
5847
5813
|
11: "in",
|
|
5848
5814
|
12: "out"
|
|
5849
5815
|
};
|
|
5850
|
-
function
|
|
5816
|
+
function ti() {
|
|
5851
5817
|
return {
|
|
5852
5818
|
areaWidth: 150,
|
|
5853
5819
|
areaHeight: 80,
|
|
@@ -5861,9 +5827,9 @@ function ei() {
|
|
|
5861
5827
|
highlightColor: "#ff9900"
|
|
5862
5828
|
};
|
|
5863
5829
|
}
|
|
5864
|
-
var
|
|
5830
|
+
var ni = class {
|
|
5865
5831
|
constructor(e, t, n) {
|
|
5866
|
-
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ??
|
|
5832
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? ti(), this.stage = new r.Stage({
|
|
5867
5833
|
container: e,
|
|
5868
5834
|
width: e.clientWidth,
|
|
5869
5835
|
height: e.clientHeight,
|
|
@@ -6046,14 +6012,14 @@ var ti = class {
|
|
|
6046
6012
|
toAreaId: e.fromAreaId,
|
|
6047
6013
|
fromRoomId: e.toRoomId,
|
|
6048
6014
|
toRoomId: e.fromRoomId,
|
|
6049
|
-
direction: e.direction ?
|
|
6015
|
+
direction: e.direction ? P[e.direction] : null,
|
|
6050
6016
|
fromRoomPosition: e.toRoomPosition,
|
|
6051
6017
|
toRoomPosition: e.fromRoomPosition
|
|
6052
6018
|
});
|
|
6053
6019
|
}
|
|
6054
6020
|
}
|
|
6055
6021
|
getLockedDirections(e) {
|
|
6056
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6022
|
+
return new Set((e.exitLocks ?? []).map((e) => ei[e]).filter((e) => !!e));
|
|
6057
6023
|
}
|
|
6058
6024
|
createConnection(e, t, n) {
|
|
6059
6025
|
let r = this.toPlanarDirection(n);
|
|
@@ -6122,7 +6088,7 @@ var ti = class {
|
|
|
6122
6088
|
}[e.toLowerCase().trim()] ?? null;
|
|
6123
6089
|
}
|
|
6124
6090
|
toPlanarDirection(e) {
|
|
6125
|
-
return e &&
|
|
6091
|
+
return e && N.includes(e) ? e : null;
|
|
6126
6092
|
}
|
|
6127
6093
|
layoutAreas() {
|
|
6128
6094
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6665,6 +6631,6 @@ var ti = class {
|
|
|
6665
6631
|
}
|
|
6666
6632
|
};
|
|
6667
6633
|
//#endregion
|
|
6668
|
-
export { C as ALL_VISIBLE,
|
|
6634
|
+
export { C as ALL_VISIBLE, Fr as AmbientLightOverlay, e as Area, ni as AreaMapRenderer, Zn as Blueprint, D as Camera, Dr as CanvasExporter, tr as Construction, ee as CullingManager, We as DrawCommandLayerNode, $r as ExplorationLens, ht as HitTester, O as IDENTITY_TRANSFORM, er as Isometric, Ur as MapGraph, n as MapReader, rr as MapRenderer, T as MapState, Ge as MaterializingLayerNode, Qn as Neon, Xn as Parchment, Yr as PathFinder, t as Plane, Tr as PngBlobExporter, Or as PngBytesExporter, wr as PngExporter, Ue as RecordingGroupNode, V as RecordingLayerNode, nr as SciFi, $n as Sketchy, Cr as SvgExporter, G as applyStyleToShapes, ar as buildDrawCommands, Er as canvasToBytes, _ as colorLightness, Tt as compose, Qr as composeLenses, at as computePathData, ti as createAreaMapSettings, g as createSettings, v as darkenColor, w as defaultExitTreatment, x as hexToRgba, W as identityStyle, hr as renderToCanvas, Ke as shapeToRecording, dr as svgFromBatches };
|
|
6669
6635
|
|
|
6670
6636
|
//# sourceMappingURL=index.mjs.map
|