mudlet-map-renderer 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +470 -507
- 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;
|
|
@@ -3731,8 +3698,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3731
3698
|
}
|
|
3732
3699
|
applyPositionMarker(e) {
|
|
3733
3700
|
this.positionMarker && this.positionMarker.destroy();
|
|
3734
|
-
let t =
|
|
3735
|
-
this.positionMarker = this.addStyledShape(
|
|
3701
|
+
let t = st(e, this.state.settings);
|
|
3702
|
+
this.positionMarker = this.addStyledShape(ut(t), this.positionLayerNode);
|
|
3736
3703
|
}
|
|
3737
3704
|
clearCurrentRoomOverlay() {
|
|
3738
3705
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3754,8 +3721,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3754
3721
|
let t = i.renderDataWithColor(e, K, this.state.currentZIndex);
|
|
3755
3722
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3756
3723
|
});
|
|
3757
|
-
for (let n of
|
|
3758
|
-
for (let n of
|
|
3724
|
+
for (let n of le(e, t, K)) r.push(De(n, e.id));
|
|
3725
|
+
for (let n of se(e, t, K)) r.push(Oe(n));
|
|
3759
3726
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3760
3727
|
let t = this.state.mapReader.getRoom(e);
|
|
3761
3728
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -3763,17 +3730,13 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3763
3730
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3764
3731
|
t && this.currentRoomOverlay.push(t);
|
|
3765
3732
|
}), n.forEach((n, r) => {
|
|
3766
|
-
let i = r === e.id, a =
|
|
3733
|
+
let i = r === e.id, a = _e(n, this.state.mapReader, t, {
|
|
3767
3734
|
strokeOverride: i ? K : t.lineColor,
|
|
3768
3735
|
flatPipeline: !0
|
|
3769
|
-
})
|
|
3736
|
+
});
|
|
3737
|
+
a.children.push(...we(n, this.state.mapReader, t));
|
|
3738
|
+
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
3770
3739
|
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
3740
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
3778
3741
|
}
|
|
3779
3742
|
syncHighlight(e, t) {
|
|
@@ -3781,7 +3744,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3781
3744
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3782
3745
|
let n = this.state.mapReader.getRoom(e);
|
|
3783
3746
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3784
|
-
let r =
|
|
3747
|
+
let r = ot(n, t, this.state.settings), i = this.addStyledShape(lt(r), this.overlayLayerNode);
|
|
3785
3748
|
i && this.highlightShapes.set(e, i);
|
|
3786
3749
|
}
|
|
3787
3750
|
}
|
|
@@ -3794,7 +3757,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3794
3757
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3795
3758
|
let n = this.state.mapReader.getRoom(e);
|
|
3796
3759
|
if (!n) continue;
|
|
3797
|
-
let r =
|
|
3760
|
+
let r = ot(n, t.color, this.state.settings), i = this.addStyledShape(lt(r), this.overlayLayerNode);
|
|
3798
3761
|
i && this.highlightShapes.set(e, i);
|
|
3799
3762
|
}
|
|
3800
3763
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3804,8 +3767,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3804
3767
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3805
3768
|
if (!(e === void 0 || t === void 0)) {
|
|
3806
3769
|
for (let n of this.state.paths) {
|
|
3807
|
-
let r =
|
|
3808
|
-
for (let e of
|
|
3770
|
+
let r = ct(this.state.mapReader, this.state.settings, n.locations, n.color, e, t);
|
|
3771
|
+
for (let e of dt(r)) {
|
|
3809
3772
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3810
3773
|
t && this.pathShapes.push(t);
|
|
3811
3774
|
}
|
|
@@ -3841,97 +3804,97 @@ function q(e) {
|
|
|
3841
3804
|
function J(e, t, n, r = 1) {
|
|
3842
3805
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3843
3806
|
}
|
|
3844
|
-
function
|
|
3807
|
+
function Ot(e) {
|
|
3845
3808
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3846
3809
|
}
|
|
3847
3810
|
//#endregion
|
|
3848
3811
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3849
|
-
var
|
|
3850
|
-
function
|
|
3812
|
+
var kt = "#4a3728", At = "#3b2a1a", jt = 139, Mt = 115, Nt = 85, Pt = 244, Ft = 228, It = 193;
|
|
3813
|
+
function Lt(e) {
|
|
3851
3814
|
let t = q(e);
|
|
3852
|
-
if (!t) return J(
|
|
3853
|
-
let n =
|
|
3854
|
-
return J(Math.round(
|
|
3815
|
+
if (!t) return J(Pt, Ft, It);
|
|
3816
|
+
let n = Ot(t);
|
|
3817
|
+
return J(Math.round(jt + (Pt - jt) * n), Math.round(Mt + (Ft - Mt) * n), Math.round(Nt + (It - Nt) * n), t.a);
|
|
3855
3818
|
}
|
|
3856
|
-
function
|
|
3819
|
+
function Rt(e) {
|
|
3857
3820
|
let t = q(e);
|
|
3858
|
-
if (!t || t.a >= 1) return
|
|
3859
|
-
let n = q(
|
|
3821
|
+
if (!t || t.a >= 1) return kt;
|
|
3822
|
+
let n = q(kt);
|
|
3860
3823
|
return J(n.r, n.g, n.b, t.a);
|
|
3861
3824
|
}
|
|
3862
|
-
function
|
|
3825
|
+
function zt(e) {
|
|
3863
3826
|
return {
|
|
3864
3827
|
...e,
|
|
3865
|
-
fill: e.fill ?
|
|
3866
|
-
stroke: e.stroke ?
|
|
3828
|
+
fill: e.fill ? Lt(e.fill) : e.fill,
|
|
3829
|
+
stroke: e.stroke ? Rt(e.stroke) : e.stroke
|
|
3867
3830
|
};
|
|
3868
3831
|
}
|
|
3869
|
-
var
|
|
3832
|
+
var Bt = { transform(e) {
|
|
3870
3833
|
switch (e.type) {
|
|
3871
3834
|
case "rect":
|
|
3872
3835
|
case "circle":
|
|
3873
3836
|
case "polygon": return {
|
|
3874
3837
|
...e,
|
|
3875
|
-
paint:
|
|
3838
|
+
paint: zt(e.paint)
|
|
3876
3839
|
};
|
|
3877
3840
|
case "line": return {
|
|
3878
3841
|
...e,
|
|
3879
3842
|
paint: e.paint.stroke ? {
|
|
3880
3843
|
...e.paint,
|
|
3881
|
-
stroke:
|
|
3844
|
+
stroke: Rt(e.paint.stroke)
|
|
3882
3845
|
} : e.paint
|
|
3883
3846
|
};
|
|
3884
3847
|
case "text": return {
|
|
3885
3848
|
...e,
|
|
3886
|
-
fill:
|
|
3849
|
+
fill: At
|
|
3887
3850
|
};
|
|
3888
3851
|
case "image":
|
|
3889
3852
|
case "group": return e;
|
|
3890
3853
|
}
|
|
3891
|
-
} },
|
|
3892
|
-
function
|
|
3854
|
+
} }, Vt = "#c0deff", Ht = "#e0f0ff", Ut = 20, Wt = 40, Gt = 80, Kt = 60, qt = 100, Jt = 160;
|
|
3855
|
+
function Yt(e) {
|
|
3893
3856
|
let t = q(e);
|
|
3894
|
-
if (!t) return J(
|
|
3895
|
-
let n =
|
|
3896
|
-
return J(Math.round(
|
|
3857
|
+
if (!t) return J(Kt, qt, Jt);
|
|
3858
|
+
let n = Ot(t);
|
|
3859
|
+
return J(Math.round(Ut + (Kt - Ut) * n), Math.round(Wt + (qt - Wt) * n), Math.round(Gt + (Jt - Gt) * n), t.a);
|
|
3897
3860
|
}
|
|
3898
|
-
function
|
|
3861
|
+
function Xt(e) {
|
|
3899
3862
|
let t = q(e);
|
|
3900
|
-
if (!t || t.a >= 1) return
|
|
3901
|
-
let n = q(
|
|
3863
|
+
if (!t || t.a >= 1) return Vt;
|
|
3864
|
+
let n = q(Vt);
|
|
3902
3865
|
return J(n.r, n.g, n.b, t.a);
|
|
3903
3866
|
}
|
|
3904
|
-
function
|
|
3867
|
+
function Zt(e) {
|
|
3905
3868
|
return {
|
|
3906
3869
|
...e,
|
|
3907
|
-
fill: e.fill ?
|
|
3908
|
-
stroke: e.stroke ?
|
|
3870
|
+
fill: e.fill ? Yt(e.fill) : e.fill,
|
|
3871
|
+
stroke: e.stroke ? Xt(e.stroke) : e.stroke
|
|
3909
3872
|
};
|
|
3910
3873
|
}
|
|
3911
|
-
var
|
|
3874
|
+
var Qt = { transform(e) {
|
|
3912
3875
|
switch (e.type) {
|
|
3913
3876
|
case "rect":
|
|
3914
3877
|
case "circle":
|
|
3915
3878
|
case "polygon": return {
|
|
3916
3879
|
...e,
|
|
3917
|
-
paint:
|
|
3880
|
+
paint: Zt(e.paint)
|
|
3918
3881
|
};
|
|
3919
3882
|
case "line": return {
|
|
3920
3883
|
...e,
|
|
3921
3884
|
paint: e.paint.stroke ? {
|
|
3922
3885
|
...e.paint,
|
|
3923
|
-
stroke:
|
|
3886
|
+
stroke: Xt(e.paint.stroke)
|
|
3924
3887
|
} : e.paint
|
|
3925
3888
|
};
|
|
3926
3889
|
case "text": return {
|
|
3927
3890
|
...e,
|
|
3928
|
-
fill:
|
|
3891
|
+
fill: Ht
|
|
3929
3892
|
};
|
|
3930
3893
|
case "image":
|
|
3931
3894
|
case "group": return e;
|
|
3932
3895
|
}
|
|
3933
|
-
} },
|
|
3934
|
-
function
|
|
3896
|
+
} }, $t = "#00ffd0", en = .3, tn = 3;
|
|
3897
|
+
function nn(e, t, n) {
|
|
3935
3898
|
e /= 255, t /= 255, n /= 255;
|
|
3936
3899
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3937
3900
|
if (r === i) return [
|
|
@@ -3946,68 +3909,68 @@ function tn(e, t, n) {
|
|
|
3946
3909
|
a
|
|
3947
3910
|
];
|
|
3948
3911
|
}
|
|
3949
|
-
function
|
|
3912
|
+
function rn(e, t, n, r = 1) {
|
|
3950
3913
|
e = (e % 360 + 360) % 360;
|
|
3951
3914
|
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
3915
|
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
3916
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3954
3917
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3955
3918
|
}
|
|
3956
|
-
function
|
|
3919
|
+
function an(e) {
|
|
3957
3920
|
let t = q(e);
|
|
3958
3921
|
if (!t) return {
|
|
3959
3922
|
h: 150,
|
|
3960
3923
|
a: 1
|
|
3961
3924
|
};
|
|
3962
|
-
let [n] =
|
|
3925
|
+
let [n] = nn(t.r, t.g, t.b);
|
|
3963
3926
|
return {
|
|
3964
3927
|
h: n,
|
|
3965
3928
|
a: t.a
|
|
3966
3929
|
};
|
|
3967
3930
|
}
|
|
3968
|
-
function an(e) {
|
|
3969
|
-
let { h: t, a: n } = rn(e);
|
|
3970
|
-
return nn(t, .95, .65, n);
|
|
3971
|
-
}
|
|
3972
3931
|
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);
|
|
3932
|
+
let { h: t, a: n } = an(e);
|
|
3933
|
+
return rn(t, .95, .65, n);
|
|
3977
3934
|
}
|
|
3978
3935
|
function sn(e) {
|
|
3979
|
-
let
|
|
3980
|
-
|
|
3936
|
+
let t = q(e);
|
|
3937
|
+
if (!t) return "rgb(8, 12, 10)";
|
|
3938
|
+
let [n] = nn(t.r, t.g, t.b);
|
|
3939
|
+
return rn(n, .4, .1, t.a);
|
|
3981
3940
|
}
|
|
3982
3941
|
function cn(e) {
|
|
3942
|
+
let { h: t, a: n } = an(e);
|
|
3943
|
+
return rn(t, .95, .65, Math.min(n, en));
|
|
3944
|
+
}
|
|
3945
|
+
function ln(e) {
|
|
3983
3946
|
return {
|
|
3984
3947
|
...e,
|
|
3985
|
-
fill: e.fill ?
|
|
3986
|
-
stroke: e.stroke ?
|
|
3948
|
+
fill: e.fill ? sn(e.fill) : e.fill,
|
|
3949
|
+
stroke: e.stroke ? on(e.stroke) : e.stroke
|
|
3987
3950
|
};
|
|
3988
3951
|
}
|
|
3989
|
-
function
|
|
3952
|
+
function un(e, t = !1) {
|
|
3990
3953
|
if (!e.stroke) return e;
|
|
3991
|
-
let n = (e.strokeWidth ?? 1) *
|
|
3954
|
+
let n = (e.strokeWidth ?? 1) * tn;
|
|
3992
3955
|
return {
|
|
3993
|
-
stroke:
|
|
3956
|
+
stroke: cn(e.stroke),
|
|
3994
3957
|
strokeWidth: n,
|
|
3995
3958
|
dash: e.dash,
|
|
3996
3959
|
dashEnabled: e.dashEnabled,
|
|
3997
|
-
alpha: t ?
|
|
3960
|
+
alpha: t ? en : e.alpha
|
|
3998
3961
|
};
|
|
3999
3962
|
}
|
|
4000
|
-
var
|
|
3963
|
+
var dn = { transform(e) {
|
|
4001
3964
|
switch (e.type) {
|
|
4002
3965
|
case "rect": {
|
|
4003
3966
|
let t = {
|
|
4004
3967
|
...e,
|
|
4005
|
-
paint:
|
|
3968
|
+
paint: ln(e.paint)
|
|
4006
3969
|
};
|
|
4007
3970
|
return e.paint.stroke ? [{
|
|
4008
3971
|
...e,
|
|
4009
3972
|
paint: {
|
|
4010
|
-
...
|
|
3973
|
+
...un(e.paint),
|
|
4011
3974
|
fill: void 0
|
|
4012
3975
|
}
|
|
4013
3976
|
}, t] : t;
|
|
@@ -4015,12 +3978,12 @@ var un = { transform(e) {
|
|
|
4015
3978
|
case "circle": {
|
|
4016
3979
|
let t = {
|
|
4017
3980
|
...e,
|
|
4018
|
-
paint:
|
|
3981
|
+
paint: ln(e.paint)
|
|
4019
3982
|
};
|
|
4020
3983
|
return e.paint.stroke ? [{
|
|
4021
3984
|
...e,
|
|
4022
3985
|
paint: {
|
|
4023
|
-
...
|
|
3986
|
+
...un(e.paint),
|
|
4024
3987
|
fill: void 0
|
|
4025
3988
|
}
|
|
4026
3989
|
}, t] : t;
|
|
@@ -4030,21 +3993,21 @@ var un = { transform(e) {
|
|
|
4030
3993
|
...e,
|
|
4031
3994
|
paint: e.paint.stroke ? {
|
|
4032
3995
|
...e.paint,
|
|
4033
|
-
stroke:
|
|
3996
|
+
stroke: on(e.paint.stroke)
|
|
4034
3997
|
} : e.paint
|
|
4035
3998
|
};
|
|
4036
3999
|
return e.paint.stroke ? [{
|
|
4037
4000
|
...e,
|
|
4038
|
-
paint:
|
|
4001
|
+
paint: un(e.paint, !0)
|
|
4039
4002
|
}, t] : t;
|
|
4040
4003
|
}
|
|
4041
4004
|
case "polygon": return {
|
|
4042
4005
|
...e,
|
|
4043
|
-
paint:
|
|
4006
|
+
paint: ln(e.paint)
|
|
4044
4007
|
};
|
|
4045
4008
|
case "text": return {
|
|
4046
4009
|
...e,
|
|
4047
|
-
fill:
|
|
4010
|
+
fill: $t
|
|
4048
4011
|
};
|
|
4049
4012
|
case "image":
|
|
4050
4013
|
case "group": return e;
|
|
@@ -4061,7 +4024,7 @@ function X(...e) {
|
|
|
4061
4024
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4062
4025
|
return t;
|
|
4063
4026
|
}
|
|
4064
|
-
function
|
|
4027
|
+
function fn(e, t, n, r, i, a) {
|
|
4065
4028
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4066
4029
|
if (c < .001) return [
|
|
4067
4030
|
e,
|
|
@@ -4076,17 +4039,17 @@ function dn(e, t, n, r, i, a) {
|
|
|
4076
4039
|
}
|
|
4077
4040
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4078
4041
|
}
|
|
4079
|
-
function
|
|
4042
|
+
function pn(e, t, n) {
|
|
4080
4043
|
if (e.length < 4) return e;
|
|
4081
4044
|
let r = [];
|
|
4082
4045
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4083
|
-
let a =
|
|
4046
|
+
let a = fn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4084
4047
|
if (i === 0) r.push(...a);
|
|
4085
4048
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4086
4049
|
}
|
|
4087
4050
|
return r;
|
|
4088
4051
|
}
|
|
4089
|
-
function
|
|
4052
|
+
function mn(e, t, n, r, i, a) {
|
|
4090
4053
|
let o = [
|
|
4091
4054
|
e,
|
|
4092
4055
|
t,
|
|
@@ -4098,12 +4061,12 @@ function pn(e, t, n, r, i, a) {
|
|
|
4098
4061
|
t + r
|
|
4099
4062
|
], s = [];
|
|
4100
4063
|
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 =
|
|
4064
|
+
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
4065
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4103
4066
|
}
|
|
4104
4067
|
return s;
|
|
4105
4068
|
}
|
|
4106
|
-
function
|
|
4069
|
+
function hn(e, t, n, r, i) {
|
|
4107
4070
|
let a = [];
|
|
4108
4071
|
for (let o = 0; o < 24; o++) {
|
|
4109
4072
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4111,26 +4074,26 @@ function mn(e, t, n, r, i) {
|
|
|
4111
4074
|
}
|
|
4112
4075
|
return a;
|
|
4113
4076
|
}
|
|
4114
|
-
function
|
|
4077
|
+
function gn(e, t, n) {
|
|
4115
4078
|
let r = e.length / 2;
|
|
4116
4079
|
if (r < 2) return e;
|
|
4117
4080
|
let i = [];
|
|
4118
4081
|
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 =
|
|
4082
|
+
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
4083
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4121
4084
|
}
|
|
4122
4085
|
return i;
|
|
4123
4086
|
}
|
|
4124
4087
|
//#endregion
|
|
4125
4088
|
//#region src/style/shape/SketchyStyle.ts
|
|
4126
|
-
function
|
|
4089
|
+
function _n(e, t) {
|
|
4127
4090
|
if (!t) return e;
|
|
4128
4091
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4129
4092
|
if (!n) return e;
|
|
4130
4093
|
let r = parseFloat(n[1]);
|
|
4131
4094
|
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
4095
|
}
|
|
4133
|
-
function
|
|
4096
|
+
function vn(e) {
|
|
4134
4097
|
let { jitter: t, color: n } = e;
|
|
4135
4098
|
return { transform(e) {
|
|
4136
4099
|
switch (e.type) {
|
|
@@ -4148,7 +4111,7 @@ function _n(e) {
|
|
|
4148
4111
|
}), a && e.paint.strokeWidth) {
|
|
4149
4112
|
let i = {
|
|
4150
4113
|
type: "polygon",
|
|
4151
|
-
vertices:
|
|
4114
|
+
vertices: mn(e.x, e.y, e.width, e.height, t, r),
|
|
4152
4115
|
paint: {
|
|
4153
4116
|
stroke: a,
|
|
4154
4117
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4163,7 +4126,7 @@ function _n(e) {
|
|
|
4163
4126
|
}
|
|
4164
4127
|
return {
|
|
4165
4128
|
type: "polygon",
|
|
4166
|
-
vertices:
|
|
4129
|
+
vertices: mn(e.x, e.y, e.width, e.height, t, r),
|
|
4167
4130
|
paint: {
|
|
4168
4131
|
fill: i,
|
|
4169
4132
|
stroke: a,
|
|
@@ -4178,7 +4141,7 @@ function _n(e) {
|
|
|
4178
4141
|
let r = Y(X(e.cx, e.cy, e.radius));
|
|
4179
4142
|
return {
|
|
4180
4143
|
type: "polygon",
|
|
4181
|
-
vertices:
|
|
4144
|
+
vertices: hn(e.cx, e.cy, e.radius, t, r),
|
|
4182
4145
|
paint: {
|
|
4183
4146
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4184
4147
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4190,7 +4153,7 @@ function _n(e) {
|
|
|
4190
4153
|
};
|
|
4191
4154
|
}
|
|
4192
4155
|
case "line": {
|
|
4193
|
-
let r = Y(X(...e.points.slice(0, 4))), i =
|
|
4156
|
+
let r = Y(X(...e.points.slice(0, 4))), i = pn(e.points, t, r), a = _n(n, e.paint.stroke), o = {
|
|
4194
4157
|
...e.paint,
|
|
4195
4158
|
stroke: a
|
|
4196
4159
|
};
|
|
@@ -4201,7 +4164,7 @@ function _n(e) {
|
|
|
4201
4164
|
};
|
|
4202
4165
|
}
|
|
4203
4166
|
case "polygon": {
|
|
4204
|
-
let r = Y(X(...e.vertices.slice(0, 4))), i =
|
|
4167
|
+
let r = Y(X(...e.vertices.slice(0, 4))), i = gn(e.vertices, t, r);
|
|
4205
4168
|
return {
|
|
4206
4169
|
...e,
|
|
4207
4170
|
vertices: i,
|
|
@@ -4223,16 +4186,16 @@ function _n(e) {
|
|
|
4223
4186
|
}
|
|
4224
4187
|
//#endregion
|
|
4225
4188
|
//#region src/style/shape/IsometricStyle.ts
|
|
4226
|
-
function
|
|
4189
|
+
function yn(e) {
|
|
4227
4190
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4228
4191
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4229
4192
|
}
|
|
4230
|
-
function
|
|
4193
|
+
function bn(e) {
|
|
4231
4194
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4232
4195
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4233
4196
|
}
|
|
4234
4197
|
var Z = 32;
|
|
4235
|
-
function
|
|
4198
|
+
function xn(e, t) {
|
|
4236
4199
|
let n = Array(t.length);
|
|
4237
4200
|
for (let r = 0; r < t.length; r += 2) {
|
|
4238
4201
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4240,7 +4203,7 @@ function bn(e, t) {
|
|
|
4240
4203
|
}
|
|
4241
4204
|
return n;
|
|
4242
4205
|
}
|
|
4243
|
-
function
|
|
4206
|
+
function Sn(e, t, n, r, i) {
|
|
4244
4207
|
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
4208
|
return [
|
|
4246
4209
|
a,
|
|
@@ -4253,8 +4216,8 @@ function xn(e, t, n, r, i) {
|
|
|
4253
4216
|
f
|
|
4254
4217
|
];
|
|
4255
4218
|
}
|
|
4256
|
-
function
|
|
4257
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
4219
|
+
function Cn(e = {}) {
|
|
4220
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = yn(t), i = bn(t);
|
|
4258
4221
|
function a(e, t, n, i) {
|
|
4259
4222
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4260
4223
|
return [
|
|
@@ -4267,7 +4230,7 @@ function Sn(e = {}) {
|
|
|
4267
4230
|
];
|
|
4268
4231
|
}
|
|
4269
4232
|
function o(e) {
|
|
4270
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
4233
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = Sn(r, t, i, a, o);
|
|
4271
4234
|
if (s.dash || s.dashEnabled) {
|
|
4272
4235
|
let t = [];
|
|
4273
4236
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4466,11 +4429,11 @@ function Sn(e = {}) {
|
|
|
4466
4429
|
case "circle": return s(e);
|
|
4467
4430
|
case "line": return {
|
|
4468
4431
|
...e,
|
|
4469
|
-
points:
|
|
4432
|
+
points: xn(r, e.points)
|
|
4470
4433
|
};
|
|
4471
4434
|
case "polygon": return {
|
|
4472
4435
|
...e,
|
|
4473
|
-
vertices:
|
|
4436
|
+
vertices: xn(r, e.vertices)
|
|
4474
4437
|
};
|
|
4475
4438
|
case "text": {
|
|
4476
4439
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
@@ -4525,21 +4488,21 @@ function Sn(e = {}) {
|
|
|
4525
4488
|
}
|
|
4526
4489
|
//#endregion
|
|
4527
4490
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4528
|
-
var Q = "#1a1a1a",
|
|
4529
|
-
function
|
|
4491
|
+
var Q = "#1a1a1a", wn = "#ffc200", Tn = "#ff6600", En = 26, Dn = 26, On = 26, kn = 255, An = 194, jn = 0;
|
|
4492
|
+
function Mn(e) {
|
|
4530
4493
|
let t = q(e);
|
|
4531
|
-
if (!t) return J(
|
|
4532
|
-
let n =
|
|
4533
|
-
return J(Math.round(
|
|
4494
|
+
if (!t) return J(kn, An, jn);
|
|
4495
|
+
let n = Ot(t);
|
|
4496
|
+
return J(Math.round(En + (kn - En) * n), Math.round(Dn + (An - Dn) * n), Math.round(On + (jn - On) * n), t.a);
|
|
4534
4497
|
}
|
|
4535
|
-
function
|
|
4498
|
+
function Nn(e) {
|
|
4536
4499
|
return {
|
|
4537
4500
|
...e,
|
|
4538
|
-
fill: e.fill ?
|
|
4501
|
+
fill: e.fill ? Mn(e.fill) : e.fill,
|
|
4539
4502
|
stroke: e.stroke ? Q : e.stroke
|
|
4540
4503
|
};
|
|
4541
4504
|
}
|
|
4542
|
-
function
|
|
4505
|
+
function Pn(e, t, n, r) {
|
|
4543
4506
|
let i = [], a = e.length;
|
|
4544
4507
|
for (let o = 0; o < a; o++) {
|
|
4545
4508
|
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 +4513,7 @@ function Nn(e, t, n, r) {
|
|
|
4550
4513
|
}
|
|
4551
4514
|
return i;
|
|
4552
4515
|
}
|
|
4553
|
-
function
|
|
4516
|
+
function Fn(e, t, n, r, i) {
|
|
4554
4517
|
let a = [
|
|
4555
4518
|
[e, t],
|
|
4556
4519
|
[e + n, t],
|
|
@@ -4558,17 +4521,17 @@ function Pn(e, t, n, r, i) {
|
|
|
4558
4521
|
[e, t + r]
|
|
4559
4522
|
], 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
4523
|
for (let e = u; e <= d; e++) {
|
|
4561
|
-
let t = e * o, n = t + s, r =
|
|
4562
|
-
r =
|
|
4524
|
+
let t = e * o, n = t + s, r = Pn(a, 1, 1, t);
|
|
4525
|
+
r = Pn(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
4563
4526
|
}
|
|
4564
4527
|
return f;
|
|
4565
4528
|
}
|
|
4566
|
-
var
|
|
4529
|
+
var In = { transform(e, t) {
|
|
4567
4530
|
switch (e.type) {
|
|
4568
4531
|
case "rect": {
|
|
4569
4532
|
if (!e.paint.fill) return {
|
|
4570
4533
|
...e,
|
|
4571
|
-
paint:
|
|
4534
|
+
paint: Nn(e.paint)
|
|
4572
4535
|
};
|
|
4573
4536
|
let n = {
|
|
4574
4537
|
...e,
|
|
@@ -4576,12 +4539,12 @@ var Fn = { transform(e, t) {
|
|
|
4576
4539
|
fill: Q,
|
|
4577
4540
|
strokeWidth: e.paint.strokeWidth
|
|
4578
4541
|
}
|
|
4579
|
-
}, r =
|
|
4542
|
+
}, r = Fn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4580
4543
|
type: "polygon",
|
|
4581
4544
|
vertices: t,
|
|
4582
4545
|
layer: e.layer,
|
|
4583
4546
|
paint: {
|
|
4584
|
-
fill:
|
|
4547
|
+
fill: wn,
|
|
4585
4548
|
alpha: .65
|
|
4586
4549
|
}
|
|
4587
4550
|
})), i = {
|
|
@@ -4600,13 +4563,13 @@ var Fn = { transform(e, t) {
|
|
|
4600
4563
|
}
|
|
4601
4564
|
case "circle": return {
|
|
4602
4565
|
...e,
|
|
4603
|
-
paint:
|
|
4566
|
+
paint: Nn(e.paint)
|
|
4604
4567
|
};
|
|
4605
4568
|
case "polygon": return {
|
|
4606
4569
|
...e,
|
|
4607
4570
|
paint: {
|
|
4608
4571
|
...e.paint,
|
|
4609
|
-
fill: e.paint.fill ?
|
|
4572
|
+
fill: e.paint.fill ? Tn : e.paint.fill,
|
|
4610
4573
|
stroke: e.paint.stroke ? Q : e.paint.stroke
|
|
4611
4574
|
}
|
|
4612
4575
|
};
|
|
@@ -4614,24 +4577,24 @@ var Fn = { transform(e, t) {
|
|
|
4614
4577
|
...e,
|
|
4615
4578
|
paint: e.paint.stroke ? {
|
|
4616
4579
|
...e.paint,
|
|
4617
|
-
stroke:
|
|
4580
|
+
stroke: Tn
|
|
4618
4581
|
} : e.paint
|
|
4619
4582
|
};
|
|
4620
4583
|
case "text": return {
|
|
4621
4584
|
...e,
|
|
4622
|
-
fill:
|
|
4585
|
+
fill: Tn,
|
|
4623
4586
|
stroke: Q,
|
|
4624
4587
|
strokeWidth: t.roomSize * .25
|
|
4625
4588
|
};
|
|
4626
4589
|
case "image":
|
|
4627
4590
|
case "group": return e;
|
|
4628
4591
|
}
|
|
4629
|
-
} },
|
|
4630
|
-
function
|
|
4592
|
+
} }, Ln = "#c8eeff", Rn = "#00c8ff", zn = "#00ffaa", Bn = .2, Vn = 5, Hn = 190;
|
|
4593
|
+
function Un(e, t, n) {
|
|
4631
4594
|
e /= 255, t /= 255, n /= 255;
|
|
4632
4595
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4633
4596
|
if (r === i) return [
|
|
4634
|
-
|
|
4597
|
+
Hn,
|
|
4635
4598
|
0,
|
|
4636
4599
|
a
|
|
4637
4600
|
];
|
|
@@ -4642,54 +4605,54 @@ function Hn(e, t, n) {
|
|
|
4642
4605
|
a
|
|
4643
4606
|
];
|
|
4644
4607
|
}
|
|
4645
|
-
function
|
|
4608
|
+
function Wn(e, t, n, r = 1) {
|
|
4646
4609
|
e = (e % 360 + 360) % 360;
|
|
4647
4610
|
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
4611
|
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
4612
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4650
4613
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4651
4614
|
}
|
|
4652
|
-
function
|
|
4615
|
+
function Gn(e) {
|
|
4653
4616
|
let t = q(e);
|
|
4654
|
-
if (!t) return
|
|
4655
|
-
let [n, r] =
|
|
4656
|
-
return
|
|
4617
|
+
if (!t) return Wn(Hn, .55, .18);
|
|
4618
|
+
let [n, r] = Un(t.r, t.g, t.b);
|
|
4619
|
+
return Wn(r < .08 ? Hn : n, .55, .18, t.a);
|
|
4657
4620
|
}
|
|
4658
|
-
function
|
|
4621
|
+
function Kn(e) {
|
|
4659
4622
|
return {
|
|
4660
4623
|
...e,
|
|
4661
|
-
fill: e.fill ?
|
|
4662
|
-
stroke: e.stroke ?
|
|
4624
|
+
fill: e.fill ? Gn(e.fill) : e.fill,
|
|
4625
|
+
stroke: e.stroke ? Rn : e.stroke
|
|
4663
4626
|
};
|
|
4664
4627
|
}
|
|
4665
|
-
function
|
|
4628
|
+
function qn(e) {
|
|
4666
4629
|
return {
|
|
4667
|
-
stroke:
|
|
4668
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4669
|
-
alpha:
|
|
4630
|
+
stroke: Rn,
|
|
4631
|
+
strokeWidth: (e.strokeWidth ?? 1) * Vn,
|
|
4632
|
+
alpha: Bn
|
|
4670
4633
|
};
|
|
4671
4634
|
}
|
|
4672
|
-
function
|
|
4635
|
+
function Jn(e) {
|
|
4673
4636
|
return {
|
|
4674
|
-
stroke:
|
|
4675
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4676
|
-
alpha:
|
|
4637
|
+
stroke: zn,
|
|
4638
|
+
strokeWidth: (e.strokeWidth ?? 1) * Vn,
|
|
4639
|
+
alpha: Bn,
|
|
4677
4640
|
dash: e.dash,
|
|
4678
4641
|
dashEnabled: e.dashEnabled
|
|
4679
4642
|
};
|
|
4680
4643
|
}
|
|
4681
|
-
var
|
|
4644
|
+
var Yn = { transform(e) {
|
|
4682
4645
|
switch (e.type) {
|
|
4683
4646
|
case "rect": {
|
|
4684
4647
|
let t = {
|
|
4685
4648
|
...e,
|
|
4686
|
-
paint:
|
|
4649
|
+
paint: Kn(e.paint)
|
|
4687
4650
|
};
|
|
4688
4651
|
return e.paint.stroke ? [{
|
|
4689
4652
|
...e,
|
|
4690
4653
|
hit: void 0,
|
|
4691
4654
|
paint: {
|
|
4692
|
-
...
|
|
4655
|
+
...qn(e.paint),
|
|
4693
4656
|
fill: void 0
|
|
4694
4657
|
}
|
|
4695
4658
|
}, t] : t;
|
|
@@ -4697,13 +4660,13 @@ var Jn = { transform(e) {
|
|
|
4697
4660
|
case "circle": {
|
|
4698
4661
|
let t = {
|
|
4699
4662
|
...e,
|
|
4700
|
-
paint:
|
|
4663
|
+
paint: Kn(e.paint)
|
|
4701
4664
|
};
|
|
4702
4665
|
return e.paint.stroke ? [{
|
|
4703
4666
|
...e,
|
|
4704
4667
|
hit: void 0,
|
|
4705
4668
|
paint: {
|
|
4706
|
-
...
|
|
4669
|
+
...qn(e.paint),
|
|
4707
4670
|
fill: void 0
|
|
4708
4671
|
}
|
|
4709
4672
|
}, t] : t;
|
|
@@ -4720,38 +4683,38 @@ var Jn = { transform(e) {
|
|
|
4720
4683
|
...e,
|
|
4721
4684
|
paint: e.paint.stroke ? {
|
|
4722
4685
|
...e.paint,
|
|
4723
|
-
stroke:
|
|
4686
|
+
stroke: zn
|
|
4724
4687
|
} : e.paint
|
|
4725
4688
|
};
|
|
4726
4689
|
return e.paint.stroke ? [{
|
|
4727
4690
|
...e,
|
|
4728
4691
|
hit: void 0,
|
|
4729
|
-
paint:
|
|
4692
|
+
paint: Jn(e.paint)
|
|
4730
4693
|
}, t] : t;
|
|
4731
4694
|
}
|
|
4732
4695
|
case "polygon": return {
|
|
4733
4696
|
...e,
|
|
4734
4697
|
paint: {
|
|
4735
4698
|
...e.paint,
|
|
4736
|
-
fill: e.paint.fill ?
|
|
4699
|
+
fill: e.paint.fill ? zn : e.paint.fill,
|
|
4737
4700
|
stroke: void 0
|
|
4738
4701
|
}
|
|
4739
4702
|
};
|
|
4740
4703
|
case "text": return {
|
|
4741
4704
|
...e,
|
|
4742
|
-
fill:
|
|
4705
|
+
fill: Ln
|
|
4743
4706
|
};
|
|
4744
4707
|
case "image":
|
|
4745
4708
|
case "group": return e;
|
|
4746
4709
|
}
|
|
4747
|
-
} },
|
|
4748
|
-
function
|
|
4749
|
-
return
|
|
4710
|
+
} }, Xn = Bt, Zn = Qt, Qn = dn;
|
|
4711
|
+
function $n(e) {
|
|
4712
|
+
return vn(e);
|
|
4750
4713
|
}
|
|
4751
|
-
function
|
|
4752
|
-
return
|
|
4714
|
+
function er(e = {}) {
|
|
4715
|
+
return Cn(e);
|
|
4753
4716
|
}
|
|
4754
|
-
var
|
|
4717
|
+
var tr = In, nr = Yn, rr = class {
|
|
4755
4718
|
get settings() {
|
|
4756
4719
|
return this.state.settings;
|
|
4757
4720
|
}
|
|
@@ -4768,7 +4731,7 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4768
4731
|
return this.backend.events;
|
|
4769
4732
|
}
|
|
4770
4733
|
constructor(e, t, n, r) {
|
|
4771
|
-
this.currentStyle = W, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new
|
|
4734
|
+
this.currentStyle = W, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new Dt(this.state, n);
|
|
4772
4735
|
}
|
|
4773
4736
|
destroy() {
|
|
4774
4737
|
this.backend.destroy();
|
|
@@ -4840,10 +4803,10 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4840
4803
|
this.backend.removeSceneOverlay(e);
|
|
4841
4804
|
}
|
|
4842
4805
|
addLiveEffect(e, t) {
|
|
4843
|
-
this.backend instanceof
|
|
4806
|
+
this.backend instanceof Dt && this.backend.addLiveEffect(e, t);
|
|
4844
4807
|
}
|
|
4845
4808
|
removeLiveEffect(e) {
|
|
4846
|
-
this.backend instanceof
|
|
4809
|
+
this.backend instanceof Dt && this.backend.removeLiveEffect(e);
|
|
4847
4810
|
}
|
|
4848
4811
|
hitTest(e, t) {
|
|
4849
4812
|
let n = this.backend.coordinateTransform(e, t);
|
|
@@ -4924,15 +4887,15 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4924
4887
|
getCullingMode() {
|
|
4925
4888
|
return this.state.settings.cullingMode;
|
|
4926
4889
|
}
|
|
4927
|
-
},
|
|
4928
|
-
function
|
|
4890
|
+
}, ir = "room";
|
|
4891
|
+
function ar(e, t) {
|
|
4929
4892
|
let n = /* @__PURE__ */ new Map();
|
|
4930
4893
|
function r(e) {
|
|
4931
4894
|
let t = n.get(e);
|
|
4932
4895
|
return t || (t = [], n.set(e, t)), t;
|
|
4933
4896
|
}
|
|
4934
4897
|
function i(e, t, n, i, o, s, c) {
|
|
4935
|
-
let l = e.layer ?? c ??
|
|
4898
|
+
let l = e.layer ?? c ?? ir;
|
|
4936
4899
|
switch (e.type) {
|
|
4937
4900
|
case "rect": {
|
|
4938
4901
|
let a = {
|
|
@@ -4945,7 +4908,7 @@ function ir(e, t) {
|
|
|
4945
4908
|
stroke: e.paint.stroke,
|
|
4946
4909
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4947
4910
|
cr: (e.cornerRadius ?? 0) * i,
|
|
4948
|
-
dash:
|
|
4911
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4949
4912
|
};
|
|
4950
4913
|
r(l).push(a);
|
|
4951
4914
|
return;
|
|
@@ -4959,16 +4922,16 @@ function ir(e, t) {
|
|
|
4959
4922
|
fill: e.paint.fill,
|
|
4960
4923
|
stroke: e.paint.stroke,
|
|
4961
4924
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4962
|
-
dash:
|
|
4925
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4963
4926
|
});
|
|
4964
4927
|
return;
|
|
4965
4928
|
case "line": {
|
|
4966
4929
|
let a = {
|
|
4967
4930
|
type: "line",
|
|
4968
|
-
points:
|
|
4931
|
+
points: or(e.points, t, n, i, o, s),
|
|
4969
4932
|
stroke: e.paint.stroke,
|
|
4970
4933
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4971
|
-
dash:
|
|
4934
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled),
|
|
4972
4935
|
lineCap: e.lineCap,
|
|
4973
4936
|
lineJoin: e.lineJoin,
|
|
4974
4937
|
alpha: e.paint.alpha
|
|
@@ -4979,7 +4942,7 @@ function ir(e, t) {
|
|
|
4979
4942
|
case "polygon": {
|
|
4980
4943
|
let a = {
|
|
4981
4944
|
type: "polygon",
|
|
4982
|
-
vertices:
|
|
4945
|
+
vertices: or(e.vertices, t, n, i, o, s),
|
|
4983
4946
|
fill: e.paint.fill,
|
|
4984
4947
|
stroke: e.paint.stroke,
|
|
4985
4948
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
@@ -4988,7 +4951,7 @@ function ir(e, t) {
|
|
|
4988
4951
|
return;
|
|
4989
4952
|
}
|
|
4990
4953
|
case "text": {
|
|
4991
|
-
let a =
|
|
4954
|
+
let a = cr(e.transform, t, n, i, o, s), c = {
|
|
4992
4955
|
type: "text",
|
|
4993
4956
|
x: a ? 0 : (t + e.x) * i + o,
|
|
4994
4957
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -5011,7 +4974,7 @@ function ir(e, t) {
|
|
|
5011
4974
|
return;
|
|
5012
4975
|
}
|
|
5013
4976
|
case "image": {
|
|
5014
|
-
let a =
|
|
4977
|
+
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
4978
|
r(l).push({
|
|
5016
4979
|
type: "image",
|
|
5017
4980
|
x: c,
|
|
@@ -5031,7 +4994,7 @@ function ir(e, t) {
|
|
|
5031
4994
|
function a(e, t, n, a, o, s, c) {
|
|
5032
4995
|
let l = e.layer ?? c;
|
|
5033
4996
|
if (e.noScale) {
|
|
5034
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
4997
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? ir);
|
|
5035
4998
|
d.push({
|
|
5036
4999
|
type: "pushTransform",
|
|
5037
5000
|
matrix: [
|
|
@@ -5058,19 +5021,19 @@ function ir(e, t) {
|
|
|
5058
5021
|
});
|
|
5059
5022
|
return o;
|
|
5060
5023
|
}
|
|
5061
|
-
function
|
|
5024
|
+
function or(e, t, n, r, i, a) {
|
|
5062
5025
|
let o = Array(e.length);
|
|
5063
5026
|
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
5027
|
return o;
|
|
5065
5028
|
}
|
|
5066
|
-
function
|
|
5029
|
+
function sr(e, t, n) {
|
|
5067
5030
|
if (n === !1) return;
|
|
5068
5031
|
if (!e || e.length === 0) return e;
|
|
5069
5032
|
let r = Array(e.length);
|
|
5070
5033
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5071
5034
|
return r;
|
|
5072
5035
|
}
|
|
5073
|
-
function
|
|
5036
|
+
function cr(e, t, n, r, i, a) {
|
|
5074
5037
|
if (!e) return;
|
|
5075
5038
|
let [o, s, c, l, u, d] = e;
|
|
5076
5039
|
return [
|
|
@@ -5084,21 +5047,21 @@ function sr(e, t, n, r, i, a) {
|
|
|
5084
5047
|
}
|
|
5085
5048
|
//#endregion
|
|
5086
5049
|
//#region src/render/SvgRenderer.ts
|
|
5087
|
-
function
|
|
5050
|
+
function lr(e) {
|
|
5088
5051
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5089
5052
|
}
|
|
5090
5053
|
function $(e, t) {
|
|
5091
|
-
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ?
|
|
5054
|
+
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? lr(t) : t}"`;
|
|
5092
5055
|
}
|
|
5093
|
-
function
|
|
5056
|
+
function ur(e) {
|
|
5094
5057
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5095
5058
|
}
|
|
5096
|
-
function
|
|
5059
|
+
function dr(e) {
|
|
5097
5060
|
let t = [];
|
|
5098
|
-
for (let n of e)
|
|
5061
|
+
for (let n of e) fr(n.commands, t);
|
|
5099
5062
|
return t;
|
|
5100
5063
|
}
|
|
5101
|
-
function
|
|
5064
|
+
function fr(e, t) {
|
|
5102
5065
|
let n = [];
|
|
5103
5066
|
for (let r of e) switch (r.type) {
|
|
5104
5067
|
case "pushTransform": {
|
|
@@ -5116,29 +5079,29 @@ function dr(e, t) {
|
|
|
5116
5079
|
break;
|
|
5117
5080
|
}
|
|
5118
5081
|
default: {
|
|
5119
|
-
let e =
|
|
5082
|
+
let e = pr(r);
|
|
5120
5083
|
e && t.push(e);
|
|
5121
5084
|
break;
|
|
5122
5085
|
}
|
|
5123
5086
|
}
|
|
5124
5087
|
for (; n.length > 0;) t.push(n.pop());
|
|
5125
5088
|
}
|
|
5126
|
-
function
|
|
5089
|
+
function pr(e) {
|
|
5127
5090
|
switch (e.type) {
|
|
5128
5091
|
case "rect": {
|
|
5129
5092
|
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}${
|
|
5093
|
+
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
5094
|
}
|
|
5132
5095
|
case "circle": {
|
|
5133
5096
|
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) : ""}${
|
|
5097
|
+
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
5098
|
}
|
|
5136
5099
|
case "line": {
|
|
5137
5100
|
let t = e.points;
|
|
5138
5101
|
if (t.length < 2) return;
|
|
5139
5102
|
let n = [];
|
|
5140
5103
|
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) : ""}${
|
|
5104
|
+
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
5105
|
}
|
|
5143
5106
|
case "polygon": {
|
|
5144
5107
|
let t = e.vertices;
|
|
@@ -5151,30 +5114,30 @@ function fr(e) {
|
|
|
5151
5114
|
let t = e.x, n = e.y, r = "start", i = "auto";
|
|
5152
5115
|
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
5116
|
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}>${
|
|
5117
|
+
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
5118
|
}
|
|
5156
5119
|
case "image":
|
|
5157
5120
|
if (e.transform) {
|
|
5158
5121
|
let [t, n, r, i, a, o] = e.transform;
|
|
5159
|
-
return `<image${$("width", e.w)}${$("height", e.h)} href="${
|
|
5122
|
+
return `<image${$("width", e.w)}${$("height", e.h)} href="${lr(e.src)}" transform="matrix(${t},${n},${r},${i},${a},${o})"/>`;
|
|
5160
5123
|
}
|
|
5161
|
-
return `<image${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)} href="${
|
|
5124
|
+
return `<image${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)} href="${lr(e.src)}"/>`;
|
|
5162
5125
|
}
|
|
5163
5126
|
}
|
|
5164
5127
|
//#endregion
|
|
5165
5128
|
//#region src/render/CanvasRenderer.ts
|
|
5166
|
-
var
|
|
5129
|
+
var mr = (e) => {
|
|
5167
5130
|
if (typeof Image < "u") {
|
|
5168
5131
|
let t = new Image();
|
|
5169
5132
|
return t.src = e, t;
|
|
5170
5133
|
}
|
|
5171
5134
|
return null;
|
|
5172
5135
|
};
|
|
5173
|
-
function
|
|
5174
|
-
let r = n.imageFactory ??
|
|
5175
|
-
for (let n of t)
|
|
5136
|
+
function hr(e, t, n = {}) {
|
|
5137
|
+
let r = n.imageFactory ?? mr;
|
|
5138
|
+
for (let n of t) gr(e, n.commands, r);
|
|
5176
5139
|
}
|
|
5177
|
-
function
|
|
5140
|
+
function gr(e, t, n) {
|
|
5178
5141
|
let r = 0;
|
|
5179
5142
|
for (let i of t) switch (i.type) {
|
|
5180
5143
|
case "pushTransform":
|
|
@@ -5188,12 +5151,12 @@ function hr(e, t, n) {
|
|
|
5188
5151
|
r > 0 && (e.restore(), r--);
|
|
5189
5152
|
break;
|
|
5190
5153
|
default:
|
|
5191
|
-
|
|
5154
|
+
_r(e, i, n);
|
|
5192
5155
|
break;
|
|
5193
5156
|
}
|
|
5194
5157
|
for (; r > 0;) e.restore(), r--;
|
|
5195
5158
|
}
|
|
5196
|
-
function
|
|
5159
|
+
function _r(e, t, n) {
|
|
5197
5160
|
switch (t.type) {
|
|
5198
5161
|
case "rect":
|
|
5199
5162
|
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 +5217,35 @@ function gr(e, t, n) {
|
|
|
5254
5217
|
}
|
|
5255
5218
|
//#endregion
|
|
5256
5219
|
//#region src/export/flushSceneShapes.ts
|
|
5257
|
-
function
|
|
5258
|
-
n(e.grid), n(e.link), n(e.room), n(
|
|
5220
|
+
function vr(e, t, n) {
|
|
5221
|
+
n(e.grid), n(e.link), n(e.room), n(yr(t.state, t.overlays));
|
|
5259
5222
|
for (let e of t.sceneOverlays) {
|
|
5260
5223
|
let r = e.render(t.state, t.viewportBounds);
|
|
5261
5224
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5262
5225
|
}
|
|
5263
5226
|
n(e.topLabel);
|
|
5264
5227
|
}
|
|
5265
|
-
function
|
|
5228
|
+
function yr(e, t) {
|
|
5266
5229
|
let n = e.getOverlaysForArea(t);
|
|
5267
5230
|
if (!n) return [];
|
|
5268
5231
|
let r = e.settings, i = [];
|
|
5269
5232
|
if (n.paths) for (let t of n.paths) {
|
|
5270
|
-
let n =
|
|
5271
|
-
i.push(...
|
|
5233
|
+
let n = ct(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5234
|
+
i.push(...dt(n));
|
|
5272
5235
|
}
|
|
5273
5236
|
if (n.highlights) for (let t of n.highlights) {
|
|
5274
5237
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5275
|
-
n && i.push(
|
|
5238
|
+
n && i.push(lt(ot(n, t.color, r)));
|
|
5276
5239
|
}
|
|
5277
5240
|
if (n.position) {
|
|
5278
5241
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5279
|
-
t && i.push(
|
|
5242
|
+
t && i.push(ut(st(t, r)));
|
|
5280
5243
|
}
|
|
5281
5244
|
return i;
|
|
5282
5245
|
}
|
|
5283
5246
|
//#endregion
|
|
5284
5247
|
//#region src/export/sceneBounds.ts
|
|
5285
|
-
function
|
|
5248
|
+
function br(e, t, n = 0) {
|
|
5286
5249
|
if (!t.worldToScene) return e;
|
|
5287
5250
|
let r = [
|
|
5288
5251
|
t.worldToScene(e.x, e.y),
|
|
@@ -5300,15 +5263,15 @@ function yr(e, t, n = 0) {
|
|
|
5300
5263
|
}
|
|
5301
5264
|
//#endregion
|
|
5302
5265
|
//#region src/export/SvgExporter.ts
|
|
5303
|
-
var
|
|
5266
|
+
var xr = {
|
|
5304
5267
|
scale: 1,
|
|
5305
5268
|
offsetX: 0,
|
|
5306
5269
|
offsetY: 0
|
|
5307
5270
|
};
|
|
5308
|
-
function
|
|
5271
|
+
function Sr(e) {
|
|
5309
5272
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5310
5273
|
}
|
|
5311
|
-
var
|
|
5274
|
+
var Cr = class {
|
|
5312
5275
|
constructor(e = {}) {
|
|
5313
5276
|
this.options = e;
|
|
5314
5277
|
}
|
|
@@ -5317,30 +5280,30 @@ var Sr = class {
|
|
|
5317
5280
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5318
5281
|
let o = a, s = o.getPlane(i);
|
|
5319
5282
|
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
|
|
5283
|
+
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
5284
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5322
5285
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5323
5286
|
}), p = {
|
|
5324
5287
|
scale: 1,
|
|
5325
5288
|
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="${
|
|
5289
|
+
}, m = (e) => t === W ? e : G(e, t, p), h = br(u, t, c.roomSize * .5), g = [];
|
|
5290
|
+
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
5291
|
state: e,
|
|
5329
5292
|
viewportBounds: d,
|
|
5330
5293
|
sceneOverlays: n,
|
|
5331
5294
|
overlays: this.options.overlays
|
|
5332
5295
|
}, (e) => {
|
|
5333
|
-
e.length !== 0 && g.push(...
|
|
5296
|
+
e.length !== 0 && g.push(...dr(ar(m(e), xr)));
|
|
5334
5297
|
}), g.push("</svg>"), g.join("\n");
|
|
5335
5298
|
}
|
|
5336
|
-
},
|
|
5299
|
+
}, wr = class {
|
|
5337
5300
|
constructor(e = {}) {
|
|
5338
5301
|
this.options = e;
|
|
5339
5302
|
}
|
|
5340
5303
|
render({ backend: e }) {
|
|
5341
5304
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5342
5305
|
}
|
|
5343
|
-
},
|
|
5306
|
+
}, Tr = class {
|
|
5344
5307
|
constructor(e = {}) {
|
|
5345
5308
|
this.options = e;
|
|
5346
5309
|
}
|
|
@@ -5357,14 +5320,14 @@ var Sr = class {
|
|
|
5357
5320
|
};
|
|
5358
5321
|
//#endregion
|
|
5359
5322
|
//#region src/export/canvasToBytes.ts
|
|
5360
|
-
function
|
|
5323
|
+
function Er(e, t = "image/png", n) {
|
|
5361
5324
|
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
5325
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5363
5326
|
return s;
|
|
5364
5327
|
}
|
|
5365
5328
|
//#endregion
|
|
5366
5329
|
//#region src/export/CanvasExporter.ts
|
|
5367
|
-
var
|
|
5330
|
+
var Dr = class {
|
|
5368
5331
|
constructor(e) {
|
|
5369
5332
|
this.options = e;
|
|
5370
5333
|
}
|
|
@@ -5373,14 +5336,14 @@ var Er = class {
|
|
|
5373
5336
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5374
5337
|
let s = o, c = s.getPlane(a);
|
|
5375
5338
|
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 =
|
|
5339
|
+
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
5340
|
scale: h,
|
|
5378
5341
|
offsetX: v,
|
|
5379
5342
|
offsetY: y
|
|
5380
5343
|
}, x = D.forRenderCamera(u, d, h, v, y), S = {
|
|
5381
5344
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5382
5345
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5383
|
-
}, C = Re(new
|
|
5346
|
+
}, C = Re(new B(e.mapReader, l).buildScene(s, c, a, e.lens), x.getViewportBounds(), l, S), w = r.Util.createCanvasElement();
|
|
5384
5347
|
w.width = u, w.height = d;
|
|
5385
5348
|
let T = w.getContext("2d");
|
|
5386
5349
|
if (!T) return;
|
|
@@ -5389,55 +5352,55 @@ var Er = class {
|
|
|
5389
5352
|
scale: h,
|
|
5390
5353
|
roomSize: l.roomSize
|
|
5391
5354
|
}, O = (e) => t === W ? e : G(e, t, E);
|
|
5392
|
-
return
|
|
5355
|
+
return vr(C, {
|
|
5393
5356
|
state: e,
|
|
5394
5357
|
viewportBounds: D.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5395
5358
|
sceneOverlays: n,
|
|
5396
5359
|
overlays: this.options.overlays
|
|
5397
5360
|
}, (e) => {
|
|
5398
|
-
e.length !== 0 &&
|
|
5361
|
+
e.length !== 0 && hr(T, ar(O(e), b));
|
|
5399
5362
|
}), w;
|
|
5400
5363
|
}
|
|
5401
|
-
},
|
|
5364
|
+
}, Or = class {
|
|
5402
5365
|
constructor(e) {
|
|
5403
|
-
this.options = e, this.canvasExporter = new
|
|
5366
|
+
this.options = e, this.canvasExporter = new Dr(e);
|
|
5404
5367
|
}
|
|
5405
5368
|
render(e) {
|
|
5406
5369
|
let t = this.canvasExporter.render(e);
|
|
5407
|
-
if (t) return
|
|
5370
|
+
if (t) return Er(t, this.options.mimeType, this.options.quality);
|
|
5408
5371
|
}
|
|
5409
|
-
},
|
|
5410
|
-
function
|
|
5372
|
+
}, kr, Ar, jr = 256;
|
|
5373
|
+
function Mr(e, t, n) {
|
|
5411
5374
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5412
|
-
if (
|
|
5413
|
-
let i =
|
|
5375
|
+
if (Ar === r && kr) return kr;
|
|
5376
|
+
let i = jr, a = i / 2, o = document.createElement("canvas");
|
|
5414
5377
|
o.width = i, o.height = i;
|
|
5415
5378
|
let s = o.getContext("2d");
|
|
5416
5379
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5417
5380
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5418
5381
|
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
5382
|
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),
|
|
5383
|
+
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
5384
|
}
|
|
5422
|
-
function
|
|
5385
|
+
function Nr(e, t, n, r) {
|
|
5423
5386
|
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
5387
|
return {
|
|
5425
5388
|
cx: e,
|
|
5426
5389
|
cy: t,
|
|
5427
5390
|
displaySize: u,
|
|
5428
|
-
src:
|
|
5391
|
+
src: Mr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5429
5392
|
};
|
|
5430
5393
|
}
|
|
5431
5394
|
//#endregion
|
|
5432
5395
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5433
|
-
var
|
|
5396
|
+
var Pr = {
|
|
5434
5397
|
color: "#ffcc44",
|
|
5435
5398
|
radius: 12,
|
|
5436
5399
|
intensity: .7
|
|
5437
|
-
},
|
|
5400
|
+
}, Fr = class {
|
|
5438
5401
|
constructor(e) {
|
|
5439
5402
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5440
|
-
...
|
|
5403
|
+
...Pr,
|
|
5441
5404
|
...e
|
|
5442
5405
|
};
|
|
5443
5406
|
}
|
|
@@ -5460,7 +5423,7 @@ var Nr = {
|
|
|
5460
5423
|
if (e.positionRoomId === void 0) return;
|
|
5461
5424
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5462
5425
|
if (!n) return;
|
|
5463
|
-
let r =
|
|
5426
|
+
let r = Nr(n.x, n.y, t, this.params);
|
|
5464
5427
|
return {
|
|
5465
5428
|
type: "image",
|
|
5466
5429
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5471,7 +5434,7 @@ var Nr = {
|
|
|
5471
5434
|
layer: "overlay"
|
|
5472
5435
|
};
|
|
5473
5436
|
}
|
|
5474
|
-
},
|
|
5437
|
+
}, Ir = /* @__PURE__ */ u(((e, t) => {
|
|
5475
5438
|
t.exports = class {
|
|
5476
5439
|
constructor() {
|
|
5477
5440
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5501,14 +5464,14 @@ var Nr = {
|
|
|
5501
5464
|
return this.queue.find((t) => t.key === e);
|
|
5502
5465
|
}
|
|
5503
5466
|
};
|
|
5504
|
-
})),
|
|
5467
|
+
})), Lr = /* @__PURE__ */ u(((e, t) => {
|
|
5505
5468
|
function n(e, t) {
|
|
5506
5469
|
let r = /* @__PURE__ */ new Map();
|
|
5507
5470
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5508
5471
|
return r;
|
|
5509
5472
|
}
|
|
5510
5473
|
t.exports = n;
|
|
5511
|
-
})),
|
|
5474
|
+
})), Rr = /* @__PURE__ */ u(((e, t) => {
|
|
5512
5475
|
function n(e) {
|
|
5513
5476
|
let t = Number(e);
|
|
5514
5477
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5523,7 +5486,7 @@ var Nr = {
|
|
|
5523
5486
|
}), t;
|
|
5524
5487
|
}
|
|
5525
5488
|
t.exports = r;
|
|
5526
|
-
})),
|
|
5489
|
+
})), zr = /* @__PURE__ */ u(((e, t) => {
|
|
5527
5490
|
function n(e) {
|
|
5528
5491
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5529
5492
|
e.forEach((e, t) => {
|
|
@@ -5535,8 +5498,8 @@ var Nr = {
|
|
|
5535
5498
|
});
|
|
5536
5499
|
}
|
|
5537
5500
|
t.exports = n;
|
|
5538
|
-
})),
|
|
5539
|
-
var n =
|
|
5501
|
+
})), Br = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5502
|
+
var n = Ir(), r = Lr(), i = Rr(), a = zr();
|
|
5540
5503
|
t.exports = class {
|
|
5541
5504
|
constructor(e) {
|
|
5542
5505
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5586,7 +5549,7 @@ var Nr = {
|
|
|
5586
5549
|
return this.path(...e);
|
|
5587
5550
|
}
|
|
5588
5551
|
};
|
|
5589
|
-
})))(), 1),
|
|
5552
|
+
})))(), 1), Vr = {
|
|
5590
5553
|
1: "north",
|
|
5591
5554
|
2: "northeast",
|
|
5592
5555
|
3: "northwest",
|
|
@@ -5599,7 +5562,7 @@ var Nr = {
|
|
|
5599
5562
|
10: "down",
|
|
5600
5563
|
11: "in",
|
|
5601
5564
|
12: "out"
|
|
5602
|
-
},
|
|
5565
|
+
}, Hr = {
|
|
5603
5566
|
north: "n",
|
|
5604
5567
|
northeast: "ne",
|
|
5605
5568
|
northwest: "nw",
|
|
@@ -5612,7 +5575,7 @@ var Nr = {
|
|
|
5612
5575
|
down: "down",
|
|
5613
5576
|
in: "in",
|
|
5614
5577
|
out: "out"
|
|
5615
|
-
},
|
|
5578
|
+
}, Ur = class {
|
|
5616
5579
|
constructor(e) {
|
|
5617
5580
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5618
5581
|
}
|
|
@@ -5638,12 +5601,12 @@ var Nr = {
|
|
|
5638
5601
|
buildGraph() {
|
|
5639
5602
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5640
5603
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5641
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
5604
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Vr[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
5642
5605
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5643
5606
|
if (s.has(e)) return;
|
|
5644
5607
|
let c = this.mapReader.getRoom(t);
|
|
5645
5608
|
if (c) {
|
|
5646
|
-
let s =
|
|
5609
|
+
let s = Hr[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5647
5610
|
a.push({
|
|
5648
5611
|
id: t,
|
|
5649
5612
|
weight: l
|
|
@@ -5674,7 +5637,7 @@ var Nr = {
|
|
|
5674
5637
|
};
|
|
5675
5638
|
//#endregion
|
|
5676
5639
|
//#region src/PathFinder.ts
|
|
5677
|
-
function
|
|
5640
|
+
function Wr(e, t) {
|
|
5678
5641
|
e.push(t);
|
|
5679
5642
|
let n = e.length - 1;
|
|
5680
5643
|
for (; n > 0;) {
|
|
@@ -5683,7 +5646,7 @@ function Ur(e, t) {
|
|
|
5683
5646
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5684
5647
|
}
|
|
5685
5648
|
}
|
|
5686
|
-
function
|
|
5649
|
+
function Gr(e) {
|
|
5687
5650
|
if (e.length === 0) return;
|
|
5688
5651
|
let t = e[0], n = e.pop();
|
|
5689
5652
|
if (e.length > 0) {
|
|
@@ -5697,16 +5660,16 @@ function Wr(e) {
|
|
|
5697
5660
|
}
|
|
5698
5661
|
return t;
|
|
5699
5662
|
}
|
|
5700
|
-
function
|
|
5663
|
+
function Kr(e, t, n) {
|
|
5701
5664
|
let r = [n], i = n;
|
|
5702
5665
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5703
5666
|
return r.reverse(), r;
|
|
5704
5667
|
}
|
|
5705
|
-
function
|
|
5668
|
+
function qr(e, t, n) {
|
|
5706
5669
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5707
5670
|
return i ? i.map((e) => Number(e)) : null;
|
|
5708
5671
|
}
|
|
5709
|
-
function
|
|
5672
|
+
function Jr(e, t, n, r) {
|
|
5710
5673
|
let i = r.getRoom(n);
|
|
5711
5674
|
if (!i) return null;
|
|
5712
5675
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5715,16 +5678,16 @@ function qr(e, t, n, r) {
|
|
|
5715
5678
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5716
5679
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5717
5680
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5718
|
-
for (d.set(t, 0),
|
|
5681
|
+
for (d.set(t, 0), Wr(p, {
|
|
5719
5682
|
id: t,
|
|
5720
5683
|
priority: u(t)
|
|
5721
5684
|
}); p.length > 0;) {
|
|
5722
|
-
let { id: r } =
|
|
5723
|
-
if (r === n) return
|
|
5685
|
+
let { id: r } = Gr(p);
|
|
5686
|
+
if (r === n) return Kr(f, t, n);
|
|
5724
5687
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5725
5688
|
if (a) for (let e of a) {
|
|
5726
5689
|
let t = i + e.weight;
|
|
5727
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
5690
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), Wr(p, {
|
|
5728
5691
|
id: e.id,
|
|
5729
5692
|
priority: t + u(e.id)
|
|
5730
5693
|
}));
|
|
@@ -5732,9 +5695,9 @@ function qr(e, t, n, r) {
|
|
|
5732
5695
|
}
|
|
5733
5696
|
return null;
|
|
5734
5697
|
}
|
|
5735
|
-
var
|
|
5698
|
+
var Yr = class {
|
|
5736
5699
|
constructor(e, t = "dijkstra") {
|
|
5737
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
5700
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Ur(e), this.dijkstraGraph = new Br.default(this.mapGraph.getGraphDefinition());
|
|
5738
5701
|
}
|
|
5739
5702
|
get algorithm() {
|
|
5740
5703
|
return this._algorithm;
|
|
@@ -5753,23 +5716,23 @@ var Jr = class {
|
|
|
5753
5716
|
let r;
|
|
5754
5717
|
switch (this._algorithm) {
|
|
5755
5718
|
case "dijkstra":
|
|
5756
|
-
r =
|
|
5719
|
+
r = qr(this.dijkstraGraph, e, t);
|
|
5757
5720
|
break;
|
|
5758
5721
|
case "astar":
|
|
5759
|
-
r =
|
|
5722
|
+
r = Jr(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5760
5723
|
break;
|
|
5761
5724
|
}
|
|
5762
5725
|
return this.cache.set(n, r), r;
|
|
5763
5726
|
}
|
|
5764
|
-
},
|
|
5727
|
+
}, Xr = {
|
|
5765
5728
|
hidden: 2,
|
|
5766
5729
|
stub: 1,
|
|
5767
5730
|
full: 0
|
|
5768
5731
|
};
|
|
5769
|
-
function
|
|
5770
|
-
return n === "first" ? e : n === "least-restrictive" ?
|
|
5732
|
+
function Zr(e, t, n) {
|
|
5733
|
+
return n === "first" ? e : n === "least-restrictive" ? Xr[e] < Xr[t] ? e : t : Xr[e] > Xr[t] ? e : t;
|
|
5771
5734
|
}
|
|
5772
|
-
function
|
|
5735
|
+
function Qr(e, ...t) {
|
|
5773
5736
|
let n = {}, r;
|
|
5774
5737
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5775
5738
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -5785,7 +5748,7 @@ function Zr(e, ...t) {
|
|
|
5785
5748
|
for (let o of r) {
|
|
5786
5749
|
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5787
5750
|
if (a === void 0) a = r;
|
|
5788
|
-
else if (a =
|
|
5751
|
+
else if (a = Zr(a, r, i), i === "first") break;
|
|
5789
5752
|
}
|
|
5790
5753
|
return a ?? "full";
|
|
5791
5754
|
},
|
|
@@ -5798,7 +5761,7 @@ function Zr(e, ...t) {
|
|
|
5798
5761
|
}
|
|
5799
5762
|
//#endregion
|
|
5800
5763
|
//#region src/lens/ExplorationLens.ts
|
|
5801
|
-
var
|
|
5764
|
+
var $r = class {
|
|
5802
5765
|
constructor(e) {
|
|
5803
5766
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5804
5767
|
}
|
|
@@ -5833,7 +5796,7 @@ var Qr = class {
|
|
|
5833
5796
|
clear() {
|
|
5834
5797
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5835
5798
|
}
|
|
5836
|
-
},
|
|
5799
|
+
}, ei = {
|
|
5837
5800
|
1: "north",
|
|
5838
5801
|
2: "northeast",
|
|
5839
5802
|
3: "northwest",
|
|
@@ -5847,7 +5810,7 @@ var Qr = class {
|
|
|
5847
5810
|
11: "in",
|
|
5848
5811
|
12: "out"
|
|
5849
5812
|
};
|
|
5850
|
-
function
|
|
5813
|
+
function ti() {
|
|
5851
5814
|
return {
|
|
5852
5815
|
areaWidth: 150,
|
|
5853
5816
|
areaHeight: 80,
|
|
@@ -5861,9 +5824,9 @@ function ei() {
|
|
|
5861
5824
|
highlightColor: "#ff9900"
|
|
5862
5825
|
};
|
|
5863
5826
|
}
|
|
5864
|
-
var
|
|
5827
|
+
var ni = class {
|
|
5865
5828
|
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 ??
|
|
5829
|
+
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
5830
|
container: e,
|
|
5868
5831
|
width: e.clientWidth,
|
|
5869
5832
|
height: e.clientHeight,
|
|
@@ -6046,14 +6009,14 @@ var ti = class {
|
|
|
6046
6009
|
toAreaId: e.fromAreaId,
|
|
6047
6010
|
fromRoomId: e.toRoomId,
|
|
6048
6011
|
toRoomId: e.fromRoomId,
|
|
6049
|
-
direction: e.direction ?
|
|
6012
|
+
direction: e.direction ? P[e.direction] : null,
|
|
6050
6013
|
fromRoomPosition: e.toRoomPosition,
|
|
6051
6014
|
toRoomPosition: e.fromRoomPosition
|
|
6052
6015
|
});
|
|
6053
6016
|
}
|
|
6054
6017
|
}
|
|
6055
6018
|
getLockedDirections(e) {
|
|
6056
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6019
|
+
return new Set((e.exitLocks ?? []).map((e) => ei[e]).filter((e) => !!e));
|
|
6057
6020
|
}
|
|
6058
6021
|
createConnection(e, t, n) {
|
|
6059
6022
|
let r = this.toPlanarDirection(n);
|
|
@@ -6122,7 +6085,7 @@ var ti = class {
|
|
|
6122
6085
|
}[e.toLowerCase().trim()] ?? null;
|
|
6123
6086
|
}
|
|
6124
6087
|
toPlanarDirection(e) {
|
|
6125
|
-
return e &&
|
|
6088
|
+
return e && N.includes(e) ? e : null;
|
|
6126
6089
|
}
|
|
6127
6090
|
layoutAreas() {
|
|
6128
6091
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6665,6 +6628,6 @@ var ti = class {
|
|
|
6665
6628
|
}
|
|
6666
6629
|
};
|
|
6667
6630
|
//#endregion
|
|
6668
|
-
export { C as ALL_VISIBLE,
|
|
6631
|
+
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
6632
|
|
|
6670
6633
|
//# sourceMappingURL=index.mjs.map
|