mudlet-map-renderer 1.1.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/camera/Camera.d.ts +12 -0
- package/dist/index.mjs +489 -512
- 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
|
@@ -400,7 +400,7 @@ var D = class e extends S {
|
|
|
400
400
|
}, this.positionAtDragStart = {
|
|
401
401
|
x: 0,
|
|
402
402
|
y: 0
|
|
403
|
-
}, this.width = e, this.height = t;
|
|
403
|
+
}, this.batchDepth = 0, this.batchDirty = !1, this.width = e, this.height = t;
|
|
404
404
|
}
|
|
405
405
|
getScale() {
|
|
406
406
|
return 75 * this.zoom;
|
|
@@ -551,7 +551,19 @@ var D = class e extends S {
|
|
|
551
551
|
isAnimating() {
|
|
552
552
|
return this.animationId !== void 0;
|
|
553
553
|
}
|
|
554
|
+
batch(e) {
|
|
555
|
+
this.batchDepth++;
|
|
556
|
+
try {
|
|
557
|
+
return e();
|
|
558
|
+
} finally {
|
|
559
|
+
this.batchDepth--, this.batchDepth === 0 && this.batchDirty && (this.batchDirty = !1, this.emit("change", void 0));
|
|
560
|
+
}
|
|
561
|
+
}
|
|
554
562
|
notify() {
|
|
563
|
+
if (this.batchDepth > 0) {
|
|
564
|
+
this.batchDirty = !0;
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
555
567
|
this.emit("change", void 0);
|
|
556
568
|
}
|
|
557
569
|
}, O = (e, t) => ({
|
|
@@ -587,7 +599,7 @@ var D = class e extends S {
|
|
|
587
599
|
"northwest",
|
|
588
600
|
"southeast",
|
|
589
601
|
"southwest"
|
|
590
|
-
],
|
|
602
|
+
], A = {
|
|
591
603
|
n: "north",
|
|
592
604
|
s: "south",
|
|
593
605
|
e: "east",
|
|
@@ -596,7 +608,7 @@ var D = class e extends S {
|
|
|
596
608
|
nw: "northwest",
|
|
597
609
|
se: "southeast",
|
|
598
610
|
sw: "southwest"
|
|
599
|
-
},
|
|
611
|
+
}, j = {
|
|
600
612
|
north: "n",
|
|
601
613
|
south: "s",
|
|
602
614
|
east: "e",
|
|
@@ -609,7 +621,7 @@ var D = class e extends S {
|
|
|
609
621
|
down: "d",
|
|
610
622
|
in: "i",
|
|
611
623
|
out: "o"
|
|
612
|
-
},
|
|
624
|
+
}, M = {
|
|
613
625
|
north: {
|
|
614
626
|
x: 0,
|
|
615
627
|
y: -1
|
|
@@ -642,7 +654,7 @@ var D = class e extends S {
|
|
|
642
654
|
x: -1,
|
|
643
655
|
y: 1
|
|
644
656
|
}
|
|
645
|
-
},
|
|
657
|
+
}, N = [
|
|
646
658
|
"north",
|
|
647
659
|
"south",
|
|
648
660
|
"east",
|
|
@@ -651,7 +663,7 @@ var D = class e extends S {
|
|
|
651
663
|
"northwest",
|
|
652
664
|
"southeast",
|
|
653
665
|
"southwest"
|
|
654
|
-
],
|
|
666
|
+
], P = {
|
|
655
667
|
north: "south",
|
|
656
668
|
south: "north",
|
|
657
669
|
east: "west",
|
|
@@ -661,39 +673,39 @@ var D = class e extends S {
|
|
|
661
673
|
southeast: "northwest",
|
|
662
674
|
southwest: "northeast"
|
|
663
675
|
};
|
|
664
|
-
function
|
|
665
|
-
return e ? Object.prototype.hasOwnProperty.call(
|
|
676
|
+
function F(e) {
|
|
677
|
+
return e ? Object.prototype.hasOwnProperty.call(M, e) : !1;
|
|
666
678
|
}
|
|
667
|
-
function
|
|
668
|
-
if (!
|
|
679
|
+
function I(e, t, n, r = 1) {
|
|
680
|
+
if (!F(n)) return {
|
|
669
681
|
x: e,
|
|
670
682
|
y: t
|
|
671
683
|
};
|
|
672
|
-
let i =
|
|
684
|
+
let i = M[n];
|
|
673
685
|
return {
|
|
674
686
|
x: e + i.x * r,
|
|
675
687
|
y: t + i.y * r
|
|
676
688
|
};
|
|
677
689
|
}
|
|
678
|
-
function
|
|
679
|
-
if (!
|
|
690
|
+
function L(e, t, n, r = 1, i = 0) {
|
|
691
|
+
if (!F(n)) return {
|
|
680
692
|
x: e,
|
|
681
693
|
y: t
|
|
682
694
|
};
|
|
683
|
-
let a =
|
|
684
|
-
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);
|
|
685
697
|
let o = r - i + i / Math.SQRT2;
|
|
686
698
|
return {
|
|
687
699
|
x: e + a.x * o,
|
|
688
700
|
y: t + a.y * o
|
|
689
701
|
};
|
|
690
702
|
}
|
|
691
|
-
function
|
|
692
|
-
if (!
|
|
703
|
+
function te(e, t, n, r = 1) {
|
|
704
|
+
if (!F(n)) return {
|
|
693
705
|
x: e,
|
|
694
706
|
y: t
|
|
695
707
|
};
|
|
696
|
-
let i =
|
|
708
|
+
let i = M[n], a = Math.atan2(i.y, i.x);
|
|
697
709
|
return {
|
|
698
710
|
x: e + Math.cos(a) * r,
|
|
699
711
|
y: t + Math.sin(a) * r
|
|
@@ -701,26 +713,26 @@ function re(e, t, n, r = 1) {
|
|
|
701
713
|
}
|
|
702
714
|
//#endregion
|
|
703
715
|
//#region src/ExitRenderer.ts
|
|
704
|
-
var
|
|
716
|
+
var ne = {
|
|
705
717
|
OPEN_DOOR: "rgb(10, 155, 10)",
|
|
706
718
|
CLOSED_DOOR: "rgb(226, 205, 59)",
|
|
707
719
|
LOCKED_DOOR: "rgb(155, 10, 10)",
|
|
708
720
|
ONE_WAY_FILL: "rgb(155, 10, 10)"
|
|
709
721
|
};
|
|
710
|
-
function
|
|
722
|
+
function re(e) {
|
|
711
723
|
switch (e) {
|
|
712
|
-
case 1: return
|
|
713
|
-
case 2: return
|
|
714
|
-
default: return
|
|
724
|
+
case 1: return ne.OPEN_DOOR;
|
|
725
|
+
case 2: return ne.CLOSED_DOOR;
|
|
726
|
+
default: return ne.LOCKED_DOOR;
|
|
715
727
|
}
|
|
716
728
|
}
|
|
717
|
-
var
|
|
729
|
+
var ie = class {
|
|
718
730
|
constructor(e, t) {
|
|
719
731
|
this.mapReader = e, this.settings = t;
|
|
720
732
|
}
|
|
721
733
|
getRoomEdgePoint(e, t, n, r) {
|
|
722
734
|
let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
|
|
723
|
-
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);
|
|
724
736
|
}
|
|
725
737
|
renderData(e, t) {
|
|
726
738
|
return this.renderDataWithColor(e, this.settings.lineColor, t);
|
|
@@ -735,7 +747,7 @@ var oe = class {
|
|
|
735
747
|
}
|
|
736
748
|
renderTwoWayExitData(e, t, n) {
|
|
737
749
|
let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
|
|
738
|
-
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;
|
|
739
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 = [
|
|
740
752
|
a.x,
|
|
741
753
|
a.y,
|
|
@@ -745,7 +757,7 @@ var oe = class {
|
|
|
745
757
|
points: s,
|
|
746
758
|
stroke: t,
|
|
747
759
|
strokeWidth: this.settings.lineWidth
|
|
748
|
-
}], l = [], u = r.doors[
|
|
760
|
+
}], l = [], u = r.doors[j[e.aDir]] ?? i.doors[j[e.bDir]];
|
|
749
761
|
if (u) {
|
|
750
762
|
let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
|
|
751
763
|
l.push({
|
|
@@ -753,7 +765,7 @@ var oe = class {
|
|
|
753
765
|
y: t - this.settings.roomSize / 4,
|
|
754
766
|
width: this.settings.roomSize / 2,
|
|
755
767
|
height: this.settings.roomSize / 2,
|
|
756
|
-
stroke:
|
|
768
|
+
stroke: re(u),
|
|
757
769
|
strokeWidth: this.settings.lineWidth
|
|
758
770
|
});
|
|
759
771
|
}
|
|
@@ -784,9 +796,9 @@ var oe = class {
|
|
|
784
796
|
}
|
|
785
797
|
renderOneWayExitData(e, t, n) {
|
|
786
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;
|
|
787
|
-
if (!o || !i || !a || !k.includes(o) || i.customLines[
|
|
799
|
+
if (!o || !i || !a || !k.includes(o) || i.customLines[j[o] || o]) return;
|
|
788
800
|
if (i.area != a.area && o) {
|
|
789
|
-
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;
|
|
790
802
|
return {
|
|
791
803
|
lines: [],
|
|
792
804
|
arrows: [{
|
|
@@ -825,8 +837,8 @@ var oe = class {
|
|
|
825
837
|
x: a.x,
|
|
826
838
|
y: a.y
|
|
827
839
|
};
|
|
828
|
-
s && (c =
|
|
829
|
-
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 = [
|
|
830
842
|
f.x,
|
|
831
843
|
f.y,
|
|
832
844
|
c.x,
|
|
@@ -858,7 +870,7 @@ var oe = class {
|
|
|
858
870
|
pointerWidth: .35,
|
|
859
871
|
strokeWidth: this.settings.lineWidth * 1.4,
|
|
860
872
|
stroke: t,
|
|
861
|
-
fill:
|
|
873
|
+
fill: ne.ONE_WAY_FILL,
|
|
862
874
|
dash: [.1, .05]
|
|
863
875
|
}],
|
|
864
876
|
doors: [],
|
|
@@ -913,7 +925,7 @@ var oe = class {
|
|
|
913
925
|
for (let [r, i] of Object.entries(e.customLines)) {
|
|
914
926
|
let a = e.specialExits[r];
|
|
915
927
|
if (a === void 0) {
|
|
916
|
-
let t =
|
|
928
|
+
let t = A[r] ?? n[r];
|
|
917
929
|
t && (a = e.exits[t] ?? e.specialExits[t]);
|
|
918
930
|
}
|
|
919
931
|
if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
|
|
@@ -945,7 +957,7 @@ var oe = class {
|
|
|
945
957
|
}
|
|
946
958
|
return t;
|
|
947
959
|
}
|
|
948
|
-
},
|
|
960
|
+
}, ae = {
|
|
949
961
|
1: "north",
|
|
950
962
|
2: "northeast",
|
|
951
963
|
3: "northwest",
|
|
@@ -959,15 +971,15 @@ var oe = class {
|
|
|
959
971
|
11: "in",
|
|
960
972
|
12: "out"
|
|
961
973
|
};
|
|
962
|
-
function
|
|
963
|
-
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);
|
|
964
976
|
}
|
|
965
|
-
function
|
|
977
|
+
function se(e, t, n) {
|
|
966
978
|
let r = [];
|
|
967
979
|
for (let i of e.stubs) {
|
|
968
|
-
let a =
|
|
980
|
+
let a = ae[i];
|
|
969
981
|
if (!a) continue;
|
|
970
|
-
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);
|
|
971
983
|
r.push({
|
|
972
984
|
roomId: e.id,
|
|
973
985
|
direction: a,
|
|
@@ -983,12 +995,12 @@ function le(e, t, n) {
|
|
|
983
995
|
}
|
|
984
996
|
//#endregion
|
|
985
997
|
//#region src/scene/SpecialExitStyle.ts
|
|
986
|
-
var
|
|
998
|
+
var ce = {
|
|
987
999
|
1: "rgb(10, 155, 10)",
|
|
988
1000
|
2: "rgb(226, 205, 59)",
|
|
989
1001
|
3: "rgb(155, 10, 10)"
|
|
990
1002
|
};
|
|
991
|
-
function
|
|
1003
|
+
function le(e, t, n) {
|
|
992
1004
|
let r = [];
|
|
993
1005
|
for (let [i, a] of Object.entries(e.customLines)) {
|
|
994
1006
|
let o = [e.x, e.y];
|
|
@@ -1035,7 +1047,7 @@ function de(e, t, n) {
|
|
|
1035
1047
|
y: n - r / 2,
|
|
1036
1048
|
width: r,
|
|
1037
1049
|
height: r,
|
|
1038
|
-
stroke:
|
|
1050
|
+
stroke: ce[f] ?? ce[3],
|
|
1039
1051
|
strokeWidth: t.lineWidth
|
|
1040
1052
|
};
|
|
1041
1053
|
}
|
|
@@ -1050,33 +1062,33 @@ function de(e, t, n) {
|
|
|
1050
1062
|
}
|
|
1051
1063
|
//#endregion
|
|
1052
1064
|
//#region src/utils/textMeasure.ts
|
|
1053
|
-
var
|
|
1054
|
-
function
|
|
1055
|
-
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;
|
|
1056
1068
|
}
|
|
1057
|
-
function
|
|
1058
|
-
let n = `${e}::${t}`, r =
|
|
1069
|
+
function me(e, t) {
|
|
1070
|
+
let n = `${e}::${t}`, r = fe.get(n);
|
|
1059
1071
|
if (r !== void 0) return r;
|
|
1060
|
-
let i =
|
|
1061
|
-
i.clearRect(0, 0,
|
|
1062
|
-
let { data: o } = i.getImageData(0, 0,
|
|
1063
|
-
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));
|
|
1064
1076
|
if (c === -1) {
|
|
1065
1077
|
let e = {
|
|
1066
1078
|
baselineRatio: .35,
|
|
1067
1079
|
konvaCorrectionRatio: 0
|
|
1068
1080
|
};
|
|
1069
|
-
return
|
|
1081
|
+
return fe.set(n, e), e;
|
|
1070
1082
|
}
|
|
1071
|
-
let l = (
|
|
1083
|
+
let l = (de - s - Math.max(0, c - de)) / 2 / ue, u = i.measureText("M"), d = {
|
|
1072
1084
|
baselineRatio: l,
|
|
1073
|
-
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
|
|
1074
1086
|
};
|
|
1075
|
-
return
|
|
1087
|
+
return fe.set(n, d), d;
|
|
1076
1088
|
}
|
|
1077
1089
|
//#endregion
|
|
1078
1090
|
//#region src/scene/RoomStyle.ts
|
|
1079
|
-
function
|
|
1091
|
+
function he(e, t, n, r) {
|
|
1080
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;
|
|
1081
1093
|
return {
|
|
1082
1094
|
fillColor: a,
|
|
@@ -1086,7 +1098,7 @@ function _e(e, t, n, r) {
|
|
|
1086
1098
|
envColor: i
|
|
1087
1099
|
};
|
|
1088
1100
|
}
|
|
1089
|
-
function
|
|
1101
|
+
function ge(e, t) {
|
|
1090
1102
|
if (!t.emboss) return null;
|
|
1091
1103
|
let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a = y(e, .35), o = v(e, .45);
|
|
1092
1104
|
if (t.roomShape === "circle") {
|
|
@@ -1190,8 +1202,8 @@ function ve(e, t) {
|
|
|
1190
1202
|
}
|
|
1191
1203
|
//#endregion
|
|
1192
1204
|
//#region src/scene/elements/RoomLayout.ts
|
|
1193
|
-
function
|
|
1194
|
-
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;
|
|
1195
1207
|
if (f) {
|
|
1196
1208
|
let e = [v(a, .5), a], t = o * 2;
|
|
1197
1209
|
n.roomShape === "circle" ? l.push({
|
|
@@ -1275,7 +1287,7 @@ function ye(e, t, n, r) {
|
|
|
1275
1287
|
lineCap: u.highlight.lineCap,
|
|
1276
1288
|
lineJoin: u.shadow.lineJoin
|
|
1277
1289
|
})), e.roomChar) {
|
|
1278
|
-
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;
|
|
1279
1291
|
l.push({
|
|
1280
1292
|
type: "text",
|
|
1281
1293
|
x: -o,
|
|
@@ -1308,13 +1320,13 @@ function ye(e, t, n, r) {
|
|
|
1308
1320
|
}
|
|
1309
1321
|
//#endregion
|
|
1310
1322
|
//#region src/scene/InnerExitStyle.ts
|
|
1311
|
-
var
|
|
1323
|
+
var ve = [
|
|
1312
1324
|
"up",
|
|
1313
1325
|
"down",
|
|
1314
1326
|
"in",
|
|
1315
1327
|
"out"
|
|
1316
1328
|
];
|
|
1317
|
-
function
|
|
1329
|
+
function ye(e, t, n, r) {
|
|
1318
1330
|
let i = r * Math.PI / 180, a = [];
|
|
1319
1331
|
for (let r = 0; r < 3; r++) {
|
|
1320
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);
|
|
@@ -1322,87 +1334,57 @@ function R(e, t, n, r) {
|
|
|
1322
1334
|
}
|
|
1323
1335
|
return a;
|
|
1324
1336
|
}
|
|
1325
|
-
function
|
|
1337
|
+
function be(e, t, n) {
|
|
1326
1338
|
let r = e.userData?.["system.fallback_symbol_color"];
|
|
1327
1339
|
return {
|
|
1328
1340
|
symbolColor: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env)),
|
|
1329
1341
|
symbolFill: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6))
|
|
1330
1342
|
};
|
|
1331
1343
|
}
|
|
1332
|
-
var
|
|
1344
|
+
var xe = {
|
|
1333
1345
|
1: "rgb(10, 155, 10)",
|
|
1334
1346
|
2: "rgb(226, 205, 59)",
|
|
1335
1347
|
3: "rgb(155, 10, 10)"
|
|
1336
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
|
+
}
|
|
1337
1375
|
function Ce(e, t, n) {
|
|
1338
|
-
let r = [],
|
|
1339
|
-
for (let t of
|
|
1376
|
+
let r = [], { symbolColor: i, symbolFill: a } = be(e, t, n);
|
|
1377
|
+
for (let t of ve) {
|
|
1340
1378
|
if (!e.exits[t]) continue;
|
|
1341
|
-
let
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
stroke: l,
|
|
1351
|
-
strokeWidth: n.lineWidth
|
|
1352
|
-
});
|
|
1353
|
-
break;
|
|
1354
|
-
}
|
|
1355
|
-
case "down": {
|
|
1356
|
-
let t = P(e.x, e.y, "north", i / 4);
|
|
1357
|
-
r.push({
|
|
1358
|
-
cx: t.x,
|
|
1359
|
-
cy: t.y,
|
|
1360
|
-
vertices: R(t.x, t.y, a, 180),
|
|
1361
|
-
fill: s,
|
|
1362
|
-
stroke: l,
|
|
1363
|
-
strokeWidth: n.lineWidth
|
|
1364
|
-
});
|
|
1365
|
-
break;
|
|
1366
|
-
}
|
|
1367
|
-
case "in": {
|
|
1368
|
-
let t = P(e.x, e.y, "west", i / 4), o = P(e.x, e.y, "east", i / 4);
|
|
1369
|
-
r.push({
|
|
1370
|
-
cx: t.x,
|
|
1371
|
-
cy: t.y,
|
|
1372
|
-
vertices: R(t.x, t.y, a, 90),
|
|
1373
|
-
fill: s,
|
|
1374
|
-
stroke: l,
|
|
1375
|
-
strokeWidth: n.lineWidth
|
|
1376
|
-
}), r.push({
|
|
1377
|
-
cx: o.x,
|
|
1378
|
-
cy: o.y,
|
|
1379
|
-
vertices: R(o.x, o.y, a, -90),
|
|
1380
|
-
fill: s,
|
|
1381
|
-
stroke: l,
|
|
1382
|
-
strokeWidth: n.lineWidth
|
|
1383
|
-
});
|
|
1384
|
-
break;
|
|
1385
|
-
}
|
|
1386
|
-
case "out": {
|
|
1387
|
-
let t = P(e.x, e.y, "west", i / 4), o = P(e.x, e.y, "east", i / 4);
|
|
1388
|
-
r.push({
|
|
1389
|
-
cx: t.x,
|
|
1390
|
-
cy: t.y,
|
|
1391
|
-
vertices: R(t.x, t.y, a, -90),
|
|
1392
|
-
fill: s,
|
|
1393
|
-
stroke: l,
|
|
1394
|
-
strokeWidth: n.lineWidth
|
|
1395
|
-
}), r.push({
|
|
1396
|
-
cx: o.x,
|
|
1397
|
-
cy: o.y,
|
|
1398
|
-
vertices: R(o.x, o.y, a, 90),
|
|
1399
|
-
fill: s,
|
|
1400
|
-
stroke: l,
|
|
1401
|
-
strokeWidth: n.lineWidth
|
|
1402
|
-
});
|
|
1403
|
-
break;
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
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
|
+
});
|
|
1406
1388
|
}
|
|
1407
1389
|
return { triangles: r };
|
|
1408
1390
|
}
|
|
@@ -1674,9 +1656,9 @@ function Pe(e, t) {
|
|
|
1674
1656
|
}
|
|
1675
1657
|
return r;
|
|
1676
1658
|
}
|
|
1677
|
-
var
|
|
1659
|
+
var B = class {
|
|
1678
1660
|
constructor(e, t) {
|
|
1679
|
-
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);
|
|
1680
1662
|
}
|
|
1681
1663
|
buildScene(e, t, n, r = C) {
|
|
1682
1664
|
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.renderLabels(t.getLabels(), e.getAreaId());
|
|
@@ -1715,9 +1697,9 @@ var z = class {
|
|
|
1715
1697
|
renderRooms(e, t) {
|
|
1716
1698
|
let n = /* @__PURE__ */ new Map(), r = [], i = [], a = [], o = [];
|
|
1717
1699
|
e.forEach((e) => {
|
|
1718
|
-
let t =
|
|
1700
|
+
let t = _e(e, this.mapReader, this.settings, { flatPipeline: !0 });
|
|
1719
1701
|
t.children.push(...we(e, this.mapReader, this.settings));
|
|
1720
|
-
for (let t of
|
|
1702
|
+
for (let t of le(e, this.settings)) {
|
|
1721
1703
|
let n = De(t, e.id);
|
|
1722
1704
|
this.linkShapes.push(n);
|
|
1723
1705
|
let r = t.line.points, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
|
|
@@ -1763,7 +1745,7 @@ var z = class {
|
|
|
1763
1745
|
arrowColor: e.arrowColor
|
|
1764
1746
|
});
|
|
1765
1747
|
});
|
|
1766
|
-
for (let t of
|
|
1748
|
+
for (let t of se(e, this.settings)) {
|
|
1767
1749
|
let e = Oe(t);
|
|
1768
1750
|
this.linkShapes.push(e), a.push({
|
|
1769
1751
|
roomId: t.roomId,
|
|
@@ -1851,8 +1833,8 @@ var z = class {
|
|
|
1851
1833
|
let i = r.isVisible(t);
|
|
1852
1834
|
if (i === r.isVisible(n)) return;
|
|
1853
1835
|
let a = i ? t : n, o = i ? e.aDir : e.bDir;
|
|
1854
|
-
if (!o || !k.includes(o) || a.customLines[
|
|
1855
|
-
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);
|
|
1856
1838
|
return {
|
|
1857
1839
|
roomId: a.id,
|
|
1858
1840
|
direction: o,
|
|
@@ -1877,7 +1859,7 @@ var z = class {
|
|
|
1877
1859
|
});
|
|
1878
1860
|
}
|
|
1879
1861
|
getRoomEdgePoint(e, t, n, r) {
|
|
1880
|
-
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);
|
|
1881
1863
|
}
|
|
1882
1864
|
buildExitShape(e) {
|
|
1883
1865
|
return Te(e);
|
|
@@ -1951,40 +1933,40 @@ var z = class {
|
|
|
1951
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);
|
|
1952
1934
|
a > D && (D = a);
|
|
1953
1935
|
}
|
|
1954
|
-
let O = D > 3, ee = w / C >= .4, k = n?.x ?? (O ? (m + _) / 2 : o / C),
|
|
1955
|
-
for (let [e, t] of S) t >
|
|
1956
|
-
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 = [];
|
|
1957
1939
|
if (ee) {
|
|
1958
|
-
let e =
|
|
1959
|
-
|
|
1940
|
+
let e = P(T, E);
|
|
1941
|
+
F.push({
|
|
1960
1942
|
x: k + T * e,
|
|
1961
|
-
y:
|
|
1943
|
+
y: A + E * e
|
|
1962
1944
|
});
|
|
1963
1945
|
}
|
|
1964
|
-
|
|
1946
|
+
F.push({
|
|
1965
1947
|
x: k,
|
|
1966
|
-
y:
|
|
1948
|
+
y: A
|
|
1967
1949
|
});
|
|
1968
1950
|
for (let e of [
|
|
1969
1951
|
0,
|
|
1970
1952
|
.6,
|
|
1971
1953
|
1.4
|
|
1972
1954
|
]) for (let [t, n] of b) {
|
|
1973
|
-
let r =
|
|
1974
|
-
|
|
1955
|
+
let r = P(t, n, e);
|
|
1956
|
+
F.push({
|
|
1975
1957
|
x: k + t * r,
|
|
1976
|
-
y:
|
|
1958
|
+
y: A + n * r
|
|
1977
1959
|
});
|
|
1978
1960
|
}
|
|
1979
|
-
for (let t of
|
|
1961
|
+
for (let t of F) {
|
|
1980
1962
|
let n = t.x - i / 2, r = t.y - a / 2;
|
|
1981
|
-
if (!y(n, r, i, a,
|
|
1963
|
+
if (!y(n, r, i, a, N)) return {
|
|
1982
1964
|
cluster: e,
|
|
1983
1965
|
boxX: n,
|
|
1984
1966
|
boxY: r,
|
|
1985
1967
|
boxW: i,
|
|
1986
1968
|
boxH: a,
|
|
1987
|
-
color:
|
|
1969
|
+
color: j
|
|
1988
1970
|
};
|
|
1989
1971
|
}
|
|
1990
1972
|
};
|
|
@@ -2177,7 +2159,7 @@ var ze = {
|
|
|
2177
2159
|
topLabel: []
|
|
2178
2160
|
}, Be = class {
|
|
2179
2161
|
constructor(e, t, n) {
|
|
2180
|
-
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);
|
|
2181
2163
|
}
|
|
2182
2164
|
get exitRenderer() {
|
|
2183
2165
|
return this.pipeline.exitRenderer;
|
|
@@ -2210,7 +2192,7 @@ var ze = {
|
|
|
2210
2192
|
this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
|
|
2211
2193
|
}
|
|
2212
2194
|
resetPipeline(e) {
|
|
2213
|
-
this.pipeline = new
|
|
2195
|
+
this.pipeline = new B(e, this.settings), this.reset();
|
|
2214
2196
|
}
|
|
2215
2197
|
cullInteractive(e = O) {
|
|
2216
2198
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
@@ -2255,10 +2237,12 @@ var ze = {
|
|
|
2255
2237
|
}
|
|
2256
2238
|
initViewportEvents() {
|
|
2257
2239
|
let e = this.container, t = this.camera, n = 1.1, r = () => {
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2240
|
+
t.batch(() => {
|
|
2241
|
+
if (t.setSize(e.clientWidth, e.clientHeight), t.centerOnResize && this.state.positionRoomId) {
|
|
2242
|
+
let e = this.state.mapReader.getRoom(this.state.positionRoomId);
|
|
2243
|
+
e && t.panToMapPoint(e.x, e.y);
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2262
2246
|
};
|
|
2263
2247
|
typeof window < "u" && this.listen(window, "resize", r), this.listen(e, "resize", r);
|
|
2264
2248
|
let i = !1, a;
|
|
@@ -2572,7 +2556,7 @@ var Ue = class {
|
|
|
2572
2556
|
ensureShape() {
|
|
2573
2557
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2574
2558
|
}
|
|
2575
|
-
},
|
|
2559
|
+
}, V = class {
|
|
2576
2560
|
constructor(e) {
|
|
2577
2561
|
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
2578
2562
|
let t = this;
|
|
@@ -2726,20 +2710,20 @@ function Xe(e) {
|
|
|
2726
2710
|
}
|
|
2727
2711
|
//#endregion
|
|
2728
2712
|
//#region src/PathData.ts
|
|
2729
|
-
var
|
|
2713
|
+
var H = [
|
|
2730
2714
|
"up",
|
|
2731
2715
|
"down",
|
|
2732
2716
|
"in",
|
|
2733
2717
|
"out"
|
|
2734
2718
|
];
|
|
2735
|
-
function
|
|
2736
|
-
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);
|
|
2737
2721
|
}
|
|
2738
|
-
function
|
|
2722
|
+
function Qe(e, t, n) {
|
|
2739
2723
|
for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
|
|
2740
2724
|
let r = e;
|
|
2741
|
-
if (
|
|
2742
|
-
let e =
|
|
2725
|
+
if (H.includes(r)) {
|
|
2726
|
+
let e = j[r];
|
|
2743
2727
|
return {
|
|
2744
2728
|
type: "inner",
|
|
2745
2729
|
fromDir: r,
|
|
@@ -2748,7 +2732,7 @@ function Ze(e, t, n) {
|
|
|
2748
2732
|
toRoom: n
|
|
2749
2733
|
};
|
|
2750
2734
|
}
|
|
2751
|
-
let i =
|
|
2735
|
+
let i = j[r];
|
|
2752
2736
|
return t.customLines[i] ? {
|
|
2753
2737
|
type: "special",
|
|
2754
2738
|
fromDir: r,
|
|
@@ -2764,7 +2748,7 @@ function Ze(e, t, n) {
|
|
|
2764
2748
|
} : {
|
|
2765
2749
|
type: "regular",
|
|
2766
2750
|
fromDir: r,
|
|
2767
|
-
toDir:
|
|
2751
|
+
toDir: $e(n, t.id),
|
|
2768
2752
|
fromRoom: t,
|
|
2769
2753
|
toRoom: n
|
|
2770
2754
|
};
|
|
@@ -2781,8 +2765,8 @@ function Ze(e, t, n) {
|
|
|
2781
2765
|
};
|
|
2782
2766
|
for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
|
|
2783
2767
|
let r = e;
|
|
2784
|
-
if (
|
|
2785
|
-
let e =
|
|
2768
|
+
if (H.includes(r)) {
|
|
2769
|
+
let e = j[r];
|
|
2786
2770
|
return {
|
|
2787
2771
|
type: "inner",
|
|
2788
2772
|
toDir: r,
|
|
@@ -2791,7 +2775,7 @@ function Ze(e, t, n) {
|
|
|
2791
2775
|
toRoom: n
|
|
2792
2776
|
};
|
|
2793
2777
|
}
|
|
2794
|
-
let i =
|
|
2778
|
+
let i = j[r];
|
|
2795
2779
|
return n.customLines[i] ? {
|
|
2796
2780
|
type: "special",
|
|
2797
2781
|
toDir: r,
|
|
@@ -2827,39 +2811,39 @@ function Ze(e, t, n) {
|
|
|
2827
2811
|
toRoom: n
|
|
2828
2812
|
};
|
|
2829
2813
|
}
|
|
2830
|
-
function
|
|
2814
|
+
function $e(e, t) {
|
|
2831
2815
|
for (let [n, r] of Object.entries(e.exits)) if (r === t) return n;
|
|
2832
2816
|
}
|
|
2833
|
-
function
|
|
2817
|
+
function et(e, t, n) {
|
|
2834
2818
|
return e ? e.area === t && e.z === n : !1;
|
|
2835
2819
|
}
|
|
2836
|
-
function
|
|
2820
|
+
function tt(e, t) {
|
|
2837
2821
|
for (let [n, r] of Object.entries(e.exits)) if (r === t.id) return { direction: n };
|
|
2838
2822
|
for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
|
|
2839
2823
|
}
|
|
2840
|
-
function
|
|
2841
|
-
for (let n of
|
|
2842
|
-
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];
|
|
2843
2827
|
}
|
|
2844
|
-
function
|
|
2828
|
+
function rt(e, t, n) {
|
|
2845
2829
|
let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
|
|
2846
2830
|
if (n.length === 0 && n.push(r.x, r.y), a && k.includes(a)) {
|
|
2847
|
-
let t =
|
|
2831
|
+
let t = Ze(e, r.x, r.y, a, e.roomSize / 2);
|
|
2848
2832
|
n.push(t.x, t.y);
|
|
2849
2833
|
}
|
|
2850
2834
|
if (o && k.includes(o)) {
|
|
2851
|
-
let t =
|
|
2835
|
+
let t = Ze(e, i.x, i.y, o, e.roomSize / 2);
|
|
2852
2836
|
n.push(t.x, t.y);
|
|
2853
2837
|
}
|
|
2854
2838
|
n.push(i.x, i.y);
|
|
2855
2839
|
}
|
|
2856
|
-
function
|
|
2840
|
+
function it(e, t) {
|
|
2857
2841
|
let { fromRoom: n, toRoom: r, customLineKey: i } = e, a = n, o;
|
|
2858
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) => {
|
|
2859
2843
|
t.push(e.x, -e.y);
|
|
2860
2844
|
}), t.push(r.x, r.y);
|
|
2861
2845
|
}
|
|
2862
|
-
function
|
|
2846
|
+
function at(e, t, n, r, i) {
|
|
2863
2847
|
let a = [], o = [], s = [], c = n.map((t) => e.getRoom(t)).filter((e) => e !== void 0), l = [], u = () => {
|
|
2864
2848
|
l.length >= 4 && a.push({ points: [...l] }), l = [];
|
|
2865
2849
|
}, d = (e) => {
|
|
@@ -2873,28 +2857,28 @@ function it(e, t, n, r, i) {
|
|
|
2873
2857
|
}), s.push({ points: t });
|
|
2874
2858
|
}
|
|
2875
2859
|
}
|
|
2876
|
-
r &&
|
|
2860
|
+
r && H.includes(r) && o.push({
|
|
2877
2861
|
room: t,
|
|
2878
2862
|
direction: r
|
|
2879
|
-
}), i &&
|
|
2863
|
+
}), i && H.includes(i) && o.push({
|
|
2880
2864
|
room: n,
|
|
2881
2865
|
direction: i
|
|
2882
2866
|
});
|
|
2883
2867
|
};
|
|
2884
2868
|
for (let n = 0; n < c.length - 1; n++) {
|
|
2885
|
-
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);
|
|
2886
2870
|
if (!f && !p) {
|
|
2887
2871
|
u();
|
|
2888
2872
|
continue;
|
|
2889
2873
|
}
|
|
2890
2874
|
if (f && p) {
|
|
2891
|
-
let n =
|
|
2875
|
+
let n = Qe(e, a, s);
|
|
2892
2876
|
switch (n.type) {
|
|
2893
2877
|
case "regular":
|
|
2894
|
-
|
|
2878
|
+
rt(t, n, l);
|
|
2895
2879
|
break;
|
|
2896
2880
|
case "special":
|
|
2897
|
-
|
|
2881
|
+
it(n, l);
|
|
2898
2882
|
break;
|
|
2899
2883
|
case "inner":
|
|
2900
2884
|
u(), d(n);
|
|
@@ -2904,22 +2888,22 @@ function it(e, t, n, r, i) {
|
|
|
2904
2888
|
break;
|
|
2905
2889
|
}
|
|
2906
2890
|
} else {
|
|
2907
|
-
let e = f ? a : s, n = f ? s : a, r =
|
|
2891
|
+
let e = f ? a : s, n = f ? s : a, r = tt(e, n);
|
|
2908
2892
|
if (r) {
|
|
2909
|
-
if (
|
|
2893
|
+
if (H.includes(r.direction)) u(), o.push({
|
|
2910
2894
|
room: e,
|
|
2911
2895
|
direction: r.direction
|
|
2912
2896
|
});
|
|
2913
2897
|
else if (k.includes(r.direction)) {
|
|
2914
2898
|
l.length === 0 && l.push(e.x, e.y);
|
|
2915
|
-
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);
|
|
2916
2900
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2917
2901
|
}
|
|
2918
2902
|
} else {
|
|
2919
|
-
let r =
|
|
2903
|
+
let r = nt(e, n);
|
|
2920
2904
|
if (r) {
|
|
2921
2905
|
l.length === 0 && l.push(e.x, e.y);
|
|
2922
|
-
let n =
|
|
2906
|
+
let n = Ze(t, e.x, e.y, r, t.roomSize / 2), i = I(e.x, e.y, r, t.roomSize);
|
|
2923
2907
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2924
2908
|
}
|
|
2925
2909
|
}
|
|
@@ -2933,7 +2917,7 @@ function it(e, t, n, r, i) {
|
|
|
2933
2917
|
}
|
|
2934
2918
|
//#endregion
|
|
2935
2919
|
//#region src/scene/OverlayStyle.ts
|
|
2936
|
-
function
|
|
2920
|
+
function ot(e, t, n) {
|
|
2937
2921
|
let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = r.matchRoomShape && n.roomShape !== "circle";
|
|
2938
2922
|
return {
|
|
2939
2923
|
shape: o ? "rect" : "circle",
|
|
@@ -2950,7 +2934,7 @@ function at(e, t, n) {
|
|
|
2950
2934
|
dashEnabled: r.dashEnabled
|
|
2951
2935
|
};
|
|
2952
2936
|
}
|
|
2953
|
-
function
|
|
2937
|
+
function st(e, t) {
|
|
2954
2938
|
let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
|
|
2955
2939
|
return {
|
|
2956
2940
|
shape: i ? "rect" : "circle",
|
|
@@ -2967,18 +2951,15 @@ function ot(e, t) {
|
|
|
2967
2951
|
dashEnabled: n.dashEnabled
|
|
2968
2952
|
};
|
|
2969
2953
|
}
|
|
2970
|
-
function
|
|
2971
|
-
let o =
|
|
2972
|
-
for (let e of o.segments) e.points.length >= 4 &&
|
|
2973
|
-
for (let e of o.customLines) e.points.length >= 4 &&
|
|
2974
|
-
let
|
|
2975
|
-
for (let e of o.innerMarkers) {
|
|
2976
|
-
let t = e.direction === "up" ? 0 : e.direction === "down" ? 180 : e.direction === "in" ? 90 : -90;
|
|
2977
|
-
u.push({ vertices: R(e.room.x, e.room.y, c, t) });
|
|
2978
|
-
}
|
|
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 });
|
|
2979
2960
|
return {
|
|
2980
|
-
segments:
|
|
2981
|
-
triangles:
|
|
2961
|
+
segments: c,
|
|
2962
|
+
triangles: l,
|
|
2982
2963
|
color: r,
|
|
2983
2964
|
outlineWidth: s * 8,
|
|
2984
2965
|
lineWidth: s * 4
|
|
@@ -2986,7 +2967,7 @@ function st(e, t, n, r, i, a) {
|
|
|
2986
2967
|
}
|
|
2987
2968
|
//#endregion
|
|
2988
2969
|
//#region src/scene/elements/OverlayLayout.ts
|
|
2989
|
-
function
|
|
2970
|
+
function lt(e) {
|
|
2990
2971
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
2991
2972
|
if (e.shape === "circle") return {
|
|
2992
2973
|
type: "circle",
|
|
@@ -3058,7 +3039,7 @@ function ct(e) {
|
|
|
3058
3039
|
layer: "overlay"
|
|
3059
3040
|
};
|
|
3060
3041
|
}
|
|
3061
|
-
function
|
|
3042
|
+
function ut(e) {
|
|
3062
3043
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
3063
3044
|
return e.shape === "circle" ? {
|
|
3064
3045
|
type: "circle",
|
|
@@ -3090,7 +3071,7 @@ function lt(e) {
|
|
|
3090
3071
|
layer: "overlay"
|
|
3091
3072
|
};
|
|
3092
3073
|
}
|
|
3093
|
-
function
|
|
3074
|
+
function dt(e) {
|
|
3094
3075
|
let t = [];
|
|
3095
3076
|
for (let n of e.segments) t.push({
|
|
3096
3077
|
type: "line",
|
|
@@ -3129,29 +3110,29 @@ function ut(e) {
|
|
|
3129
3110
|
}
|
|
3130
3111
|
//#endregion
|
|
3131
3112
|
//#region src/hit/HitTester.ts
|
|
3132
|
-
var
|
|
3113
|
+
var ft = {
|
|
3133
3114
|
areaExit: 110,
|
|
3134
3115
|
room: 100,
|
|
3135
3116
|
label: 80,
|
|
3136
3117
|
specialExit: 60,
|
|
3137
3118
|
exit: 40,
|
|
3138
3119
|
stub: 20
|
|
3139
|
-
},
|
|
3120
|
+
}, pt = {
|
|
3140
3121
|
room: .3,
|
|
3141
3122
|
areaExit: 1,
|
|
3142
3123
|
label: 1,
|
|
3143
3124
|
specialExit: .5,
|
|
3144
3125
|
exit: .35,
|
|
3145
3126
|
stub: .3
|
|
3146
|
-
},
|
|
3127
|
+
}, mt = (e, t) => ({
|
|
3147
3128
|
x: e,
|
|
3148
3129
|
y: t
|
|
3149
|
-
}),
|
|
3130
|
+
}), ht = class {
|
|
3150
3131
|
constructor() {
|
|
3151
|
-
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;
|
|
3152
3133
|
}
|
|
3153
3134
|
build(e, t, n) {
|
|
3154
|
-
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);
|
|
3155
3136
|
}
|
|
3156
3137
|
clear() {
|
|
3157
3138
|
this.entries = [], this.spatialIndex.clear();
|
|
@@ -3195,13 +3176,13 @@ var dt = {
|
|
|
3195
3176
|
forEachCandidate(e, t, n) {
|
|
3196
3177
|
let r = Math.floor(e / this.bucketSize), i = Math.floor(t / this.bucketSize), a = /* @__PURE__ */ new Set();
|
|
3197
3178
|
for (let o = -1; o <= 1; o++) for (let s = -1; s <= 1; s++) {
|
|
3198
|
-
let c = this.spatialIndex.get(
|
|
3179
|
+
let c = this.spatialIndex.get(wt(r + o, i + s));
|
|
3199
3180
|
if (c) for (let r of c) {
|
|
3200
3181
|
if (a.has(r)) continue;
|
|
3201
3182
|
a.add(r);
|
|
3202
3183
|
let i = r.margin * this.roomSize;
|
|
3203
3184
|
if (e < r.rMinX - i || e > r.rMaxX + i || t < r.rMinY - i || t > r.rMaxY + i) continue;
|
|
3204
|
-
let o =
|
|
3185
|
+
let o = yt(r, e, t);
|
|
3205
3186
|
o > i || n(r, o);
|
|
3206
3187
|
}
|
|
3207
3188
|
}
|
|
@@ -3220,14 +3201,14 @@ var dt = {
|
|
|
3220
3201
|
collectHitShapes(e, t, n) {
|
|
3221
3202
|
for (let r of e) {
|
|
3222
3203
|
if (r.hit) {
|
|
3223
|
-
let e = [], i =
|
|
3224
|
-
|
|
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);
|
|
3225
3206
|
}
|
|
3226
3207
|
r.type === "group" && this.collectHitShapes(r.children, t + r.x, n + r.y);
|
|
3227
3208
|
}
|
|
3228
3209
|
}
|
|
3229
3210
|
indexEntry(e, t, n) {
|
|
3230
|
-
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 = {
|
|
3231
3212
|
info: n,
|
|
3232
3213
|
margin: r,
|
|
3233
3214
|
priority: i,
|
|
@@ -3242,12 +3223,12 @@ var dt = {
|
|
|
3242
3223
|
this.entries.push(s);
|
|
3243
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);
|
|
3244
3225
|
for (let e = l; e <= u; e++) for (let t = d; t <= f; t++) {
|
|
3245
|
-
let n =
|
|
3226
|
+
let n = wt(e, t), r = this.spatialIndex.get(n);
|
|
3246
3227
|
r || (r = [], this.spatialIndex.set(n, r)), r.push(s);
|
|
3247
3228
|
}
|
|
3248
3229
|
}
|
|
3249
3230
|
};
|
|
3250
|
-
function
|
|
3231
|
+
function gt() {
|
|
3251
3232
|
return {
|
|
3252
3233
|
minX: Infinity,
|
|
3253
3234
|
minY: Infinity,
|
|
@@ -3258,14 +3239,14 @@ function ht() {
|
|
|
3258
3239
|
function U(e, t, n) {
|
|
3259
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);
|
|
3260
3241
|
}
|
|
3261
|
-
function
|
|
3242
|
+
function _t(e, t, n, r, i, a) {
|
|
3262
3243
|
if (e.type === "group") {
|
|
3263
|
-
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);
|
|
3264
3245
|
return;
|
|
3265
3246
|
}
|
|
3266
|
-
|
|
3247
|
+
vt(e, t, n, r, i, a);
|
|
3267
3248
|
}
|
|
3268
|
-
function
|
|
3249
|
+
function vt(e, t, n, r, i, a) {
|
|
3269
3250
|
switch (e.type) {
|
|
3270
3251
|
case "rect":
|
|
3271
3252
|
case "image": {
|
|
@@ -3349,42 +3330,42 @@ function _t(e, t, n, r, i, a) {
|
|
|
3349
3330
|
return;
|
|
3350
3331
|
}
|
|
3351
3332
|
case "group":
|
|
3352
|
-
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);
|
|
3353
3334
|
return;
|
|
3354
3335
|
}
|
|
3355
3336
|
}
|
|
3356
|
-
function
|
|
3337
|
+
function yt(e, t, n) {
|
|
3357
3338
|
let r = Infinity;
|
|
3358
3339
|
for (let i of e.geoms) {
|
|
3359
|
-
let e =
|
|
3340
|
+
let e = bt(i, t, n);
|
|
3360
3341
|
if (e < r && (r = e), r === 0) return 0;
|
|
3361
3342
|
}
|
|
3362
3343
|
return r;
|
|
3363
3344
|
}
|
|
3364
|
-
function
|
|
3345
|
+
function bt(e, t, n) {
|
|
3365
3346
|
if (e.type === "circle") {
|
|
3366
3347
|
let r = t - e.cx, i = n - e.cy;
|
|
3367
3348
|
return Math.max(0, Math.hypot(r, i) - e.r);
|
|
3368
3349
|
}
|
|
3369
|
-
return e.closed &&
|
|
3350
|
+
return e.closed && Ct(e.pts, t, n) ? 0 : xt(e.pts, t, n, e.closed);
|
|
3370
3351
|
}
|
|
3371
|
-
function
|
|
3352
|
+
function xt(e, t, n, r) {
|
|
3372
3353
|
let i = e.length / 2;
|
|
3373
3354
|
if (i < 2) return i === 1 ? Math.hypot(t - e[0], n - e[1]) : Infinity;
|
|
3374
3355
|
let a = Infinity, o = r ? i : i - 1;
|
|
3375
3356
|
for (let r = 0; r < o; r++) {
|
|
3376
|
-
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]);
|
|
3377
3358
|
c < a && (a = c);
|
|
3378
3359
|
}
|
|
3379
3360
|
return a;
|
|
3380
3361
|
}
|
|
3381
|
-
function
|
|
3362
|
+
function St(e, t, n, r, i, a) {
|
|
3382
3363
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : ((e - n) * o + (t - r) * s) / c;
|
|
3383
3364
|
l < 0 ? l = 0 : l > 1 && (l = 1);
|
|
3384
3365
|
let u = n + l * o, d = r + l * s;
|
|
3385
3366
|
return Math.hypot(e - u, t - d);
|
|
3386
3367
|
}
|
|
3387
|
-
function
|
|
3368
|
+
function Ct(e, t, n) {
|
|
3388
3369
|
let r = !1, i = e.length / 2;
|
|
3389
3370
|
for (let a = 0, o = i - 1; a < i; o = a++) {
|
|
3390
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;
|
|
@@ -3392,13 +3373,13 @@ function St(e, t, n) {
|
|
|
3392
3373
|
}
|
|
3393
3374
|
return r;
|
|
3394
3375
|
}
|
|
3395
|
-
function
|
|
3376
|
+
function wt(e, t) {
|
|
3396
3377
|
return e * 1000003 + t;
|
|
3397
3378
|
}
|
|
3398
3379
|
//#endregion
|
|
3399
3380
|
//#region src/style/Style.ts
|
|
3400
3381
|
var W = { transform: (e) => e };
|
|
3401
|
-
function
|
|
3382
|
+
function Tt(...e) {
|
|
3402
3383
|
return e.length === 0 ? W : e.length === 1 ? e[0] : {
|
|
3403
3384
|
transform(t, n) {
|
|
3404
3385
|
let r = [t];
|
|
@@ -3438,16 +3419,16 @@ function wt(...e) {
|
|
|
3438
3419
|
function G(e, t, n) {
|
|
3439
3420
|
let r = [];
|
|
3440
3421
|
for (let i of e) {
|
|
3441
|
-
let e =
|
|
3422
|
+
let e = Et(i, t, n);
|
|
3442
3423
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3443
3424
|
}
|
|
3444
3425
|
return r;
|
|
3445
3426
|
}
|
|
3446
|
-
function
|
|
3427
|
+
function Et(e, t, n) {
|
|
3447
3428
|
if (e.type === "group") {
|
|
3448
3429
|
let r = [];
|
|
3449
3430
|
for (let i of e.children) {
|
|
3450
|
-
let e =
|
|
3431
|
+
let e = Et(i, t, n);
|
|
3451
3432
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3452
3433
|
}
|
|
3453
3434
|
return t.transform({
|
|
@@ -3459,12 +3440,12 @@ function Tt(e, t, n) {
|
|
|
3459
3440
|
}
|
|
3460
3441
|
//#endregion
|
|
3461
3442
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
3462
|
-
var K = "rgb(120, 72, 0)",
|
|
3443
|
+
var K = "rgb(120, 72, 0)", Dt = class {
|
|
3463
3444
|
get coordinateTransform() {
|
|
3464
3445
|
return this._coordinateTransform;
|
|
3465
3446
|
}
|
|
3466
3447
|
constructor(e, t) {
|
|
3467
|
-
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({
|
|
3468
3449
|
container: t,
|
|
3469
3450
|
width: t.clientWidth,
|
|
3470
3451
|
height: t.clientHeight,
|
|
@@ -3474,7 +3455,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3474
3455
|
height: 1
|
|
3475
3456
|
}), this.camera = new D(1, 1)), this.gridLayer = new r.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
3476
3457
|
let n = new r.Layer({ listening: !1 });
|
|
3477
|
-
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new r.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new r.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new r.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Ge(this.positionLayer), this.overlayLayerNode = new Ge(this.overlayLayer), this.sceneNode = new We(n), this.gridLayerNode = new
|
|
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) {
|
|
3478
3459
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
3479
3460
|
let n = this.origSetSize;
|
|
3480
3461
|
this.camera.setSize = (e, t) => {
|
|
@@ -3487,7 +3468,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3487
3468
|
this.applyStyleTransforms(), this.subscribeToState(e);
|
|
3488
3469
|
}
|
|
3489
3470
|
setStyle(e) {
|
|
3490
|
-
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();
|
|
3491
3472
|
}
|
|
3492
3473
|
applyStyleTransforms() {
|
|
3493
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;
|
|
@@ -3717,8 +3698,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3717
3698
|
}
|
|
3718
3699
|
applyPositionMarker(e) {
|
|
3719
3700
|
this.positionMarker && this.positionMarker.destroy();
|
|
3720
|
-
let t =
|
|
3721
|
-
this.positionMarker = this.addStyledShape(
|
|
3701
|
+
let t = st(e, this.state.settings);
|
|
3702
|
+
this.positionMarker = this.addStyledShape(ut(t), this.positionLayerNode);
|
|
3722
3703
|
}
|
|
3723
3704
|
clearCurrentRoomOverlay() {
|
|
3724
3705
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3740,8 +3721,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3740
3721
|
let t = i.renderDataWithColor(e, K, this.state.currentZIndex);
|
|
3741
3722
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3742
3723
|
});
|
|
3743
|
-
for (let n of
|
|
3744
|
-
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));
|
|
3745
3726
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3746
3727
|
let t = this.state.mapReader.getRoom(e);
|
|
3747
3728
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -3749,17 +3730,13 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3749
3730
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3750
3731
|
t && this.currentRoomOverlay.push(t);
|
|
3751
3732
|
}), n.forEach((n, r) => {
|
|
3752
|
-
let i = r === e.id, a =
|
|
3733
|
+
let i = r === e.id, a = _e(n, this.state.mapReader, t, {
|
|
3753
3734
|
strokeOverride: i ? K : t.lineColor,
|
|
3754
3735
|
flatPipeline: !0
|
|
3755
|
-
})
|
|
3736
|
+
});
|
|
3737
|
+
a.children.push(...we(n, this.state.mapReader, t));
|
|
3738
|
+
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
3756
3739
|
o && this.currentRoomOverlay.push(o);
|
|
3757
|
-
}), n.forEach((e) => {
|
|
3758
|
-
let n = we(e, this.state.mapReader, t);
|
|
3759
|
-
for (let e of n) {
|
|
3760
|
-
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3761
|
-
t && this.currentRoomOverlay.push(t);
|
|
3762
|
-
}
|
|
3763
3740
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
3764
3741
|
}
|
|
3765
3742
|
syncHighlight(e, t) {
|
|
@@ -3767,7 +3744,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3767
3744
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3768
3745
|
let n = this.state.mapReader.getRoom(e);
|
|
3769
3746
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3770
|
-
let r =
|
|
3747
|
+
let r = ot(n, t, this.state.settings), i = this.addStyledShape(lt(r), this.overlayLayerNode);
|
|
3771
3748
|
i && this.highlightShapes.set(e, i);
|
|
3772
3749
|
}
|
|
3773
3750
|
}
|
|
@@ -3780,7 +3757,7 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3780
3757
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3781
3758
|
let n = this.state.mapReader.getRoom(e);
|
|
3782
3759
|
if (!n) continue;
|
|
3783
|
-
let r =
|
|
3760
|
+
let r = ot(n, t.color, this.state.settings), i = this.addStyledShape(lt(r), this.overlayLayerNode);
|
|
3784
3761
|
i && this.highlightShapes.set(e, i);
|
|
3785
3762
|
}
|
|
3786
3763
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3790,8 +3767,8 @@ var K = "rgb(120, 72, 0)", Et = class {
|
|
|
3790
3767
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3791
3768
|
if (!(e === void 0 || t === void 0)) {
|
|
3792
3769
|
for (let n of this.state.paths) {
|
|
3793
|
-
let r =
|
|
3794
|
-
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)) {
|
|
3795
3772
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3796
3773
|
t && this.pathShapes.push(t);
|
|
3797
3774
|
}
|
|
@@ -3827,97 +3804,97 @@ function q(e) {
|
|
|
3827
3804
|
function J(e, t, n, r = 1) {
|
|
3828
3805
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3829
3806
|
}
|
|
3830
|
-
function
|
|
3807
|
+
function Ot(e) {
|
|
3831
3808
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3832
3809
|
}
|
|
3833
3810
|
//#endregion
|
|
3834
3811
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3835
|
-
var
|
|
3836
|
-
function
|
|
3812
|
+
var kt = "#4a3728", At = "#3b2a1a", jt = 139, Mt = 115, Nt = 85, Pt = 244, Ft = 228, It = 193;
|
|
3813
|
+
function Lt(e) {
|
|
3837
3814
|
let t = q(e);
|
|
3838
|
-
if (!t) return J(
|
|
3839
|
-
let n =
|
|
3840
|
-
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);
|
|
3841
3818
|
}
|
|
3842
|
-
function
|
|
3819
|
+
function Rt(e) {
|
|
3843
3820
|
let t = q(e);
|
|
3844
|
-
if (!t || t.a >= 1) return
|
|
3845
|
-
let n = q(
|
|
3821
|
+
if (!t || t.a >= 1) return kt;
|
|
3822
|
+
let n = q(kt);
|
|
3846
3823
|
return J(n.r, n.g, n.b, t.a);
|
|
3847
3824
|
}
|
|
3848
|
-
function
|
|
3825
|
+
function zt(e) {
|
|
3849
3826
|
return {
|
|
3850
3827
|
...e,
|
|
3851
|
-
fill: e.fill ?
|
|
3852
|
-
stroke: e.stroke ?
|
|
3828
|
+
fill: e.fill ? Lt(e.fill) : e.fill,
|
|
3829
|
+
stroke: e.stroke ? Rt(e.stroke) : e.stroke
|
|
3853
3830
|
};
|
|
3854
3831
|
}
|
|
3855
|
-
var
|
|
3832
|
+
var Bt = { transform(e) {
|
|
3856
3833
|
switch (e.type) {
|
|
3857
3834
|
case "rect":
|
|
3858
3835
|
case "circle":
|
|
3859
3836
|
case "polygon": return {
|
|
3860
3837
|
...e,
|
|
3861
|
-
paint:
|
|
3838
|
+
paint: zt(e.paint)
|
|
3862
3839
|
};
|
|
3863
3840
|
case "line": return {
|
|
3864
3841
|
...e,
|
|
3865
3842
|
paint: e.paint.stroke ? {
|
|
3866
3843
|
...e.paint,
|
|
3867
|
-
stroke:
|
|
3844
|
+
stroke: Rt(e.paint.stroke)
|
|
3868
3845
|
} : e.paint
|
|
3869
3846
|
};
|
|
3870
3847
|
case "text": return {
|
|
3871
3848
|
...e,
|
|
3872
|
-
fill:
|
|
3849
|
+
fill: At
|
|
3873
3850
|
};
|
|
3874
3851
|
case "image":
|
|
3875
3852
|
case "group": return e;
|
|
3876
3853
|
}
|
|
3877
|
-
} },
|
|
3878
|
-
function
|
|
3854
|
+
} }, Vt = "#c0deff", Ht = "#e0f0ff", Ut = 20, Wt = 40, Gt = 80, Kt = 60, qt = 100, Jt = 160;
|
|
3855
|
+
function Yt(e) {
|
|
3879
3856
|
let t = q(e);
|
|
3880
|
-
if (!t) return J(
|
|
3881
|
-
let n =
|
|
3882
|
-
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);
|
|
3883
3860
|
}
|
|
3884
|
-
function
|
|
3861
|
+
function Xt(e) {
|
|
3885
3862
|
let t = q(e);
|
|
3886
|
-
if (!t || t.a >= 1) return
|
|
3887
|
-
let n = q(
|
|
3863
|
+
if (!t || t.a >= 1) return Vt;
|
|
3864
|
+
let n = q(Vt);
|
|
3888
3865
|
return J(n.r, n.g, n.b, t.a);
|
|
3889
3866
|
}
|
|
3890
|
-
function
|
|
3867
|
+
function Zt(e) {
|
|
3891
3868
|
return {
|
|
3892
3869
|
...e,
|
|
3893
|
-
fill: e.fill ?
|
|
3894
|
-
stroke: e.stroke ?
|
|
3870
|
+
fill: e.fill ? Yt(e.fill) : e.fill,
|
|
3871
|
+
stroke: e.stroke ? Xt(e.stroke) : e.stroke
|
|
3895
3872
|
};
|
|
3896
3873
|
}
|
|
3897
|
-
var
|
|
3874
|
+
var Qt = { transform(e) {
|
|
3898
3875
|
switch (e.type) {
|
|
3899
3876
|
case "rect":
|
|
3900
3877
|
case "circle":
|
|
3901
3878
|
case "polygon": return {
|
|
3902
3879
|
...e,
|
|
3903
|
-
paint:
|
|
3880
|
+
paint: Zt(e.paint)
|
|
3904
3881
|
};
|
|
3905
3882
|
case "line": return {
|
|
3906
3883
|
...e,
|
|
3907
3884
|
paint: e.paint.stroke ? {
|
|
3908
3885
|
...e.paint,
|
|
3909
|
-
stroke:
|
|
3886
|
+
stroke: Xt(e.paint.stroke)
|
|
3910
3887
|
} : e.paint
|
|
3911
3888
|
};
|
|
3912
3889
|
case "text": return {
|
|
3913
3890
|
...e,
|
|
3914
|
-
fill:
|
|
3891
|
+
fill: Ht
|
|
3915
3892
|
};
|
|
3916
3893
|
case "image":
|
|
3917
3894
|
case "group": return e;
|
|
3918
3895
|
}
|
|
3919
|
-
} },
|
|
3920
|
-
function
|
|
3896
|
+
} }, $t = "#00ffd0", en = .3, tn = 3;
|
|
3897
|
+
function nn(e, t, n) {
|
|
3921
3898
|
e /= 255, t /= 255, n /= 255;
|
|
3922
3899
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3923
3900
|
if (r === i) return [
|
|
@@ -3932,68 +3909,68 @@ function tn(e, t, n) {
|
|
|
3932
3909
|
a
|
|
3933
3910
|
];
|
|
3934
3911
|
}
|
|
3935
|
-
function
|
|
3912
|
+
function rn(e, t, n, r = 1) {
|
|
3936
3913
|
e = (e % 360 + 360) % 360;
|
|
3937
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;
|
|
3938
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);
|
|
3939
3916
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3940
3917
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3941
3918
|
}
|
|
3942
|
-
function
|
|
3919
|
+
function an(e) {
|
|
3943
3920
|
let t = q(e);
|
|
3944
3921
|
if (!t) return {
|
|
3945
3922
|
h: 150,
|
|
3946
3923
|
a: 1
|
|
3947
3924
|
};
|
|
3948
|
-
let [n] =
|
|
3925
|
+
let [n] = nn(t.r, t.g, t.b);
|
|
3949
3926
|
return {
|
|
3950
3927
|
h: n,
|
|
3951
3928
|
a: t.a
|
|
3952
3929
|
};
|
|
3953
3930
|
}
|
|
3954
|
-
function an(e) {
|
|
3955
|
-
let { h: t, a: n } = rn(e);
|
|
3956
|
-
return nn(t, .95, .65, n);
|
|
3957
|
-
}
|
|
3958
3931
|
function on(e) {
|
|
3959
|
-
let t =
|
|
3960
|
-
|
|
3961
|
-
let [n] = tn(t.r, t.g, t.b);
|
|
3962
|
-
return nn(n, .4, .1, t.a);
|
|
3932
|
+
let { h: t, a: n } = an(e);
|
|
3933
|
+
return rn(t, .95, .65, n);
|
|
3963
3934
|
}
|
|
3964
3935
|
function sn(e) {
|
|
3965
|
-
let
|
|
3966
|
-
|
|
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);
|
|
3967
3940
|
}
|
|
3968
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) {
|
|
3969
3946
|
return {
|
|
3970
3947
|
...e,
|
|
3971
|
-
fill: e.fill ?
|
|
3972
|
-
stroke: e.stroke ?
|
|
3948
|
+
fill: e.fill ? sn(e.fill) : e.fill,
|
|
3949
|
+
stroke: e.stroke ? on(e.stroke) : e.stroke
|
|
3973
3950
|
};
|
|
3974
3951
|
}
|
|
3975
|
-
function
|
|
3952
|
+
function un(e, t = !1) {
|
|
3976
3953
|
if (!e.stroke) return e;
|
|
3977
|
-
let n = (e.strokeWidth ?? 1) *
|
|
3954
|
+
let n = (e.strokeWidth ?? 1) * tn;
|
|
3978
3955
|
return {
|
|
3979
|
-
stroke:
|
|
3956
|
+
stroke: cn(e.stroke),
|
|
3980
3957
|
strokeWidth: n,
|
|
3981
3958
|
dash: e.dash,
|
|
3982
3959
|
dashEnabled: e.dashEnabled,
|
|
3983
|
-
alpha: t ?
|
|
3960
|
+
alpha: t ? en : e.alpha
|
|
3984
3961
|
};
|
|
3985
3962
|
}
|
|
3986
|
-
var
|
|
3963
|
+
var dn = { transform(e) {
|
|
3987
3964
|
switch (e.type) {
|
|
3988
3965
|
case "rect": {
|
|
3989
3966
|
let t = {
|
|
3990
3967
|
...e,
|
|
3991
|
-
paint:
|
|
3968
|
+
paint: ln(e.paint)
|
|
3992
3969
|
};
|
|
3993
3970
|
return e.paint.stroke ? [{
|
|
3994
3971
|
...e,
|
|
3995
3972
|
paint: {
|
|
3996
|
-
...
|
|
3973
|
+
...un(e.paint),
|
|
3997
3974
|
fill: void 0
|
|
3998
3975
|
}
|
|
3999
3976
|
}, t] : t;
|
|
@@ -4001,12 +3978,12 @@ var un = { transform(e) {
|
|
|
4001
3978
|
case "circle": {
|
|
4002
3979
|
let t = {
|
|
4003
3980
|
...e,
|
|
4004
|
-
paint:
|
|
3981
|
+
paint: ln(e.paint)
|
|
4005
3982
|
};
|
|
4006
3983
|
return e.paint.stroke ? [{
|
|
4007
3984
|
...e,
|
|
4008
3985
|
paint: {
|
|
4009
|
-
...
|
|
3986
|
+
...un(e.paint),
|
|
4010
3987
|
fill: void 0
|
|
4011
3988
|
}
|
|
4012
3989
|
}, t] : t;
|
|
@@ -4016,21 +3993,21 @@ var un = { transform(e) {
|
|
|
4016
3993
|
...e,
|
|
4017
3994
|
paint: e.paint.stroke ? {
|
|
4018
3995
|
...e.paint,
|
|
4019
|
-
stroke:
|
|
3996
|
+
stroke: on(e.paint.stroke)
|
|
4020
3997
|
} : e.paint
|
|
4021
3998
|
};
|
|
4022
3999
|
return e.paint.stroke ? [{
|
|
4023
4000
|
...e,
|
|
4024
|
-
paint:
|
|
4001
|
+
paint: un(e.paint, !0)
|
|
4025
4002
|
}, t] : t;
|
|
4026
4003
|
}
|
|
4027
4004
|
case "polygon": return {
|
|
4028
4005
|
...e,
|
|
4029
|
-
paint:
|
|
4006
|
+
paint: ln(e.paint)
|
|
4030
4007
|
};
|
|
4031
4008
|
case "text": return {
|
|
4032
4009
|
...e,
|
|
4033
|
-
fill:
|
|
4010
|
+
fill: $t
|
|
4034
4011
|
};
|
|
4035
4012
|
case "image":
|
|
4036
4013
|
case "group": return e;
|
|
@@ -4047,7 +4024,7 @@ function X(...e) {
|
|
|
4047
4024
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4048
4025
|
return t;
|
|
4049
4026
|
}
|
|
4050
|
-
function
|
|
4027
|
+
function fn(e, t, n, r, i, a) {
|
|
4051
4028
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4052
4029
|
if (c < .001) return [
|
|
4053
4030
|
e,
|
|
@@ -4062,17 +4039,17 @@ function dn(e, t, n, r, i, a) {
|
|
|
4062
4039
|
}
|
|
4063
4040
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4064
4041
|
}
|
|
4065
|
-
function
|
|
4042
|
+
function pn(e, t, n) {
|
|
4066
4043
|
if (e.length < 4) return e;
|
|
4067
4044
|
let r = [];
|
|
4068
4045
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4069
|
-
let a =
|
|
4046
|
+
let a = fn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4070
4047
|
if (i === 0) r.push(...a);
|
|
4071
4048
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4072
4049
|
}
|
|
4073
4050
|
return r;
|
|
4074
4051
|
}
|
|
4075
|
-
function
|
|
4052
|
+
function mn(e, t, n, r, i, a) {
|
|
4076
4053
|
let o = [
|
|
4077
4054
|
e,
|
|
4078
4055
|
t,
|
|
@@ -4084,12 +4061,12 @@ function pn(e, t, n, r, i, a) {
|
|
|
4084
4061
|
t + r
|
|
4085
4062
|
], s = [];
|
|
4086
4063
|
for (let e = 0; e < 4; e++) {
|
|
4087
|
-
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u =
|
|
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);
|
|
4088
4065
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4089
4066
|
}
|
|
4090
4067
|
return s;
|
|
4091
4068
|
}
|
|
4092
|
-
function
|
|
4069
|
+
function hn(e, t, n, r, i) {
|
|
4093
4070
|
let a = [];
|
|
4094
4071
|
for (let o = 0; o < 24; o++) {
|
|
4095
4072
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4097,26 +4074,26 @@ function mn(e, t, n, r, i) {
|
|
|
4097
4074
|
}
|
|
4098
4075
|
return a;
|
|
4099
4076
|
}
|
|
4100
|
-
function
|
|
4077
|
+
function gn(e, t, n) {
|
|
4101
4078
|
let r = e.length / 2;
|
|
4102
4079
|
if (r < 2) return e;
|
|
4103
4080
|
let i = [];
|
|
4104
4081
|
for (let a = 0; a < r; a++) {
|
|
4105
|
-
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d =
|
|
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);
|
|
4106
4083
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4107
4084
|
}
|
|
4108
4085
|
return i;
|
|
4109
4086
|
}
|
|
4110
4087
|
//#endregion
|
|
4111
4088
|
//#region src/style/shape/SketchyStyle.ts
|
|
4112
|
-
function
|
|
4089
|
+
function _n(e, t) {
|
|
4113
4090
|
if (!t) return e;
|
|
4114
4091
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4115
4092
|
if (!n) return e;
|
|
4116
4093
|
let r = parseFloat(n[1]);
|
|
4117
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})`;
|
|
4118
4095
|
}
|
|
4119
|
-
function
|
|
4096
|
+
function vn(e) {
|
|
4120
4097
|
let { jitter: t, color: n } = e;
|
|
4121
4098
|
return { transform(e) {
|
|
4122
4099
|
switch (e.type) {
|
|
@@ -4134,7 +4111,7 @@ function _n(e) {
|
|
|
4134
4111
|
}), a && e.paint.strokeWidth) {
|
|
4135
4112
|
let i = {
|
|
4136
4113
|
type: "polygon",
|
|
4137
|
-
vertices:
|
|
4114
|
+
vertices: mn(e.x, e.y, e.width, e.height, t, r),
|
|
4138
4115
|
paint: {
|
|
4139
4116
|
stroke: a,
|
|
4140
4117
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4149,7 +4126,7 @@ function _n(e) {
|
|
|
4149
4126
|
}
|
|
4150
4127
|
return {
|
|
4151
4128
|
type: "polygon",
|
|
4152
|
-
vertices:
|
|
4129
|
+
vertices: mn(e.x, e.y, e.width, e.height, t, r),
|
|
4153
4130
|
paint: {
|
|
4154
4131
|
fill: i,
|
|
4155
4132
|
stroke: a,
|
|
@@ -4164,7 +4141,7 @@ function _n(e) {
|
|
|
4164
4141
|
let r = Y(X(e.cx, e.cy, e.radius));
|
|
4165
4142
|
return {
|
|
4166
4143
|
type: "polygon",
|
|
4167
|
-
vertices:
|
|
4144
|
+
vertices: hn(e.cx, e.cy, e.radius, t, r),
|
|
4168
4145
|
paint: {
|
|
4169
4146
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4170
4147
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4176,7 +4153,7 @@ function _n(e) {
|
|
|
4176
4153
|
};
|
|
4177
4154
|
}
|
|
4178
4155
|
case "line": {
|
|
4179
|
-
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 = {
|
|
4180
4157
|
...e.paint,
|
|
4181
4158
|
stroke: a
|
|
4182
4159
|
};
|
|
@@ -4187,7 +4164,7 @@ function _n(e) {
|
|
|
4187
4164
|
};
|
|
4188
4165
|
}
|
|
4189
4166
|
case "polygon": {
|
|
4190
|
-
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);
|
|
4191
4168
|
return {
|
|
4192
4169
|
...e,
|
|
4193
4170
|
vertices: i,
|
|
@@ -4209,16 +4186,16 @@ function _n(e) {
|
|
|
4209
4186
|
}
|
|
4210
4187
|
//#endregion
|
|
4211
4188
|
//#region src/style/shape/IsometricStyle.ts
|
|
4212
|
-
function
|
|
4189
|
+
function yn(e) {
|
|
4213
4190
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4214
4191
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4215
4192
|
}
|
|
4216
|
-
function
|
|
4193
|
+
function bn(e) {
|
|
4217
4194
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4218
4195
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4219
4196
|
}
|
|
4220
4197
|
var Z = 32;
|
|
4221
|
-
function
|
|
4198
|
+
function xn(e, t) {
|
|
4222
4199
|
let n = Array(t.length);
|
|
4223
4200
|
for (let r = 0; r < t.length; r += 2) {
|
|
4224
4201
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4226,7 +4203,7 @@ function bn(e, t) {
|
|
|
4226
4203
|
}
|
|
4227
4204
|
return n;
|
|
4228
4205
|
}
|
|
4229
|
-
function
|
|
4206
|
+
function Sn(e, t, n, r, i) {
|
|
4230
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);
|
|
4231
4208
|
return [
|
|
4232
4209
|
a,
|
|
@@ -4239,8 +4216,8 @@ function xn(e, t, n, r, i) {
|
|
|
4239
4216
|
f
|
|
4240
4217
|
];
|
|
4241
4218
|
}
|
|
4242
|
-
function
|
|
4243
|
-
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);
|
|
4244
4221
|
function a(e, t, n, i) {
|
|
4245
4222
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4246
4223
|
return [
|
|
@@ -4253,7 +4230,7 @@ function Sn(e = {}) {
|
|
|
4253
4230
|
];
|
|
4254
4231
|
}
|
|
4255
4232
|
function o(e) {
|
|
4256
|
-
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);
|
|
4257
4234
|
if (s.dash || s.dashEnabled) {
|
|
4258
4235
|
let t = [];
|
|
4259
4236
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4452,11 +4429,11 @@ function Sn(e = {}) {
|
|
|
4452
4429
|
case "circle": return s(e);
|
|
4453
4430
|
case "line": return {
|
|
4454
4431
|
...e,
|
|
4455
|
-
points:
|
|
4432
|
+
points: xn(r, e.points)
|
|
4456
4433
|
};
|
|
4457
4434
|
case "polygon": return {
|
|
4458
4435
|
...e,
|
|
4459
|
-
vertices:
|
|
4436
|
+
vertices: xn(r, e.vertices)
|
|
4460
4437
|
};
|
|
4461
4438
|
case "text": {
|
|
4462
4439
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
@@ -4511,21 +4488,21 @@ function Sn(e = {}) {
|
|
|
4511
4488
|
}
|
|
4512
4489
|
//#endregion
|
|
4513
4490
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4514
|
-
var Q = "#1a1a1a",
|
|
4515
|
-
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) {
|
|
4516
4493
|
let t = q(e);
|
|
4517
|
-
if (!t) return J(
|
|
4518
|
-
let n =
|
|
4519
|
-
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);
|
|
4520
4497
|
}
|
|
4521
|
-
function
|
|
4498
|
+
function Nn(e) {
|
|
4522
4499
|
return {
|
|
4523
4500
|
...e,
|
|
4524
|
-
fill: e.fill ?
|
|
4501
|
+
fill: e.fill ? Mn(e.fill) : e.fill,
|
|
4525
4502
|
stroke: e.stroke ? Q : e.stroke
|
|
4526
4503
|
};
|
|
4527
4504
|
}
|
|
4528
|
-
function
|
|
4505
|
+
function Pn(e, t, n, r) {
|
|
4529
4506
|
let i = [], a = e.length;
|
|
4530
4507
|
for (let o = 0; o < a; o++) {
|
|
4531
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;
|
|
@@ -4536,7 +4513,7 @@ function Nn(e, t, n, r) {
|
|
|
4536
4513
|
}
|
|
4537
4514
|
return i;
|
|
4538
4515
|
}
|
|
4539
|
-
function
|
|
4516
|
+
function Fn(e, t, n, r, i) {
|
|
4540
4517
|
let a = [
|
|
4541
4518
|
[e, t],
|
|
4542
4519
|
[e + n, t],
|
|
@@ -4544,17 +4521,17 @@ function Pn(e, t, n, r, i) {
|
|
|
4544
4521
|
[e, t + r]
|
|
4545
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 = [];
|
|
4546
4523
|
for (let e = u; e <= d; e++) {
|
|
4547
|
-
let t = e * o, n = t + s, r =
|
|
4548
|
-
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]]));
|
|
4549
4526
|
}
|
|
4550
4527
|
return f;
|
|
4551
4528
|
}
|
|
4552
|
-
var
|
|
4529
|
+
var In = { transform(e, t) {
|
|
4553
4530
|
switch (e.type) {
|
|
4554
4531
|
case "rect": {
|
|
4555
4532
|
if (!e.paint.fill) return {
|
|
4556
4533
|
...e,
|
|
4557
|
-
paint:
|
|
4534
|
+
paint: Nn(e.paint)
|
|
4558
4535
|
};
|
|
4559
4536
|
let n = {
|
|
4560
4537
|
...e,
|
|
@@ -4562,12 +4539,12 @@ var Fn = { transform(e, t) {
|
|
|
4562
4539
|
fill: Q,
|
|
4563
4540
|
strokeWidth: e.paint.strokeWidth
|
|
4564
4541
|
}
|
|
4565
|
-
}, r =
|
|
4542
|
+
}, r = Fn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4566
4543
|
type: "polygon",
|
|
4567
4544
|
vertices: t,
|
|
4568
4545
|
layer: e.layer,
|
|
4569
4546
|
paint: {
|
|
4570
|
-
fill:
|
|
4547
|
+
fill: wn,
|
|
4571
4548
|
alpha: .65
|
|
4572
4549
|
}
|
|
4573
4550
|
})), i = {
|
|
@@ -4586,13 +4563,13 @@ var Fn = { transform(e, t) {
|
|
|
4586
4563
|
}
|
|
4587
4564
|
case "circle": return {
|
|
4588
4565
|
...e,
|
|
4589
|
-
paint:
|
|
4566
|
+
paint: Nn(e.paint)
|
|
4590
4567
|
};
|
|
4591
4568
|
case "polygon": return {
|
|
4592
4569
|
...e,
|
|
4593
4570
|
paint: {
|
|
4594
4571
|
...e.paint,
|
|
4595
|
-
fill: e.paint.fill ?
|
|
4572
|
+
fill: e.paint.fill ? Tn : e.paint.fill,
|
|
4596
4573
|
stroke: e.paint.stroke ? Q : e.paint.stroke
|
|
4597
4574
|
}
|
|
4598
4575
|
};
|
|
@@ -4600,24 +4577,24 @@ var Fn = { transform(e, t) {
|
|
|
4600
4577
|
...e,
|
|
4601
4578
|
paint: e.paint.stroke ? {
|
|
4602
4579
|
...e.paint,
|
|
4603
|
-
stroke:
|
|
4580
|
+
stroke: Tn
|
|
4604
4581
|
} : e.paint
|
|
4605
4582
|
};
|
|
4606
4583
|
case "text": return {
|
|
4607
4584
|
...e,
|
|
4608
|
-
fill:
|
|
4585
|
+
fill: Tn,
|
|
4609
4586
|
stroke: Q,
|
|
4610
4587
|
strokeWidth: t.roomSize * .25
|
|
4611
4588
|
};
|
|
4612
4589
|
case "image":
|
|
4613
4590
|
case "group": return e;
|
|
4614
4591
|
}
|
|
4615
|
-
} },
|
|
4616
|
-
function
|
|
4592
|
+
} }, Ln = "#c8eeff", Rn = "#00c8ff", zn = "#00ffaa", Bn = .2, Vn = 5, Hn = 190;
|
|
4593
|
+
function Un(e, t, n) {
|
|
4617
4594
|
e /= 255, t /= 255, n /= 255;
|
|
4618
4595
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4619
4596
|
if (r === i) return [
|
|
4620
|
-
|
|
4597
|
+
Hn,
|
|
4621
4598
|
0,
|
|
4622
4599
|
a
|
|
4623
4600
|
];
|
|
@@ -4628,54 +4605,54 @@ function Hn(e, t, n) {
|
|
|
4628
4605
|
a
|
|
4629
4606
|
];
|
|
4630
4607
|
}
|
|
4631
|
-
function
|
|
4608
|
+
function Wn(e, t, n, r = 1) {
|
|
4632
4609
|
e = (e % 360 + 360) % 360;
|
|
4633
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;
|
|
4634
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);
|
|
4635
4612
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4636
4613
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4637
4614
|
}
|
|
4638
|
-
function
|
|
4615
|
+
function Gn(e) {
|
|
4639
4616
|
let t = q(e);
|
|
4640
|
-
if (!t) return
|
|
4641
|
-
let [n, r] =
|
|
4642
|
-
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);
|
|
4643
4620
|
}
|
|
4644
|
-
function
|
|
4621
|
+
function Kn(e) {
|
|
4645
4622
|
return {
|
|
4646
4623
|
...e,
|
|
4647
|
-
fill: e.fill ?
|
|
4648
|
-
stroke: e.stroke ?
|
|
4624
|
+
fill: e.fill ? Gn(e.fill) : e.fill,
|
|
4625
|
+
stroke: e.stroke ? Rn : e.stroke
|
|
4649
4626
|
};
|
|
4650
4627
|
}
|
|
4651
|
-
function
|
|
4628
|
+
function qn(e) {
|
|
4652
4629
|
return {
|
|
4653
|
-
stroke:
|
|
4654
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4655
|
-
alpha:
|
|
4630
|
+
stroke: Rn,
|
|
4631
|
+
strokeWidth: (e.strokeWidth ?? 1) * Vn,
|
|
4632
|
+
alpha: Bn
|
|
4656
4633
|
};
|
|
4657
4634
|
}
|
|
4658
|
-
function
|
|
4635
|
+
function Jn(e) {
|
|
4659
4636
|
return {
|
|
4660
|
-
stroke:
|
|
4661
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4662
|
-
alpha:
|
|
4637
|
+
stroke: zn,
|
|
4638
|
+
strokeWidth: (e.strokeWidth ?? 1) * Vn,
|
|
4639
|
+
alpha: Bn,
|
|
4663
4640
|
dash: e.dash,
|
|
4664
4641
|
dashEnabled: e.dashEnabled
|
|
4665
4642
|
};
|
|
4666
4643
|
}
|
|
4667
|
-
var
|
|
4644
|
+
var Yn = { transform(e) {
|
|
4668
4645
|
switch (e.type) {
|
|
4669
4646
|
case "rect": {
|
|
4670
4647
|
let t = {
|
|
4671
4648
|
...e,
|
|
4672
|
-
paint:
|
|
4649
|
+
paint: Kn(e.paint)
|
|
4673
4650
|
};
|
|
4674
4651
|
return e.paint.stroke ? [{
|
|
4675
4652
|
...e,
|
|
4676
4653
|
hit: void 0,
|
|
4677
4654
|
paint: {
|
|
4678
|
-
...
|
|
4655
|
+
...qn(e.paint),
|
|
4679
4656
|
fill: void 0
|
|
4680
4657
|
}
|
|
4681
4658
|
}, t] : t;
|
|
@@ -4683,13 +4660,13 @@ var Jn = { transform(e) {
|
|
|
4683
4660
|
case "circle": {
|
|
4684
4661
|
let t = {
|
|
4685
4662
|
...e,
|
|
4686
|
-
paint:
|
|
4663
|
+
paint: Kn(e.paint)
|
|
4687
4664
|
};
|
|
4688
4665
|
return e.paint.stroke ? [{
|
|
4689
4666
|
...e,
|
|
4690
4667
|
hit: void 0,
|
|
4691
4668
|
paint: {
|
|
4692
|
-
...
|
|
4669
|
+
...qn(e.paint),
|
|
4693
4670
|
fill: void 0
|
|
4694
4671
|
}
|
|
4695
4672
|
}, t] : t;
|
|
@@ -4706,38 +4683,38 @@ var Jn = { transform(e) {
|
|
|
4706
4683
|
...e,
|
|
4707
4684
|
paint: e.paint.stroke ? {
|
|
4708
4685
|
...e.paint,
|
|
4709
|
-
stroke:
|
|
4686
|
+
stroke: zn
|
|
4710
4687
|
} : e.paint
|
|
4711
4688
|
};
|
|
4712
4689
|
return e.paint.stroke ? [{
|
|
4713
4690
|
...e,
|
|
4714
4691
|
hit: void 0,
|
|
4715
|
-
paint:
|
|
4692
|
+
paint: Jn(e.paint)
|
|
4716
4693
|
}, t] : t;
|
|
4717
4694
|
}
|
|
4718
4695
|
case "polygon": return {
|
|
4719
4696
|
...e,
|
|
4720
4697
|
paint: {
|
|
4721
4698
|
...e.paint,
|
|
4722
|
-
fill: e.paint.fill ?
|
|
4699
|
+
fill: e.paint.fill ? zn : e.paint.fill,
|
|
4723
4700
|
stroke: void 0
|
|
4724
4701
|
}
|
|
4725
4702
|
};
|
|
4726
4703
|
case "text": return {
|
|
4727
4704
|
...e,
|
|
4728
|
-
fill:
|
|
4705
|
+
fill: Ln
|
|
4729
4706
|
};
|
|
4730
4707
|
case "image":
|
|
4731
4708
|
case "group": return e;
|
|
4732
4709
|
}
|
|
4733
|
-
} },
|
|
4734
|
-
function
|
|
4735
|
-
return
|
|
4710
|
+
} }, Xn = Bt, Zn = Qt, Qn = dn;
|
|
4711
|
+
function $n(e) {
|
|
4712
|
+
return vn(e);
|
|
4736
4713
|
}
|
|
4737
|
-
function
|
|
4738
|
-
return
|
|
4714
|
+
function er(e = {}) {
|
|
4715
|
+
return Cn(e);
|
|
4739
4716
|
}
|
|
4740
|
-
var
|
|
4717
|
+
var tr = In, nr = Yn, rr = class {
|
|
4741
4718
|
get settings() {
|
|
4742
4719
|
return this.state.settings;
|
|
4743
4720
|
}
|
|
@@ -4754,7 +4731,7 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4754
4731
|
return this.backend.events;
|
|
4755
4732
|
}
|
|
4756
4733
|
constructor(e, t, n, r) {
|
|
4757
|
-
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);
|
|
4758
4735
|
}
|
|
4759
4736
|
destroy() {
|
|
4760
4737
|
this.backend.destroy();
|
|
@@ -4826,10 +4803,10 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4826
4803
|
this.backend.removeSceneOverlay(e);
|
|
4827
4804
|
}
|
|
4828
4805
|
addLiveEffect(e, t) {
|
|
4829
|
-
this.backend instanceof
|
|
4806
|
+
this.backend instanceof Dt && this.backend.addLiveEffect(e, t);
|
|
4830
4807
|
}
|
|
4831
4808
|
removeLiveEffect(e) {
|
|
4832
|
-
this.backend instanceof
|
|
4809
|
+
this.backend instanceof Dt && this.backend.removeLiveEffect(e);
|
|
4833
4810
|
}
|
|
4834
4811
|
hitTest(e, t) {
|
|
4835
4812
|
let n = this.backend.coordinateTransform(e, t);
|
|
@@ -4910,15 +4887,15 @@ var er = Fn, tr = Jn, nr = class {
|
|
|
4910
4887
|
getCullingMode() {
|
|
4911
4888
|
return this.state.settings.cullingMode;
|
|
4912
4889
|
}
|
|
4913
|
-
},
|
|
4914
|
-
function
|
|
4890
|
+
}, ir = "room";
|
|
4891
|
+
function ar(e, t) {
|
|
4915
4892
|
let n = /* @__PURE__ */ new Map();
|
|
4916
4893
|
function r(e) {
|
|
4917
4894
|
let t = n.get(e);
|
|
4918
4895
|
return t || (t = [], n.set(e, t)), t;
|
|
4919
4896
|
}
|
|
4920
4897
|
function i(e, t, n, i, o, s, c) {
|
|
4921
|
-
let l = e.layer ?? c ??
|
|
4898
|
+
let l = e.layer ?? c ?? ir;
|
|
4922
4899
|
switch (e.type) {
|
|
4923
4900
|
case "rect": {
|
|
4924
4901
|
let a = {
|
|
@@ -4931,7 +4908,7 @@ function ir(e, t) {
|
|
|
4931
4908
|
stroke: e.paint.stroke,
|
|
4932
4909
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4933
4910
|
cr: (e.cornerRadius ?? 0) * i,
|
|
4934
|
-
dash:
|
|
4911
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4935
4912
|
};
|
|
4936
4913
|
r(l).push(a);
|
|
4937
4914
|
return;
|
|
@@ -4945,16 +4922,16 @@ function ir(e, t) {
|
|
|
4945
4922
|
fill: e.paint.fill,
|
|
4946
4923
|
stroke: e.paint.stroke,
|
|
4947
4924
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4948
|
-
dash:
|
|
4925
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4949
4926
|
});
|
|
4950
4927
|
return;
|
|
4951
4928
|
case "line": {
|
|
4952
4929
|
let a = {
|
|
4953
4930
|
type: "line",
|
|
4954
|
-
points:
|
|
4931
|
+
points: or(e.points, t, n, i, o, s),
|
|
4955
4932
|
stroke: e.paint.stroke,
|
|
4956
4933
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4957
|
-
dash:
|
|
4934
|
+
dash: sr(e.paint.dash, i, e.paint.dashEnabled),
|
|
4958
4935
|
lineCap: e.lineCap,
|
|
4959
4936
|
lineJoin: e.lineJoin,
|
|
4960
4937
|
alpha: e.paint.alpha
|
|
@@ -4965,7 +4942,7 @@ function ir(e, t) {
|
|
|
4965
4942
|
case "polygon": {
|
|
4966
4943
|
let a = {
|
|
4967
4944
|
type: "polygon",
|
|
4968
|
-
vertices:
|
|
4945
|
+
vertices: or(e.vertices, t, n, i, o, s),
|
|
4969
4946
|
fill: e.paint.fill,
|
|
4970
4947
|
stroke: e.paint.stroke,
|
|
4971
4948
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
@@ -4974,7 +4951,7 @@ function ir(e, t) {
|
|
|
4974
4951
|
return;
|
|
4975
4952
|
}
|
|
4976
4953
|
case "text": {
|
|
4977
|
-
let a =
|
|
4954
|
+
let a = cr(e.transform, t, n, i, o, s), c = {
|
|
4978
4955
|
type: "text",
|
|
4979
4956
|
x: a ? 0 : (t + e.x) * i + o,
|
|
4980
4957
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -4997,7 +4974,7 @@ function ir(e, t) {
|
|
|
4997
4974
|
return;
|
|
4998
4975
|
}
|
|
4999
4976
|
case "image": {
|
|
5000
|
-
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;
|
|
5001
4978
|
r(l).push({
|
|
5002
4979
|
type: "image",
|
|
5003
4980
|
x: c,
|
|
@@ -5017,7 +4994,7 @@ function ir(e, t) {
|
|
|
5017
4994
|
function a(e, t, n, a, o, s, c) {
|
|
5018
4995
|
let l = e.layer ?? c;
|
|
5019
4996
|
if (e.noScale) {
|
|
5020
|
-
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);
|
|
5021
4998
|
d.push({
|
|
5022
4999
|
type: "pushTransform",
|
|
5023
5000
|
matrix: [
|
|
@@ -5044,19 +5021,19 @@ function ir(e, t) {
|
|
|
5044
5021
|
});
|
|
5045
5022
|
return o;
|
|
5046
5023
|
}
|
|
5047
|
-
function
|
|
5024
|
+
function or(e, t, n, r, i, a) {
|
|
5048
5025
|
let o = Array(e.length);
|
|
5049
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;
|
|
5050
5027
|
return o;
|
|
5051
5028
|
}
|
|
5052
|
-
function
|
|
5029
|
+
function sr(e, t, n) {
|
|
5053
5030
|
if (n === !1) return;
|
|
5054
5031
|
if (!e || e.length === 0) return e;
|
|
5055
5032
|
let r = Array(e.length);
|
|
5056
5033
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5057
5034
|
return r;
|
|
5058
5035
|
}
|
|
5059
|
-
function
|
|
5036
|
+
function cr(e, t, n, r, i, a) {
|
|
5060
5037
|
if (!e) return;
|
|
5061
5038
|
let [o, s, c, l, u, d] = e;
|
|
5062
5039
|
return [
|
|
@@ -5070,21 +5047,21 @@ function sr(e, t, n, r, i, a) {
|
|
|
5070
5047
|
}
|
|
5071
5048
|
//#endregion
|
|
5072
5049
|
//#region src/render/SvgRenderer.ts
|
|
5073
|
-
function
|
|
5050
|
+
function lr(e) {
|
|
5074
5051
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5075
5052
|
}
|
|
5076
5053
|
function $(e, t) {
|
|
5077
|
-
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ?
|
|
5054
|
+
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? lr(t) : t}"`;
|
|
5078
5055
|
}
|
|
5079
|
-
function
|
|
5056
|
+
function ur(e) {
|
|
5080
5057
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5081
5058
|
}
|
|
5082
|
-
function
|
|
5059
|
+
function dr(e) {
|
|
5083
5060
|
let t = [];
|
|
5084
|
-
for (let n of e)
|
|
5061
|
+
for (let n of e) fr(n.commands, t);
|
|
5085
5062
|
return t;
|
|
5086
5063
|
}
|
|
5087
|
-
function
|
|
5064
|
+
function fr(e, t) {
|
|
5088
5065
|
let n = [];
|
|
5089
5066
|
for (let r of e) switch (r.type) {
|
|
5090
5067
|
case "pushTransform": {
|
|
@@ -5102,29 +5079,29 @@ function dr(e, t) {
|
|
|
5102
5079
|
break;
|
|
5103
5080
|
}
|
|
5104
5081
|
default: {
|
|
5105
|
-
let e =
|
|
5082
|
+
let e = pr(r);
|
|
5106
5083
|
e && t.push(e);
|
|
5107
5084
|
break;
|
|
5108
5085
|
}
|
|
5109
5086
|
}
|
|
5110
5087
|
for (; n.length > 0;) t.push(n.pop());
|
|
5111
5088
|
}
|
|
5112
|
-
function
|
|
5089
|
+
function pr(e) {
|
|
5113
5090
|
switch (e.type) {
|
|
5114
5091
|
case "rect": {
|
|
5115
5092
|
let t = e.fill ?? "none", n = e.cr > 0 ? `${$("rx", e.cr)}${$("ry", e.cr)}` : "";
|
|
5116
|
-
return `<rect${$("x", e.x)}${$("y", e.y)}${$("width", e.w)}${$("height", e.h)}${$("fill", t)}${$("stroke", e.stroke)}${e.sw ? $("stroke-width", e.sw) : ""}${n}${
|
|
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)}/>`;
|
|
5117
5094
|
}
|
|
5118
5095
|
case "circle": {
|
|
5119
5096
|
let t = e.fill ?? "none";
|
|
5120
|
-
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)}/>`;
|
|
5121
5098
|
}
|
|
5122
5099
|
case "line": {
|
|
5123
5100
|
let t = e.points;
|
|
5124
5101
|
if (t.length < 2) return;
|
|
5125
5102
|
let n = [];
|
|
5126
5103
|
for (let e = 0; e < t.length; e += 2) n.push(`${t[e]},${t[e + 1]}`);
|
|
5127
|
-
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"/>`;
|
|
5128
5105
|
}
|
|
5129
5106
|
case "polygon": {
|
|
5130
5107
|
let t = e.vertices;
|
|
@@ -5137,30 +5114,30 @@ function fr(e) {
|
|
|
5137
5114
|
let t = e.x, n = e.y, r = "start", i = "auto";
|
|
5138
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);
|
|
5139
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"` : "";
|
|
5140
|
-
return `<text${$("x", t)}${$("y", n)}${$("font-size", e.fontSize)}${e.fontFamily ? $("font-family", e.fontFamily) : ""}${o}${$("fill", e.fill)}${s} text-anchor="${r}" dominant-baseline="${i}"${a}>${
|
|
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>`;
|
|
5141
5118
|
}
|
|
5142
5119
|
case "image":
|
|
5143
5120
|
if (e.transform) {
|
|
5144
5121
|
let [t, n, r, i, a, o] = e.transform;
|
|
5145
|
-
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})"/>`;
|
|
5146
5123
|
}
|
|
5147
|
-
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)}"/>`;
|
|
5148
5125
|
}
|
|
5149
5126
|
}
|
|
5150
5127
|
//#endregion
|
|
5151
5128
|
//#region src/render/CanvasRenderer.ts
|
|
5152
|
-
var
|
|
5129
|
+
var mr = (e) => {
|
|
5153
5130
|
if (typeof Image < "u") {
|
|
5154
5131
|
let t = new Image();
|
|
5155
5132
|
return t.src = e, t;
|
|
5156
5133
|
}
|
|
5157
5134
|
return null;
|
|
5158
5135
|
};
|
|
5159
|
-
function
|
|
5160
|
-
let r = n.imageFactory ??
|
|
5161
|
-
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);
|
|
5162
5139
|
}
|
|
5163
|
-
function
|
|
5140
|
+
function gr(e, t, n) {
|
|
5164
5141
|
let r = 0;
|
|
5165
5142
|
for (let i of t) switch (i.type) {
|
|
5166
5143
|
case "pushTransform":
|
|
@@ -5174,12 +5151,12 @@ function hr(e, t, n) {
|
|
|
5174
5151
|
r > 0 && (e.restore(), r--);
|
|
5175
5152
|
break;
|
|
5176
5153
|
default:
|
|
5177
|
-
|
|
5154
|
+
_r(e, i, n);
|
|
5178
5155
|
break;
|
|
5179
5156
|
}
|
|
5180
5157
|
for (; r > 0;) e.restore(), r--;
|
|
5181
5158
|
}
|
|
5182
|
-
function
|
|
5159
|
+
function _r(e, t, n) {
|
|
5183
5160
|
switch (t.type) {
|
|
5184
5161
|
case "rect":
|
|
5185
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());
|
|
@@ -5240,35 +5217,35 @@ function gr(e, t, n) {
|
|
|
5240
5217
|
}
|
|
5241
5218
|
//#endregion
|
|
5242
5219
|
//#region src/export/flushSceneShapes.ts
|
|
5243
|
-
function
|
|
5244
|
-
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));
|
|
5245
5222
|
for (let e of t.sceneOverlays) {
|
|
5246
5223
|
let r = e.render(t.state, t.viewportBounds);
|
|
5247
5224
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5248
5225
|
}
|
|
5249
5226
|
n(e.topLabel);
|
|
5250
5227
|
}
|
|
5251
|
-
function
|
|
5228
|
+
function yr(e, t) {
|
|
5252
5229
|
let n = e.getOverlaysForArea(t);
|
|
5253
5230
|
if (!n) return [];
|
|
5254
5231
|
let r = e.settings, i = [];
|
|
5255
5232
|
if (n.paths) for (let t of n.paths) {
|
|
5256
|
-
let n =
|
|
5257
|
-
i.push(...
|
|
5233
|
+
let n = ct(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5234
|
+
i.push(...dt(n));
|
|
5258
5235
|
}
|
|
5259
5236
|
if (n.highlights) for (let t of n.highlights) {
|
|
5260
5237
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5261
|
-
n && i.push(
|
|
5238
|
+
n && i.push(lt(ot(n, t.color, r)));
|
|
5262
5239
|
}
|
|
5263
5240
|
if (n.position) {
|
|
5264
5241
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5265
|
-
t && i.push(
|
|
5242
|
+
t && i.push(ut(st(t, r)));
|
|
5266
5243
|
}
|
|
5267
5244
|
return i;
|
|
5268
5245
|
}
|
|
5269
5246
|
//#endregion
|
|
5270
5247
|
//#region src/export/sceneBounds.ts
|
|
5271
|
-
function
|
|
5248
|
+
function br(e, t, n = 0) {
|
|
5272
5249
|
if (!t.worldToScene) return e;
|
|
5273
5250
|
let r = [
|
|
5274
5251
|
t.worldToScene(e.x, e.y),
|
|
@@ -5286,15 +5263,15 @@ function yr(e, t, n = 0) {
|
|
|
5286
5263
|
}
|
|
5287
5264
|
//#endregion
|
|
5288
5265
|
//#region src/export/SvgExporter.ts
|
|
5289
|
-
var
|
|
5266
|
+
var xr = {
|
|
5290
5267
|
scale: 1,
|
|
5291
5268
|
offsetX: 0,
|
|
5292
5269
|
offsetY: 0
|
|
5293
5270
|
};
|
|
5294
|
-
function
|
|
5271
|
+
function Sr(e) {
|
|
5295
5272
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5296
5273
|
}
|
|
5297
|
-
var
|
|
5274
|
+
var Cr = class {
|
|
5298
5275
|
constructor(e = {}) {
|
|
5299
5276
|
this.options = e;
|
|
5300
5277
|
}
|
|
@@ -5303,30 +5280,30 @@ var Sr = class {
|
|
|
5303
5280
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5304
5281
|
let o = a, s = o.getPlane(i);
|
|
5305
5282
|
if (!s) return;
|
|
5306
|
-
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Re(new
|
|
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, {
|
|
5307
5284
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5308
5285
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5309
5286
|
}), p = {
|
|
5310
5287
|
scale: 1,
|
|
5311
5288
|
roomSize: c.roomSize
|
|
5312
|
-
}, m = (e) => t === W ? e : G(e, t, p), h =
|
|
5313
|
-
return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${
|
|
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, {
|
|
5314
5291
|
state: e,
|
|
5315
5292
|
viewportBounds: d,
|
|
5316
5293
|
sceneOverlays: n,
|
|
5317
5294
|
overlays: this.options.overlays
|
|
5318
5295
|
}, (e) => {
|
|
5319
|
-
e.length !== 0 && g.push(...
|
|
5296
|
+
e.length !== 0 && g.push(...dr(ar(m(e), xr)));
|
|
5320
5297
|
}), g.push("</svg>"), g.join("\n");
|
|
5321
5298
|
}
|
|
5322
|
-
},
|
|
5299
|
+
}, wr = class {
|
|
5323
5300
|
constructor(e = {}) {
|
|
5324
5301
|
this.options = e;
|
|
5325
5302
|
}
|
|
5326
5303
|
render({ backend: e }) {
|
|
5327
5304
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5328
5305
|
}
|
|
5329
|
-
},
|
|
5306
|
+
}, Tr = class {
|
|
5330
5307
|
constructor(e = {}) {
|
|
5331
5308
|
this.options = e;
|
|
5332
5309
|
}
|
|
@@ -5343,14 +5320,14 @@ var Sr = class {
|
|
|
5343
5320
|
};
|
|
5344
5321
|
//#endregion
|
|
5345
5322
|
//#region src/export/canvasToBytes.ts
|
|
5346
|
-
function
|
|
5323
|
+
function Er(e, t = "image/png", n) {
|
|
5347
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);
|
|
5348
5325
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5349
5326
|
return s;
|
|
5350
5327
|
}
|
|
5351
5328
|
//#endregion
|
|
5352
5329
|
//#region src/export/CanvasExporter.ts
|
|
5353
|
-
var
|
|
5330
|
+
var Dr = class {
|
|
5354
5331
|
constructor(e) {
|
|
5355
5332
|
this.options = e;
|
|
5356
5333
|
}
|
|
@@ -5359,14 +5336,14 @@ var Er = class {
|
|
|
5359
5336
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5360
5337
|
let s = o, c = s.getPlane(a);
|
|
5361
5338
|
if (!c) return;
|
|
5362
|
-
let l = e.settings, { width: u, height: d } = this.options, f = this.options.padding ?? 3, p = e.computeExportBounds(s, c, this.options.roomId, f), m =
|
|
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 = {
|
|
5363
5340
|
scale: h,
|
|
5364
5341
|
offsetX: v,
|
|
5365
5342
|
offsetY: y
|
|
5366
5343
|
}, x = D.forRenderCamera(u, d, h, v, y), S = {
|
|
5367
5344
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5368
5345
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5369
|
-
}, 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();
|
|
5370
5347
|
w.width = u, w.height = d;
|
|
5371
5348
|
let T = w.getContext("2d");
|
|
5372
5349
|
if (!T) return;
|
|
@@ -5375,55 +5352,55 @@ var Er = class {
|
|
|
5375
5352
|
scale: h,
|
|
5376
5353
|
roomSize: l.roomSize
|
|
5377
5354
|
}, O = (e) => t === W ? e : G(e, t, E);
|
|
5378
|
-
return
|
|
5355
|
+
return vr(C, {
|
|
5379
5356
|
state: e,
|
|
5380
5357
|
viewportBounds: D.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5381
5358
|
sceneOverlays: n,
|
|
5382
5359
|
overlays: this.options.overlays
|
|
5383
5360
|
}, (e) => {
|
|
5384
|
-
e.length !== 0 &&
|
|
5361
|
+
e.length !== 0 && hr(T, ar(O(e), b));
|
|
5385
5362
|
}), w;
|
|
5386
5363
|
}
|
|
5387
|
-
},
|
|
5364
|
+
}, Or = class {
|
|
5388
5365
|
constructor(e) {
|
|
5389
|
-
this.options = e, this.canvasExporter = new
|
|
5366
|
+
this.options = e, this.canvasExporter = new Dr(e);
|
|
5390
5367
|
}
|
|
5391
5368
|
render(e) {
|
|
5392
5369
|
let t = this.canvasExporter.render(e);
|
|
5393
|
-
if (t) return
|
|
5370
|
+
if (t) return Er(t, this.options.mimeType, this.options.quality);
|
|
5394
5371
|
}
|
|
5395
|
-
},
|
|
5396
|
-
function
|
|
5372
|
+
}, kr, Ar, jr = 256;
|
|
5373
|
+
function Mr(e, t, n) {
|
|
5397
5374
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5398
|
-
if (
|
|
5399
|
-
let i =
|
|
5375
|
+
if (Ar === r && kr) return kr;
|
|
5376
|
+
let i = jr, a = i / 2, o = document.createElement("canvas");
|
|
5400
5377
|
o.width = i, o.height = i;
|
|
5401
5378
|
let s = o.getContext("2d");
|
|
5402
5379
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5403
5380
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5404
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";
|
|
5405
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);
|
|
5406
|
-
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i),
|
|
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;
|
|
5407
5384
|
}
|
|
5408
|
-
function
|
|
5385
|
+
function Nr(e, t, n, r) {
|
|
5409
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);
|
|
5410
5387
|
return {
|
|
5411
5388
|
cx: e,
|
|
5412
5389
|
cy: t,
|
|
5413
5390
|
displaySize: u,
|
|
5414
|
-
src:
|
|
5391
|
+
src: Mr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5415
5392
|
};
|
|
5416
5393
|
}
|
|
5417
5394
|
//#endregion
|
|
5418
5395
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5419
|
-
var
|
|
5396
|
+
var Pr = {
|
|
5420
5397
|
color: "#ffcc44",
|
|
5421
5398
|
radius: 12,
|
|
5422
5399
|
intensity: .7
|
|
5423
|
-
},
|
|
5400
|
+
}, Fr = class {
|
|
5424
5401
|
constructor(e) {
|
|
5425
5402
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5426
|
-
...
|
|
5403
|
+
...Pr,
|
|
5427
5404
|
...e
|
|
5428
5405
|
};
|
|
5429
5406
|
}
|
|
@@ -5446,7 +5423,7 @@ var Nr = {
|
|
|
5446
5423
|
if (e.positionRoomId === void 0) return;
|
|
5447
5424
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5448
5425
|
if (!n) return;
|
|
5449
|
-
let r =
|
|
5426
|
+
let r = Nr(n.x, n.y, t, this.params);
|
|
5450
5427
|
return {
|
|
5451
5428
|
type: "image",
|
|
5452
5429
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5457,7 +5434,7 @@ var Nr = {
|
|
|
5457
5434
|
layer: "overlay"
|
|
5458
5435
|
};
|
|
5459
5436
|
}
|
|
5460
|
-
},
|
|
5437
|
+
}, Ir = /* @__PURE__ */ u(((e, t) => {
|
|
5461
5438
|
t.exports = class {
|
|
5462
5439
|
constructor() {
|
|
5463
5440
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5487,14 +5464,14 @@ var Nr = {
|
|
|
5487
5464
|
return this.queue.find((t) => t.key === e);
|
|
5488
5465
|
}
|
|
5489
5466
|
};
|
|
5490
|
-
})),
|
|
5467
|
+
})), Lr = /* @__PURE__ */ u(((e, t) => {
|
|
5491
5468
|
function n(e, t) {
|
|
5492
5469
|
let r = /* @__PURE__ */ new Map();
|
|
5493
5470
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5494
5471
|
return r;
|
|
5495
5472
|
}
|
|
5496
5473
|
t.exports = n;
|
|
5497
|
-
})),
|
|
5474
|
+
})), Rr = /* @__PURE__ */ u(((e, t) => {
|
|
5498
5475
|
function n(e) {
|
|
5499
5476
|
let t = Number(e);
|
|
5500
5477
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5509,7 +5486,7 @@ var Nr = {
|
|
|
5509
5486
|
}), t;
|
|
5510
5487
|
}
|
|
5511
5488
|
t.exports = r;
|
|
5512
|
-
})),
|
|
5489
|
+
})), zr = /* @__PURE__ */ u(((e, t) => {
|
|
5513
5490
|
function n(e) {
|
|
5514
5491
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5515
5492
|
e.forEach((e, t) => {
|
|
@@ -5521,8 +5498,8 @@ var Nr = {
|
|
|
5521
5498
|
});
|
|
5522
5499
|
}
|
|
5523
5500
|
t.exports = n;
|
|
5524
|
-
})),
|
|
5525
|
-
var n =
|
|
5501
|
+
})), Br = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5502
|
+
var n = Ir(), r = Lr(), i = Rr(), a = zr();
|
|
5526
5503
|
t.exports = class {
|
|
5527
5504
|
constructor(e) {
|
|
5528
5505
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5572,7 +5549,7 @@ var Nr = {
|
|
|
5572
5549
|
return this.path(...e);
|
|
5573
5550
|
}
|
|
5574
5551
|
};
|
|
5575
|
-
})))(), 1),
|
|
5552
|
+
})))(), 1), Vr = {
|
|
5576
5553
|
1: "north",
|
|
5577
5554
|
2: "northeast",
|
|
5578
5555
|
3: "northwest",
|
|
@@ -5585,7 +5562,7 @@ var Nr = {
|
|
|
5585
5562
|
10: "down",
|
|
5586
5563
|
11: "in",
|
|
5587
5564
|
12: "out"
|
|
5588
|
-
},
|
|
5565
|
+
}, Hr = {
|
|
5589
5566
|
north: "n",
|
|
5590
5567
|
northeast: "ne",
|
|
5591
5568
|
northwest: "nw",
|
|
@@ -5598,7 +5575,7 @@ var Nr = {
|
|
|
5598
5575
|
down: "down",
|
|
5599
5576
|
in: "in",
|
|
5600
5577
|
out: "out"
|
|
5601
|
-
},
|
|
5578
|
+
}, Ur = class {
|
|
5602
5579
|
constructor(e) {
|
|
5603
5580
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5604
5581
|
}
|
|
@@ -5624,12 +5601,12 @@ var Nr = {
|
|
|
5624
5601
|
buildGraph() {
|
|
5625
5602
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5626
5603
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5627
|
-
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 ?? []);
|
|
5628
5605
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5629
5606
|
if (s.has(e)) return;
|
|
5630
5607
|
let c = this.mapReader.getRoom(t);
|
|
5631
5608
|
if (c) {
|
|
5632
|
-
let s =
|
|
5609
|
+
let s = Hr[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5633
5610
|
a.push({
|
|
5634
5611
|
id: t,
|
|
5635
5612
|
weight: l
|
|
@@ -5660,7 +5637,7 @@ var Nr = {
|
|
|
5660
5637
|
};
|
|
5661
5638
|
//#endregion
|
|
5662
5639
|
//#region src/PathFinder.ts
|
|
5663
|
-
function
|
|
5640
|
+
function Wr(e, t) {
|
|
5664
5641
|
e.push(t);
|
|
5665
5642
|
let n = e.length - 1;
|
|
5666
5643
|
for (; n > 0;) {
|
|
@@ -5669,7 +5646,7 @@ function Ur(e, t) {
|
|
|
5669
5646
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5670
5647
|
}
|
|
5671
5648
|
}
|
|
5672
|
-
function
|
|
5649
|
+
function Gr(e) {
|
|
5673
5650
|
if (e.length === 0) return;
|
|
5674
5651
|
let t = e[0], n = e.pop();
|
|
5675
5652
|
if (e.length > 0) {
|
|
@@ -5683,16 +5660,16 @@ function Wr(e) {
|
|
|
5683
5660
|
}
|
|
5684
5661
|
return t;
|
|
5685
5662
|
}
|
|
5686
|
-
function
|
|
5663
|
+
function Kr(e, t, n) {
|
|
5687
5664
|
let r = [n], i = n;
|
|
5688
5665
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5689
5666
|
return r.reverse(), r;
|
|
5690
5667
|
}
|
|
5691
|
-
function
|
|
5668
|
+
function qr(e, t, n) {
|
|
5692
5669
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5693
5670
|
return i ? i.map((e) => Number(e)) : null;
|
|
5694
5671
|
}
|
|
5695
|
-
function
|
|
5672
|
+
function Jr(e, t, n, r) {
|
|
5696
5673
|
let i = r.getRoom(n);
|
|
5697
5674
|
if (!i) return null;
|
|
5698
5675
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5701,16 +5678,16 @@ function qr(e, t, n, r) {
|
|
|
5701
5678
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5702
5679
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5703
5680
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5704
|
-
for (d.set(t, 0),
|
|
5681
|
+
for (d.set(t, 0), Wr(p, {
|
|
5705
5682
|
id: t,
|
|
5706
5683
|
priority: u(t)
|
|
5707
5684
|
}); p.length > 0;) {
|
|
5708
|
-
let { id: r } =
|
|
5709
|
-
if (r === n) return
|
|
5685
|
+
let { id: r } = Gr(p);
|
|
5686
|
+
if (r === n) return Kr(f, t, n);
|
|
5710
5687
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5711
5688
|
if (a) for (let e of a) {
|
|
5712
5689
|
let t = i + e.weight;
|
|
5713
|
-
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, {
|
|
5714
5691
|
id: e.id,
|
|
5715
5692
|
priority: t + u(e.id)
|
|
5716
5693
|
}));
|
|
@@ -5718,9 +5695,9 @@ function qr(e, t, n, r) {
|
|
|
5718
5695
|
}
|
|
5719
5696
|
return null;
|
|
5720
5697
|
}
|
|
5721
|
-
var
|
|
5698
|
+
var Yr = class {
|
|
5722
5699
|
constructor(e, t = "dijkstra") {
|
|
5723
|
-
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());
|
|
5724
5701
|
}
|
|
5725
5702
|
get algorithm() {
|
|
5726
5703
|
return this._algorithm;
|
|
@@ -5739,23 +5716,23 @@ var Jr = class {
|
|
|
5739
5716
|
let r;
|
|
5740
5717
|
switch (this._algorithm) {
|
|
5741
5718
|
case "dijkstra":
|
|
5742
|
-
r =
|
|
5719
|
+
r = qr(this.dijkstraGraph, e, t);
|
|
5743
5720
|
break;
|
|
5744
5721
|
case "astar":
|
|
5745
|
-
r =
|
|
5722
|
+
r = Jr(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5746
5723
|
break;
|
|
5747
5724
|
}
|
|
5748
5725
|
return this.cache.set(n, r), r;
|
|
5749
5726
|
}
|
|
5750
|
-
},
|
|
5727
|
+
}, Xr = {
|
|
5751
5728
|
hidden: 2,
|
|
5752
5729
|
stub: 1,
|
|
5753
5730
|
full: 0
|
|
5754
5731
|
};
|
|
5755
|
-
function
|
|
5756
|
-
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;
|
|
5757
5734
|
}
|
|
5758
|
-
function
|
|
5735
|
+
function Qr(e, ...t) {
|
|
5759
5736
|
let n = {}, r;
|
|
5760
5737
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5761
5738
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -5771,7 +5748,7 @@ function Zr(e, ...t) {
|
|
|
5771
5748
|
for (let o of r) {
|
|
5772
5749
|
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5773
5750
|
if (a === void 0) a = r;
|
|
5774
|
-
else if (a =
|
|
5751
|
+
else if (a = Zr(a, r, i), i === "first") break;
|
|
5775
5752
|
}
|
|
5776
5753
|
return a ?? "full";
|
|
5777
5754
|
},
|
|
@@ -5784,7 +5761,7 @@ function Zr(e, ...t) {
|
|
|
5784
5761
|
}
|
|
5785
5762
|
//#endregion
|
|
5786
5763
|
//#region src/lens/ExplorationLens.ts
|
|
5787
|
-
var
|
|
5764
|
+
var $r = class {
|
|
5788
5765
|
constructor(e) {
|
|
5789
5766
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5790
5767
|
}
|
|
@@ -5819,7 +5796,7 @@ var Qr = class {
|
|
|
5819
5796
|
clear() {
|
|
5820
5797
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5821
5798
|
}
|
|
5822
|
-
},
|
|
5799
|
+
}, ei = {
|
|
5823
5800
|
1: "north",
|
|
5824
5801
|
2: "northeast",
|
|
5825
5802
|
3: "northwest",
|
|
@@ -5833,7 +5810,7 @@ var Qr = class {
|
|
|
5833
5810
|
11: "in",
|
|
5834
5811
|
12: "out"
|
|
5835
5812
|
};
|
|
5836
|
-
function
|
|
5813
|
+
function ti() {
|
|
5837
5814
|
return {
|
|
5838
5815
|
areaWidth: 150,
|
|
5839
5816
|
areaHeight: 80,
|
|
@@ -5847,9 +5824,9 @@ function ei() {
|
|
|
5847
5824
|
highlightColor: "#ff9900"
|
|
5848
5825
|
};
|
|
5849
5826
|
}
|
|
5850
|
-
var
|
|
5827
|
+
var ni = class {
|
|
5851
5828
|
constructor(e, t, n) {
|
|
5852
|
-
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ??
|
|
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({
|
|
5853
5830
|
container: e,
|
|
5854
5831
|
width: e.clientWidth,
|
|
5855
5832
|
height: e.clientHeight,
|
|
@@ -6032,14 +6009,14 @@ var ti = class {
|
|
|
6032
6009
|
toAreaId: e.fromAreaId,
|
|
6033
6010
|
fromRoomId: e.toRoomId,
|
|
6034
6011
|
toRoomId: e.fromRoomId,
|
|
6035
|
-
direction: e.direction ?
|
|
6012
|
+
direction: e.direction ? P[e.direction] : null,
|
|
6036
6013
|
fromRoomPosition: e.toRoomPosition,
|
|
6037
6014
|
toRoomPosition: e.fromRoomPosition
|
|
6038
6015
|
});
|
|
6039
6016
|
}
|
|
6040
6017
|
}
|
|
6041
6018
|
getLockedDirections(e) {
|
|
6042
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6019
|
+
return new Set((e.exitLocks ?? []).map((e) => ei[e]).filter((e) => !!e));
|
|
6043
6020
|
}
|
|
6044
6021
|
createConnection(e, t, n) {
|
|
6045
6022
|
let r = this.toPlanarDirection(n);
|
|
@@ -6108,7 +6085,7 @@ var ti = class {
|
|
|
6108
6085
|
}[e.toLowerCase().trim()] ?? null;
|
|
6109
6086
|
}
|
|
6110
6087
|
toPlanarDirection(e) {
|
|
6111
|
-
return e &&
|
|
6088
|
+
return e && N.includes(e) ? e : null;
|
|
6112
6089
|
}
|
|
6113
6090
|
layoutAreas() {
|
|
6114
6091
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6651,6 +6628,6 @@ var ti = class {
|
|
|
6651
6628
|
}
|
|
6652
6629
|
};
|
|
6653
6630
|
//#endregion
|
|
6654
|
-
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 };
|
|
6655
6632
|
|
|
6656
6633
|
//# sourceMappingURL=index.mjs.map
|