mudlet-map-renderer 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ScenePipeline.d.ts +1 -1
- package/dist/camera/Camera.d.ts +1 -1
- package/dist/draw/DrawCommand.d.ts +4 -4
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +840 -677
- package/dist/index.mjs.map +1 -1
- package/dist/render/RecordingLayer.d.ts +4 -3
- package/dist/render/canvasGradient.d.ts +2 -0
- package/dist/rendering/KonvaRenderBackend.d.ts +8 -6
- package/dist/scene/Shape.d.ts +49 -2
- package/dist/style/index.d.ts +8 -1
- package/dist/style/shape/GradientRoomsStyle.d.ts +23 -0
- package/dist/style/shape/index.d.ts +2 -0
- package/dist/style/shape/paintMap.d.ts +6 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -386,10 +386,10 @@ var T = class {
|
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
|
-
function
|
|
389
|
+
function ee(e) {
|
|
390
390
|
return e < .5 ? 2 * e * e : -1 + (4 - 2 * e) * e;
|
|
391
391
|
}
|
|
392
|
-
var
|
|
392
|
+
var E = class e extends S {
|
|
393
393
|
constructor(e, t) {
|
|
394
394
|
super(), this.zoom = 1, this.minZoom = .05, this.position = {
|
|
395
395
|
x: 0,
|
|
@@ -541,7 +541,7 @@ var D = class e extends S {
|
|
|
541
541
|
this.cancelAnimation();
|
|
542
542
|
let n = performance.now(), r = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(performance.now()), 16), i = (a) => {
|
|
543
543
|
let o = a - n, s = Math.min(o / e, 1);
|
|
544
|
-
t(
|
|
544
|
+
t(ee(s)), this.notify(), s < 1 ? this.animationId = r(i) : this.animationId = void 0;
|
|
545
545
|
};
|
|
546
546
|
this.animationId = r(i);
|
|
547
547
|
}
|
|
@@ -566,12 +566,12 @@ var D = class e extends S {
|
|
|
566
566
|
}
|
|
567
567
|
this.emit("change", void 0);
|
|
568
568
|
}
|
|
569
|
-
},
|
|
569
|
+
}, D = (e, t) => ({
|
|
570
570
|
x: e,
|
|
571
571
|
y: t
|
|
572
|
-
}),
|
|
572
|
+
}), te = class {
|
|
573
573
|
constructor(e, t) {
|
|
574
|
-
this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform =
|
|
574
|
+
this.settings = e, this.onCullingNeeded = t, this.cullingScheduled = !1, this.coordinateTransform = D;
|
|
575
575
|
}
|
|
576
576
|
setCoordinateTransform(e) {
|
|
577
577
|
this.coordinateTransform = e;
|
|
@@ -590,7 +590,7 @@ var D = class e extends S {
|
|
|
590
590
|
updateCulling() {
|
|
591
591
|
this.onCullingNeeded();
|
|
592
592
|
}
|
|
593
|
-
},
|
|
593
|
+
}, O = [
|
|
594
594
|
"north",
|
|
595
595
|
"south",
|
|
596
596
|
"east",
|
|
@@ -599,7 +599,7 @@ var D = class e extends S {
|
|
|
599
599
|
"northwest",
|
|
600
600
|
"southeast",
|
|
601
601
|
"southwest"
|
|
602
|
-
],
|
|
602
|
+
], ne = {
|
|
603
603
|
n: "north",
|
|
604
604
|
s: "south",
|
|
605
605
|
e: "east",
|
|
@@ -608,7 +608,7 @@ var D = class e extends S {
|
|
|
608
608
|
nw: "northwest",
|
|
609
609
|
se: "southeast",
|
|
610
610
|
sw: "southwest"
|
|
611
|
-
},
|
|
611
|
+
}, k = {
|
|
612
612
|
north: "n",
|
|
613
613
|
south: "s",
|
|
614
614
|
east: "e",
|
|
@@ -621,7 +621,7 @@ var D = class e extends S {
|
|
|
621
621
|
down: "d",
|
|
622
622
|
in: "i",
|
|
623
623
|
out: "o"
|
|
624
|
-
},
|
|
624
|
+
}, A = {
|
|
625
625
|
north: {
|
|
626
626
|
x: 0,
|
|
627
627
|
y: -1
|
|
@@ -654,7 +654,7 @@ var D = class e extends S {
|
|
|
654
654
|
x: -1,
|
|
655
655
|
y: 1
|
|
656
656
|
}
|
|
657
|
-
},
|
|
657
|
+
}, j = [
|
|
658
658
|
"north",
|
|
659
659
|
"south",
|
|
660
660
|
"east",
|
|
@@ -663,7 +663,7 @@ var D = class e extends S {
|
|
|
663
663
|
"northwest",
|
|
664
664
|
"southeast",
|
|
665
665
|
"southwest"
|
|
666
|
-
],
|
|
666
|
+
], M = {
|
|
667
667
|
north: "south",
|
|
668
668
|
south: "north",
|
|
669
669
|
east: "west",
|
|
@@ -673,39 +673,39 @@ var D = class e extends S {
|
|
|
673
673
|
southeast: "northwest",
|
|
674
674
|
southwest: "northeast"
|
|
675
675
|
};
|
|
676
|
-
function
|
|
677
|
-
return e ? Object.prototype.hasOwnProperty.call(
|
|
676
|
+
function N(e) {
|
|
677
|
+
return e ? Object.prototype.hasOwnProperty.call(A, e) : !1;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
if (!
|
|
679
|
+
function P(e, t, n, r = 1) {
|
|
680
|
+
if (!N(n)) return {
|
|
681
681
|
x: e,
|
|
682
682
|
y: t
|
|
683
683
|
};
|
|
684
|
-
let i =
|
|
684
|
+
let i = A[n];
|
|
685
685
|
return {
|
|
686
686
|
x: e + i.x * r,
|
|
687
687
|
y: t + i.y * r
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
if (!
|
|
690
|
+
function re(e, t, n, r = 1, i = 0) {
|
|
691
|
+
if (!N(n)) return {
|
|
692
692
|
x: e,
|
|
693
693
|
y: t
|
|
694
694
|
};
|
|
695
|
-
let a =
|
|
696
|
-
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return
|
|
695
|
+
let a = A[n];
|
|
696
|
+
if (!(a.x !== 0 && a.y !== 0) || i <= 0) return P(e, t, n, r);
|
|
697
697
|
let o = r - i + i / Math.SQRT2;
|
|
698
698
|
return {
|
|
699
699
|
x: e + a.x * o,
|
|
700
700
|
y: t + a.y * o
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
if (!
|
|
703
|
+
function ie(e, t, n, r = 1) {
|
|
704
|
+
if (!N(n)) return {
|
|
705
705
|
x: e,
|
|
706
706
|
y: t
|
|
707
707
|
};
|
|
708
|
-
let i =
|
|
708
|
+
let i = A[n], a = Math.atan2(i.y, i.x);
|
|
709
709
|
return {
|
|
710
710
|
x: e + Math.cos(a) * r,
|
|
711
711
|
y: t + Math.sin(a) * r
|
|
@@ -713,32 +713,32 @@ function te(e, t, n, r = 1) {
|
|
|
713
713
|
}
|
|
714
714
|
//#endregion
|
|
715
715
|
//#region src/ExitRenderer.ts
|
|
716
|
-
var
|
|
716
|
+
var ae = {
|
|
717
717
|
OPEN_DOOR: "rgb(10, 155, 10)",
|
|
718
718
|
CLOSED_DOOR: "rgb(226, 205, 59)",
|
|
719
719
|
LOCKED_DOOR: "rgb(155, 10, 10)",
|
|
720
720
|
ONE_WAY_FILL: "rgb(155, 10, 10)"
|
|
721
721
|
};
|
|
722
|
-
function
|
|
722
|
+
function oe(e) {
|
|
723
723
|
switch (e) {
|
|
724
|
-
case 1: return
|
|
725
|
-
case 2: return
|
|
726
|
-
default: return
|
|
724
|
+
case 1: return ae.OPEN_DOOR;
|
|
725
|
+
case 2: return ae.CLOSED_DOOR;
|
|
726
|
+
default: return ae.LOCKED_DOOR;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
var
|
|
729
|
+
var se = class {
|
|
730
730
|
constructor(e, t) {
|
|
731
731
|
this.mapReader = e, this.settings = t;
|
|
732
732
|
}
|
|
733
733
|
getRoomEdgePoint(e, t, n, r) {
|
|
734
734
|
let i = r - (this.settings.borders ? this.settings.lineWidth / 2 : 0);
|
|
735
|
-
return this.settings.roomShape === "circle" ?
|
|
735
|
+
return this.settings.roomShape === "circle" ? ie(e, t, n, i) : this.settings.roomShape === "roundedRectangle" ? re(e, t, n, i, this.settings.roomSize * .2) : P(e, t, n, i);
|
|
736
736
|
}
|
|
737
737
|
renderData(e, t) {
|
|
738
738
|
return this.renderDataWithColor(e, this.settings.lineColor, t);
|
|
739
739
|
}
|
|
740
740
|
renderDataWithColor(e, t, n) {
|
|
741
|
-
let r = e.aDir &&
|
|
741
|
+
let r = e.aDir && O.includes(e.aDir), i = e.bDir && O.includes(e.bDir);
|
|
742
742
|
if (r && i) return this.renderTwoWayExitData(e, t, n);
|
|
743
743
|
if (r || i) {
|
|
744
744
|
let n = r ? "a" : "b";
|
|
@@ -747,7 +747,7 @@ var ie = class {
|
|
|
747
747
|
}
|
|
748
748
|
renderTwoWayExitData(e, t, n) {
|
|
749
749
|
let r = this.mapReader.getRoom(e.a), i = this.mapReader.getRoom(e.b);
|
|
750
|
-
if (!r || !i || !e.aDir || !e.bDir || r.customLines[
|
|
750
|
+
if (!r || !i || !e.aDir || !e.bDir || r.customLines[k[e.aDir]] && i.customLines[k[e.bDir]] || r.z !== i.z && (n !== i.z && r.customLines[k[e.aDir]] || n !== r.z && i.customLines[k[e.bDir]])) return;
|
|
751
751
|
let a = this.getRoomEdgePoint(r.x, r.y, e.aDir, this.settings.roomSize / 2), o = this.getRoomEdgePoint(i.x, i.y, e.bDir, this.settings.roomSize / 2), s = [
|
|
752
752
|
a.x,
|
|
753
753
|
a.y,
|
|
@@ -757,7 +757,7 @@ var ie = class {
|
|
|
757
757
|
points: s,
|
|
758
758
|
stroke: t,
|
|
759
759
|
strokeWidth: this.settings.lineWidth
|
|
760
|
-
}], l = [], u = r.doors[
|
|
760
|
+
}], l = [], u = r.doors[k[e.aDir]] ?? i.doors[k[e.bDir]];
|
|
761
761
|
if (u) {
|
|
762
762
|
let e = s[0] + (s[2] - s[0]) / 2, t = s[1] + (s[3] - s[1]) / 2;
|
|
763
763
|
l.push({
|
|
@@ -765,7 +765,7 @@ var ie = class {
|
|
|
765
765
|
y: t - this.settings.roomSize / 4,
|
|
766
766
|
width: this.settings.roomSize / 2,
|
|
767
767
|
height: this.settings.roomSize / 2,
|
|
768
|
-
stroke:
|
|
768
|
+
stroke: oe(u),
|
|
769
769
|
strokeWidth: this.settings.lineWidth
|
|
770
770
|
});
|
|
771
771
|
}
|
|
@@ -796,9 +796,9 @@ var ie = class {
|
|
|
796
796
|
}
|
|
797
797
|
renderOneWayExitData(e, t, n) {
|
|
798
798
|
let r = n === "a" || !n && e.aDir, i = r ? this.mapReader.getRoom(e.a) : this.mapReader.getRoom(e.b), a = r ? this.mapReader.getRoom(e.b) : this.mapReader.getRoom(e.a), o = r ? e.aDir : e.bDir;
|
|
799
|
-
if (!o || !i || !a || !
|
|
799
|
+
if (!o || !i || !a || !O.includes(o) || i.customLines[k[o] || o]) return;
|
|
800
800
|
if (i.area != a.area && o) {
|
|
801
|
-
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n =
|
|
801
|
+
let e = this.mapReader.getColorValue(a.env), t = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), n = P(i.x, i.y, o, this.settings.roomSize * 1.5), r = e;
|
|
802
802
|
return {
|
|
803
803
|
lines: [],
|
|
804
804
|
arrows: [{
|
|
@@ -837,8 +837,8 @@ var ie = class {
|
|
|
837
837
|
x: a.x,
|
|
838
838
|
y: a.y
|
|
839
839
|
};
|
|
840
|
-
s && (c =
|
|
841
|
-
let l =
|
|
840
|
+
s && (c = P(i.x, i.y, o, this.settings.roomSize / 2));
|
|
841
|
+
let l = P(i.x, i.y, o, .3), u = l.x - (l.x - c.x) / 2, d = l.y - (l.y - c.y) / 2, f = this.getRoomEdgePoint(i.x, i.y, o, this.settings.roomSize / 2), p = [
|
|
842
842
|
f.x,
|
|
843
843
|
f.y,
|
|
844
844
|
c.x,
|
|
@@ -870,7 +870,7 @@ var ie = class {
|
|
|
870
870
|
pointerWidth: .35,
|
|
871
871
|
strokeWidth: this.settings.lineWidth * 1.4,
|
|
872
872
|
stroke: t,
|
|
873
|
-
fill:
|
|
873
|
+
fill: ae.ONE_WAY_FILL,
|
|
874
874
|
dash: [.1, .05]
|
|
875
875
|
}],
|
|
876
876
|
doors: [],
|
|
@@ -925,7 +925,7 @@ var ie = class {
|
|
|
925
925
|
for (let [r, i] of Object.entries(e.customLines)) {
|
|
926
926
|
let a = e.specialExits[r];
|
|
927
927
|
if (a === void 0) {
|
|
928
|
-
let t =
|
|
928
|
+
let t = ne[r] ?? n[r];
|
|
929
929
|
t && (a = e.exits[t] ?? e.specialExits[t]);
|
|
930
930
|
}
|
|
931
931
|
if (a === void 0 && (a = e.exits[r] ?? e.specialExits[r]), a === void 0) continue;
|
|
@@ -957,7 +957,7 @@ var ie = class {
|
|
|
957
957
|
}
|
|
958
958
|
return t;
|
|
959
959
|
}
|
|
960
|
-
},
|
|
960
|
+
}, ce = {
|
|
961
961
|
1: "north",
|
|
962
962
|
2: "northeast",
|
|
963
963
|
3: "northwest",
|
|
@@ -971,15 +971,15 @@ var ie = class {
|
|
|
971
971
|
11: "in",
|
|
972
972
|
12: "out"
|
|
973
973
|
};
|
|
974
|
-
function
|
|
975
|
-
return e.roomShape === "circle" ?
|
|
974
|
+
function le(e, t, n, r, i) {
|
|
975
|
+
return e.roomShape === "circle" ? ie(t, n, r, i) : e.roomShape === "roundedRectangle" ? re(t, n, r, i, e.roomSize * .2) : P(t, n, r, i);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function ue(e, t, n) {
|
|
978
978
|
let r = [];
|
|
979
979
|
for (let i of e.stubs) {
|
|
980
|
-
let a =
|
|
980
|
+
let a = ce[i];
|
|
981
981
|
if (!a) continue;
|
|
982
|
-
let o =
|
|
982
|
+
let o = le(t, e.x, e.y, a, t.roomSize / 2), s = P(e.x, e.y, a, t.roomSize / 2 + .5);
|
|
983
983
|
r.push({
|
|
984
984
|
roomId: e.id,
|
|
985
985
|
direction: a,
|
|
@@ -995,12 +995,12 @@ function se(e, t, n) {
|
|
|
995
995
|
}
|
|
996
996
|
//#endregion
|
|
997
997
|
//#region src/scene/SpecialExitStyle.ts
|
|
998
|
-
var
|
|
998
|
+
var de = {
|
|
999
999
|
1: "rgb(10, 155, 10)",
|
|
1000
1000
|
2: "rgb(226, 205, 59)",
|
|
1001
1001
|
3: "rgb(155, 10, 10)"
|
|
1002
1002
|
};
|
|
1003
|
-
function
|
|
1003
|
+
function fe(e, t, n) {
|
|
1004
1004
|
let r = [];
|
|
1005
1005
|
for (let [i, a] of Object.entries(e.customLines)) {
|
|
1006
1006
|
let o = [e.x, e.y];
|
|
@@ -1047,7 +1047,7 @@ function le(e, t, n) {
|
|
|
1047
1047
|
y: n - r / 2,
|
|
1048
1048
|
width: r,
|
|
1049
1049
|
height: r,
|
|
1050
|
-
stroke:
|
|
1050
|
+
stroke: de[f] ?? de[3],
|
|
1051
1051
|
strokeWidth: t.lineWidth
|
|
1052
1052
|
};
|
|
1053
1053
|
}
|
|
@@ -1062,33 +1062,33 @@ function le(e, t, n) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
//#endregion
|
|
1064
1064
|
//#region src/utils/textMeasure.ts
|
|
1065
|
-
var
|
|
1066
|
-
function
|
|
1067
|
-
return
|
|
1065
|
+
var pe = 72, F = 200, me = 120, he = /* @__PURE__ */ new Map(), I = null;
|
|
1066
|
+
function ge() {
|
|
1067
|
+
return I || (I = r.Util.createCanvasElement(), I.width = F, I.height = F), I;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let n = `${e}::${t}`, r =
|
|
1069
|
+
function _e(e, t) {
|
|
1070
|
+
let n = `${e}::${t}`, r = he.get(n);
|
|
1071
1071
|
if (r !== void 0) return r;
|
|
1072
|
-
let i =
|
|
1073
|
-
i.clearRect(0, 0,
|
|
1074
|
-
let { data: o } = i.getImageData(0, 0,
|
|
1075
|
-
for (let e = 0; e <
|
|
1072
|
+
let i = ge().getContext("2d", { willReadFrequently: !0 }), a = `bold ${pe}px ${t}`;
|
|
1073
|
+
i.clearRect(0, 0, F, F), i.font = a, i.textBaseline = "alphabetic", i.textAlign = "center", i.fillStyle = "#ffffff", i.fillText(e, F / 2, me);
|
|
1074
|
+
let { data: o } = i.getImageData(0, 0, F, F), s = F, c = -1;
|
|
1075
|
+
for (let e = 0; e < F; e++) for (let t = 0; t < F; t++) o[(e * F + t) * 4 + 3] > 16 && (e < s && (s = e), e > c && (c = e));
|
|
1076
1076
|
if (c === -1) {
|
|
1077
1077
|
let e = {
|
|
1078
1078
|
baselineRatio: .35,
|
|
1079
1079
|
konvaCorrectionRatio: 0
|
|
1080
1080
|
};
|
|
1081
|
-
return
|
|
1081
|
+
return he.set(n, e), e;
|
|
1082
1082
|
}
|
|
1083
|
-
let l = (
|
|
1083
|
+
let l = (me - s - Math.max(0, c - me)) / 2 / pe, u = i.measureText("M"), d = {
|
|
1084
1084
|
baselineRatio: l,
|
|
1085
|
-
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 /
|
|
1085
|
+
konvaCorrectionRatio: ((u.fontBoundingBoxAscent ?? u.actualBoundingBoxAscent ?? 0) - (u.fontBoundingBoxDescent ?? u.actualBoundingBoxDescent ?? 0)) / 2 / pe - l
|
|
1086
1086
|
};
|
|
1087
|
-
return
|
|
1087
|
+
return he.set(n, d), d;
|
|
1088
1088
|
}
|
|
1089
1089
|
//#endregion
|
|
1090
1090
|
//#region src/scene/RoomStyle.ts
|
|
1091
|
-
function
|
|
1091
|
+
function ve(e, t, n, r) {
|
|
1092
1092
|
let i = t.getColorValue(e.env), a = n.coloredMode ? v(i, .5) : n.frameMode ? n.backgroundColor : i, o = n.coloredMode ? y(i, .1) : i;
|
|
1093
1093
|
return {
|
|
1094
1094
|
fillColor: a,
|
|
@@ -1098,7 +1098,7 @@ function he(e, t, n, r) {
|
|
|
1098
1098
|
envColor: i
|
|
1099
1099
|
};
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function ye(e, t) {
|
|
1102
1102
|
if (!t.emboss) return null;
|
|
1103
1103
|
let n = t.roomSize, r = t.borders ? t.lineWidth / 2 : 0, i = t.lineWidth, a = y(e, .35), o = v(e, .45);
|
|
1104
1104
|
if (t.roomShape === "circle") {
|
|
@@ -1202,8 +1202,8 @@ function ge(e, t) {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
//#endregion
|
|
1204
1204
|
//#region src/scene/elements/RoomLayout.ts
|
|
1205
|
-
function
|
|
1206
|
-
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } =
|
|
1205
|
+
function be(e, t, n, r) {
|
|
1206
|
+
let { fillColor: i, strokeColor: a, borderWidth: o, symbolColor: s } = ve(e, t, n, r.strokeOverride), c = n.roomSize, l = [], u = ye(i, n), d = u ? 0 : o, f = n.coloredMode && d > 0 && r.flatPipeline, p = (e) => n.roomShape === "roundedRectangle" ? Math.max(0, (c - 2 * e) * .2) : 0;
|
|
1207
1207
|
if (f) {
|
|
1208
1208
|
let e = [v(a, .5), a], t = o * 2;
|
|
1209
1209
|
n.roomShape === "circle" ? l.push({
|
|
@@ -1287,7 +1287,7 @@ function _e(e, t, n, r) {
|
|
|
1287
1287
|
lineCap: u.highlight.lineCap,
|
|
1288
1288
|
lineJoin: u.shadow.lineJoin
|
|
1289
1289
|
})), e.roomChar) {
|
|
1290
|
-
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } =
|
|
1290
|
+
let t = c * .75, { baselineRatio: r, konvaCorrectionRatio: i } = _e(e.roomChar, n.fontFamily), a = Math.max(c, e.roomChar.length * t * .8), o = (a - c) / 2;
|
|
1291
1291
|
l.push({
|
|
1292
1292
|
type: "text",
|
|
1293
1293
|
x: -o,
|
|
@@ -1320,13 +1320,13 @@ function _e(e, t, n, r) {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
//#endregion
|
|
1322
1322
|
//#region src/scene/InnerExitStyle.ts
|
|
1323
|
-
var
|
|
1323
|
+
var xe = [
|
|
1324
1324
|
"up",
|
|
1325
1325
|
"down",
|
|
1326
1326
|
"in",
|
|
1327
1327
|
"out"
|
|
1328
1328
|
];
|
|
1329
|
-
function
|
|
1329
|
+
function Se(e, t, n, r) {
|
|
1330
1330
|
let i = r * Math.PI / 180, a = [];
|
|
1331
1331
|
for (let r = 0; r < 3; r++) {
|
|
1332
1332
|
let o = 2 * Math.PI * r / 3 - Math.PI / 2, s = Math.cos(o) * n * 1.4, c = Math.sin(o) * n * .8, l = s * Math.cos(i) - c * Math.sin(i), u = s * Math.sin(i) + c * Math.cos(i);
|
|
@@ -1334,50 +1334,50 @@ function ye(e, t, n, r) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
return a;
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Ce(e, t, n) {
|
|
1338
1338
|
let r = e.userData?.["system.fallback_symbol_color"];
|
|
1339
1339
|
return {
|
|
1340
1340
|
symbolColor: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env)),
|
|
1341
1341
|
symbolFill: r ?? (n.frameMode || n.coloredMode ? t.getColorValue(e.env) : t.getSymbolColor(e.env, .6))
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
var
|
|
1344
|
+
var we = {
|
|
1345
1345
|
1: "rgb(10, 155, 10)",
|
|
1346
1346
|
2: "rgb(226, 205, 59)",
|
|
1347
1347
|
3: "rgb(155, 10, 10)"
|
|
1348
1348
|
};
|
|
1349
|
-
function
|
|
1349
|
+
function Te(e, t, n) {
|
|
1350
1350
|
let r = n.roomSize, i = r / 5, a = (e, t, n) => ({
|
|
1351
1351
|
cx: e,
|
|
1352
1352
|
cy: t,
|
|
1353
|
-
vertices:
|
|
1353
|
+
vertices: Se(e, t, i, n)
|
|
1354
1354
|
});
|
|
1355
1355
|
switch (t) {
|
|
1356
1356
|
case "up": {
|
|
1357
|
-
let t =
|
|
1357
|
+
let t = P(e.x, e.y, "south", r / 4);
|
|
1358
1358
|
return [a(t.x, t.y, 0)];
|
|
1359
1359
|
}
|
|
1360
1360
|
case "down": {
|
|
1361
|
-
let t =
|
|
1361
|
+
let t = P(e.x, e.y, "north", r / 4);
|
|
1362
1362
|
return [a(t.x, t.y, 180)];
|
|
1363
1363
|
}
|
|
1364
1364
|
case "in": {
|
|
1365
|
-
let t =
|
|
1365
|
+
let t = P(e.x, e.y, "west", r / 4), n = P(e.x, e.y, "east", r / 4);
|
|
1366
1366
|
return [a(t.x, t.y, 90), a(n.x, n.y, -90)];
|
|
1367
1367
|
}
|
|
1368
1368
|
case "out": {
|
|
1369
|
-
let t =
|
|
1369
|
+
let t = P(e.x, e.y, "west", r / 4), n = P(e.x, e.y, "east", r / 4);
|
|
1370
1370
|
return [a(t.x, t.y, -90), a(n.x, n.y, 90)];
|
|
1371
1371
|
}
|
|
1372
1372
|
default: return [];
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1376
|
-
let r = [], { symbolColor: i, symbolFill: a } =
|
|
1377
|
-
for (let t of
|
|
1375
|
+
function Ee(e, t, n) {
|
|
1376
|
+
let r = [], { symbolColor: i, symbolFill: a } = Ce(e, t, n);
|
|
1377
|
+
for (let t of xe) {
|
|
1378
1378
|
if (!e.exits[t]) continue;
|
|
1379
|
-
let o = e.doors[t], s = o === void 0 ? i :
|
|
1380
|
-
for (let i of
|
|
1379
|
+
let o = e.doors[t], s = o === void 0 ? i : we[o] ?? we[3];
|
|
1380
|
+
for (let i of Te(e, t, n)) r.push({
|
|
1381
1381
|
cx: i.cx,
|
|
1382
1382
|
cy: i.cy,
|
|
1383
1383
|
vertices: i.vertices,
|
|
@@ -1390,8 +1390,8 @@ function Ce(e, t, n) {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
//#endregion
|
|
1392
1392
|
//#region src/scene/elements/ExitLayout.ts
|
|
1393
|
-
function
|
|
1394
|
-
let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } =
|
|
1393
|
+
function De(e, t, n) {
|
|
1394
|
+
let r = n.roomSize, i = e.x - r / 2, a = e.y - r / 2, { triangles: o } = Ee(e, t, n);
|
|
1395
1395
|
return o.map((e) => {
|
|
1396
1396
|
let t = Array(e.vertices.length);
|
|
1397
1397
|
for (let n = 0; n < e.vertices.length; n += 2) t[n] = e.vertices[n] - i, t[n + 1] = e.vertices[n + 1] - a;
|
|
@@ -1406,7 +1406,7 @@ function we(e, t, n) {
|
|
|
1406
1406
|
};
|
|
1407
1407
|
});
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1409
|
+
function Oe(e, t) {
|
|
1410
1410
|
let n = [];
|
|
1411
1411
|
for (let t of e.lines) n.push({
|
|
1412
1412
|
type: "line",
|
|
@@ -1417,7 +1417,7 @@ function Te(e, t) {
|
|
|
1417
1417
|
dash: t.dash
|
|
1418
1418
|
}
|
|
1419
1419
|
});
|
|
1420
|
-
for (let t of e.arrows)
|
|
1420
|
+
for (let t of e.arrows) ke(n, t);
|
|
1421
1421
|
for (let t of e.doors) n.push({
|
|
1422
1422
|
type: "rect",
|
|
1423
1423
|
x: t.x,
|
|
@@ -1438,7 +1438,7 @@ function Te(e, t) {
|
|
|
1438
1438
|
children: n
|
|
1439
1439
|
};
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function ke(e, t) {
|
|
1442
1442
|
e.push({
|
|
1443
1443
|
type: "line",
|
|
1444
1444
|
points: t.points,
|
|
@@ -1468,7 +1468,7 @@ function Ee(e, t) {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
//#endregion
|
|
1470
1470
|
//#region src/scene/elements/SpecialExitLayout.ts
|
|
1471
|
-
function
|
|
1471
|
+
function Ae(e, t) {
|
|
1472
1472
|
let n = [];
|
|
1473
1473
|
if (n.push({
|
|
1474
1474
|
type: "line",
|
|
@@ -1529,7 +1529,7 @@ function De(e, t) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
//#endregion
|
|
1531
1531
|
//#region src/scene/elements/StubLayout.ts
|
|
1532
|
-
function
|
|
1532
|
+
function je(e) {
|
|
1533
1533
|
return {
|
|
1534
1534
|
type: "group",
|
|
1535
1535
|
x: 0,
|
|
@@ -1557,11 +1557,11 @@ function Oe(e) {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
//#endregion
|
|
1559
1559
|
//#region src/scene/elements/LabelLayout.ts
|
|
1560
|
-
function
|
|
1560
|
+
function Me(e) {
|
|
1561
1561
|
let t = (e?.alpha ?? 255) / 255, n = (e) => Math.min(255, Math.max(0, e ?? 0));
|
|
1562
1562
|
return `rgba(${n(e?.r)}, ${n(e?.g)}, ${n(e?.b)}, ${t})`;
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1564
|
+
function Ne(e, t) {
|
|
1565
1565
|
if (t.labelRenderMode === "none") return null;
|
|
1566
1566
|
let n = e.X, r = -e.Y, i = !!e.noScaling, a = i ? n : 0, o = i ? r : 0, s = i ? 0 : n, c = i ? 0 : r;
|
|
1567
1567
|
if (t.labelRenderMode === "image" && e.pixMap) return {
|
|
@@ -1590,7 +1590,7 @@ function Ae(e, t) {
|
|
|
1590
1590
|
y: c,
|
|
1591
1591
|
width: e.Width,
|
|
1592
1592
|
height: e.Height,
|
|
1593
|
-
paint: { fill:
|
|
1593
|
+
paint: { fill: Me(e.BgColor) }
|
|
1594
1594
|
}), e.Text) {
|
|
1595
1595
|
let t = Math.min(.75, e.Width / Math.max(e.Text.length / 2, 1)), n = Math.max(.1, Math.min(t, Math.max(e.Height * .9, .1)));
|
|
1596
1596
|
l.push({
|
|
@@ -1601,7 +1601,7 @@ function Ae(e, t) {
|
|
|
1601
1601
|
height: e.Height,
|
|
1602
1602
|
text: e.Text,
|
|
1603
1603
|
fontSize: n,
|
|
1604
|
-
fill:
|
|
1604
|
+
fill: Me(e.FgColor),
|
|
1605
1605
|
align: "center",
|
|
1606
1606
|
verticalAlign: "middle"
|
|
1607
1607
|
});
|
|
@@ -1621,11 +1621,11 @@ function Ae(e, t) {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
//#endregion
|
|
1623
1623
|
//#region src/ScenePipeline.ts
|
|
1624
|
-
function
|
|
1625
|
-
let n =
|
|
1624
|
+
function Pe(e, t) {
|
|
1625
|
+
let n = Fe(e);
|
|
1626
1626
|
return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${t})` : e;
|
|
1627
1627
|
}
|
|
1628
|
-
function
|
|
1628
|
+
function Fe(e) {
|
|
1629
1629
|
let t = e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
1630
1630
|
if (t) return {
|
|
1631
1631
|
r: +t[1],
|
|
@@ -1638,11 +1638,11 @@ function Me(e) {
|
|
|
1638
1638
|
b: parseInt(e.slice(5, 7), 16)
|
|
1639
1639
|
};
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1642
|
-
let r =
|
|
1641
|
+
function Ie(e, t, n) {
|
|
1642
|
+
let r = Fe(e), i = Fe(t);
|
|
1643
1643
|
return !r || !i ? e : `rgb(${Math.round(r.r * n + i.r * (1 - n))}, ${Math.round(r.g * n + i.g * (1 - n))}, ${Math.round(r.b * n + i.b * (1 - n))})`;
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function Le(e, t) {
|
|
1646
1646
|
let n = t * t, r = [];
|
|
1647
1647
|
outer: for (let t of e) {
|
|
1648
1648
|
for (let e of r) for (let r of e) {
|
|
@@ -1656,9 +1656,9 @@ function Pe(e, t) {
|
|
|
1656
1656
|
}
|
|
1657
1657
|
return r;
|
|
1658
1658
|
}
|
|
1659
|
-
var
|
|
1659
|
+
var Re = class {
|
|
1660
1660
|
constructor(e, t) {
|
|
1661
|
-
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new
|
|
1661
|
+
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.mapReader = e, this.settings = t, this.exitRenderer = new se(e, t);
|
|
1662
1662
|
}
|
|
1663
1663
|
buildScene(e, t, n, r = C) {
|
|
1664
1664
|
this.linkShapes = [], this.roomShapes = [], this.topLabelShapes = [], this.labelShapeRefs = [], this.specialExitShapeRefs = [], this.stubShapeRefs = [], this.areaExitLabelShapeRefs = [], this.renderLabels(t.getLabels(), e.getAreaId());
|
|
@@ -1697,10 +1697,10 @@ var B = class {
|
|
|
1697
1697
|
renderRooms(e, t) {
|
|
1698
1698
|
let n = /* @__PURE__ */ new Map(), r = [], i = [], a = [], o = [];
|
|
1699
1699
|
e.forEach((e) => {
|
|
1700
|
-
let t =
|
|
1701
|
-
t.children.push(...
|
|
1702
|
-
for (let t of
|
|
1703
|
-
let n =
|
|
1700
|
+
let t = be(e, this.mapReader, this.settings, { flatPipeline: !0 });
|
|
1701
|
+
t.children.push(...De(e, this.mapReader, this.settings));
|
|
1702
|
+
for (let t of fe(e, this.settings)) {
|
|
1703
|
+
let n = Ae(t, e.id);
|
|
1704
1704
|
this.linkShapes.push(n);
|
|
1705
1705
|
let r = t.line.points, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
|
|
1706
1706
|
for (let e = 0; e < r.length; e += 2) r[e] < a && (a = r[e]), r[e] > s && (s = r[e]), r[e + 1] < o && (o = r[e + 1]), r[e + 1] > c && (c = r[e + 1]);
|
|
@@ -1745,8 +1745,8 @@ var B = class {
|
|
|
1745
1745
|
arrowColor: e.arrowColor
|
|
1746
1746
|
});
|
|
1747
1747
|
});
|
|
1748
|
-
for (let t of
|
|
1749
|
-
let e =
|
|
1748
|
+
for (let t of ue(e, this.settings)) {
|
|
1749
|
+
let e = je(t);
|
|
1750
1750
|
this.linkShapes.push(e), a.push({
|
|
1751
1751
|
roomId: t.roomId,
|
|
1752
1752
|
direction: t.direction,
|
|
@@ -1793,7 +1793,7 @@ var B = class {
|
|
|
1793
1793
|
}
|
|
1794
1794
|
let l = this.exitRenderer.renderData(e, t);
|
|
1795
1795
|
if (!l) return;
|
|
1796
|
-
let u =
|
|
1796
|
+
let u = Oe(l, {
|
|
1797
1797
|
kind: "exit",
|
|
1798
1798
|
id: `${e.a}:${e.b}:${e.aDir ?? ""}:${e.bDir ?? ""}`,
|
|
1799
1799
|
payload: {
|
|
@@ -1833,8 +1833,8 @@ var B = class {
|
|
|
1833
1833
|
let i = r.isVisible(t);
|
|
1834
1834
|
if (i === r.isVisible(n)) return;
|
|
1835
1835
|
let a = i ? t : n, o = i ? e.aDir : e.bDir;
|
|
1836
|
-
if (!o || !
|
|
1837
|
-
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l =
|
|
1836
|
+
if (!o || !O.includes(o) || a.customLines[k[o]]) return;
|
|
1837
|
+
let s = this.settings.roomSize, c = this.getRoomEdgePoint(a.x, a.y, o, s / 2), l = P(a.x, a.y, o, s / 2 + .5);
|
|
1838
1838
|
return {
|
|
1839
1839
|
roomId: a.id,
|
|
1840
1840
|
direction: o,
|
|
@@ -1847,7 +1847,7 @@ var B = class {
|
|
|
1847
1847
|
};
|
|
1848
1848
|
}
|
|
1849
1849
|
emitLensStub(e) {
|
|
1850
|
-
let t =
|
|
1850
|
+
let t = je(e);
|
|
1851
1851
|
this.linkShapes.push(t), this.stubShapeRefs.push({
|
|
1852
1852
|
shape: t,
|
|
1853
1853
|
bounds: {
|
|
@@ -1859,14 +1859,14 @@ var B = class {
|
|
|
1859
1859
|
});
|
|
1860
1860
|
}
|
|
1861
1861
|
getRoomEdgePoint(e, t, n, r) {
|
|
1862
|
-
return this.settings.roomShape === "circle" ?
|
|
1862
|
+
return this.settings.roomShape === "circle" ? ie(e, t, n, r) : this.settings.roomShape === "roundedRectangle" ? re(e, t, n, r, this.settings.roomSize * .2) : P(e, t, n, r);
|
|
1863
1863
|
}
|
|
1864
1864
|
buildExitShape(e) {
|
|
1865
|
-
return
|
|
1865
|
+
return Oe(e);
|
|
1866
1866
|
}
|
|
1867
1867
|
renderLabels(e, t) {
|
|
1868
1868
|
for (let n of e) {
|
|
1869
|
-
let e =
|
|
1869
|
+
let e = Ne(n, this.settings);
|
|
1870
1870
|
e && (e.hit = {
|
|
1871
1871
|
kind: "label",
|
|
1872
1872
|
id: n.labelId,
|
|
@@ -1928,50 +1928,50 @@ var B = class {
|
|
|
1928
1928
|
], x = (e, t, n) => {
|
|
1929
1929
|
let i = t.length * l + s * 2, a = u + c * 2, o = 0, d = 0, f = 0, p = 0, m = Infinity, _ = -Infinity, v = Infinity, x = -Infinity, S = /* @__PURE__ */ new Map();
|
|
1930
1930
|
for (let t of e) o += t.tip.x, d += t.tip.y, f += t.dir.x, p += t.dir.y, t.tip.x < m && (m = t.tip.x), t.tip.x > _ && (_ = t.tip.x), t.tip.y < v && (v = t.tip.y), t.tip.y > x && (x = t.tip.y), S.set(t.color, (S.get(t.color) ?? 0) + 1);
|
|
1931
|
-
let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0,
|
|
1931
|
+
let C = e.length, w = Math.hypot(f, p), T = w > 0 ? f / w : 0, ee = w > 0 ? p / w : 0, E = 0;
|
|
1932
1932
|
for (let t = 0; t < e.length; t++) for (let n = t + 1; n < e.length; n++) {
|
|
1933
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);
|
|
1934
|
-
a >
|
|
1934
|
+
a > E && (E = a);
|
|
1935
1935
|
}
|
|
1936
|
-
let
|
|
1937
|
-
for (let [e, t] of S) t >
|
|
1938
|
-
let
|
|
1939
|
-
if (
|
|
1940
|
-
let e =
|
|
1941
|
-
|
|
1942
|
-
x:
|
|
1943
|
-
y:
|
|
1936
|
+
let D = E > 3, te = w / C >= .4, O = n?.x ?? (D ? (m + _) / 2 : o / C), ne = n?.y ?? (D ? (v + x) / 2 : d / C), k = "white", A = 0;
|
|
1937
|
+
for (let [e, t] of S) t > A && (k = e, A = t);
|
|
1938
|
+
let j = h.concat(g).concat(r), M = (e, t, n = 0) => .5 + n + Math.abs(e) * i / 2 + Math.abs(t) * a / 2, N = [];
|
|
1939
|
+
if (te) {
|
|
1940
|
+
let e = M(T, ee);
|
|
1941
|
+
N.push({
|
|
1942
|
+
x: O + T * e,
|
|
1943
|
+
y: ne + ee * e
|
|
1944
1944
|
});
|
|
1945
1945
|
}
|
|
1946
|
-
|
|
1947
|
-
x:
|
|
1948
|
-
y:
|
|
1946
|
+
N.push({
|
|
1947
|
+
x: O,
|
|
1948
|
+
y: ne
|
|
1949
1949
|
});
|
|
1950
1950
|
for (let e of [
|
|
1951
1951
|
0,
|
|
1952
1952
|
.6,
|
|
1953
1953
|
1.4
|
|
1954
1954
|
]) for (let [t, n] of b) {
|
|
1955
|
-
let r =
|
|
1956
|
-
|
|
1957
|
-
x:
|
|
1958
|
-
y:
|
|
1955
|
+
let r = M(t, n, e);
|
|
1956
|
+
N.push({
|
|
1957
|
+
x: O + t * r,
|
|
1958
|
+
y: ne + n * r
|
|
1959
1959
|
});
|
|
1960
1960
|
}
|
|
1961
|
-
for (let t of
|
|
1961
|
+
for (let t of N) {
|
|
1962
1962
|
let n = t.x - i / 2, r = t.y - a / 2;
|
|
1963
|
-
if (!y(n, r, i, a,
|
|
1963
|
+
if (!y(n, r, i, a, j)) return {
|
|
1964
1964
|
cluster: e,
|
|
1965
1965
|
boxX: n,
|
|
1966
1966
|
boxY: r,
|
|
1967
1967
|
boxW: i,
|
|
1968
1968
|
boxH: a,
|
|
1969
|
-
color:
|
|
1969
|
+
color: k
|
|
1970
1970
|
};
|
|
1971
1971
|
}
|
|
1972
1972
|
};
|
|
1973
1973
|
for (let [e, t] of a) {
|
|
1974
|
-
let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r =
|
|
1974
|
+
let n = this.mapReader.getArea(e)?.getAreaName() || `Area ${e}`, r = Le(t, 10).map((e) => x(e, n)).filter((e) => e !== void 0), a = !0;
|
|
1975
1975
|
for (; a && r.length > 1;) {
|
|
1976
1976
|
a = !1;
|
|
1977
1977
|
outer: for (let e = 0; e < r.length; e++) for (let t = e + 1; t < r.length; t++) {
|
|
@@ -1997,7 +1997,7 @@ var B = class {
|
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
1999
|
for (let e of r) {
|
|
2000
|
-
let t =
|
|
2000
|
+
let t = Pe(e.color, f), r = _(Ie(e.color, this.settings.backgroundColor, f)) > .55 ? "#000" : "#fff", a = {
|
|
2001
2001
|
type: "group",
|
|
2002
2002
|
x: 0,
|
|
2003
2003
|
y: 0,
|
|
@@ -2073,7 +2073,7 @@ var B = class {
|
|
|
2073
2073
|
};
|
|
2074
2074
|
//#endregion
|
|
2075
2075
|
//#region src/scene/elements/GridLayout.ts
|
|
2076
|
-
function
|
|
2076
|
+
function ze(e, t, n = {}) {
|
|
2077
2077
|
if (!t.gridEnabled) return [];
|
|
2078
2078
|
let r = n.inverseTransform ?? ((e, t) => ({
|
|
2079
2079
|
x: e,
|
|
@@ -2110,11 +2110,11 @@ function Fe(e, t, n = {}) {
|
|
|
2110
2110
|
}
|
|
2111
2111
|
//#endregion
|
|
2112
2112
|
//#region src/export/clipSceneToViewport.ts
|
|
2113
|
-
function
|
|
2113
|
+
function Be(e, t, n, r) {
|
|
2114
2114
|
if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
|
|
2115
2115
|
let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
|
|
2116
2116
|
if (l) {
|
|
2117
|
-
let c =
|
|
2117
|
+
let c = Ve(e, t, n, r, l);
|
|
2118
2118
|
return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
|
|
2119
2119
|
}
|
|
2120
2120
|
return n >= i && e <= a && r >= o && t <= s;
|
|
@@ -2127,7 +2127,7 @@ function Ie(e, t, n, r) {
|
|
|
2127
2127
|
for (let { shape: t, bounds: n } of e.areaExitLabelShapeRefs) d.set(t, u(n.x, n.y, n.x + n.width, n.y + n.height));
|
|
2128
2128
|
return d;
|
|
2129
2129
|
}
|
|
2130
|
-
function
|
|
2130
|
+
function Ve(e, t, n, r, i) {
|
|
2131
2131
|
let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
|
|
2132
2132
|
return {
|
|
2133
2133
|
minX: Math.min(a.x, o.x, s.x, c.x),
|
|
@@ -2136,13 +2136,13 @@ function Le(e, t, n, r, i) {
|
|
|
2136
2136
|
maxY: Math.max(a.y, o.y, s.y, c.y)
|
|
2137
2137
|
};
|
|
2138
2138
|
}
|
|
2139
|
-
function
|
|
2140
|
-
let i =
|
|
2139
|
+
function He(e, t, n, r) {
|
|
2140
|
+
let i = ze(t, n, { inverseTransform: r?.inverse });
|
|
2141
2141
|
if (!n.cullingEnabled) return {
|
|
2142
2142
|
...e.sceneShapes,
|
|
2143
2143
|
grid: i
|
|
2144
2144
|
};
|
|
2145
|
-
let a =
|
|
2145
|
+
let a = Be(e, t, n, r);
|
|
2146
2146
|
return {
|
|
2147
2147
|
grid: i,
|
|
2148
2148
|
link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
|
|
@@ -2152,14 +2152,14 @@ function Re(e, t, n, r) {
|
|
|
2152
2152
|
}
|
|
2153
2153
|
//#endregion
|
|
2154
2154
|
//#region src/rendering/SceneManager.ts
|
|
2155
|
-
var
|
|
2155
|
+
var Ue = {
|
|
2156
2156
|
grid: [],
|
|
2157
2157
|
link: [],
|
|
2158
2158
|
room: [],
|
|
2159
2159
|
topLabel: []
|
|
2160
|
-
},
|
|
2160
|
+
}, We = class {
|
|
2161
2161
|
constructor(e, t, n) {
|
|
2162
|
-
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 Re(n, t);
|
|
2163
2163
|
}
|
|
2164
2164
|
get exitRenderer() {
|
|
2165
2165
|
return this.pipeline.exitRenderer;
|
|
@@ -2192,23 +2192,23 @@ var ze = {
|
|
|
2192
2192
|
this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
|
|
2193
2193
|
}
|
|
2194
2194
|
resetPipeline(e) {
|
|
2195
|
-
this.pipeline = new
|
|
2195
|
+
this.pipeline = new Re(e, this.settings), this.reset();
|
|
2196
2196
|
}
|
|
2197
|
-
cullInteractive(e =
|
|
2197
|
+
cullInteractive(e = D) {
|
|
2198
2198
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
2199
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e ===
|
|
2200
|
-
return
|
|
2199
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === D ? void 0 : { forward: e };
|
|
2200
|
+
return Be(this.lastBuildResult, t, this.settings, n);
|
|
2201
2201
|
}
|
|
2202
|
-
cull(e =
|
|
2202
|
+
cull(e = D) {
|
|
2203
2203
|
if (!this.lastBuildResult) return {
|
|
2204
|
-
shapes:
|
|
2204
|
+
shapes: Ue,
|
|
2205
2205
|
stats: {
|
|
2206
2206
|
visibleRooms: 0,
|
|
2207
2207
|
totalRooms: 0,
|
|
2208
2208
|
visibleExits: 0
|
|
2209
2209
|
}
|
|
2210
2210
|
};
|
|
2211
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e ===
|
|
2211
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === D ? void 0 : { forward: e }, r = He(this.lastBuildResult, t, this.settings, n);
|
|
2212
2212
|
return {
|
|
2213
2213
|
shapes: r,
|
|
2214
2214
|
stats: {
|
|
@@ -2218,7 +2218,7 @@ var ze = {
|
|
|
2218
2218
|
}
|
|
2219
2219
|
};
|
|
2220
2220
|
}
|
|
2221
|
-
},
|
|
2221
|
+
}, Ge = class {
|
|
2222
2222
|
setCursor(e) {
|
|
2223
2223
|
this.container.dataset.editorCursor || (this.container.style.cursor = e);
|
|
2224
2224
|
}
|
|
@@ -2412,14 +2412,27 @@ var ze = {
|
|
|
2412
2412
|
}
|
|
2413
2413
|
};
|
|
2414
2414
|
//#endregion
|
|
2415
|
+
//#region src/render/canvasGradient.ts
|
|
2416
|
+
function L(e, t) {
|
|
2417
|
+
if (typeof t == "string") return t;
|
|
2418
|
+
if (t.type === "linear") {
|
|
2419
|
+
let n = e.createLinearGradient(t.x0, t.y0, t.x1, t.y1);
|
|
2420
|
+
for (let e of t.stops) n.addColorStop(e.offset, e.color);
|
|
2421
|
+
return n;
|
|
2422
|
+
}
|
|
2423
|
+
let n = t.fx ?? t.cx, r = t.fy ?? t.cy, i = t.fr ?? 0, a = e.createRadialGradient(n, r, i, t.cx, t.cy, t.r);
|
|
2424
|
+
for (let e of t.stops) a.addColorStop(e.offset, e.color);
|
|
2425
|
+
return a;
|
|
2426
|
+
}
|
|
2427
|
+
//#endregion
|
|
2415
2428
|
//#region src/render/RecordingLayer.ts
|
|
2416
|
-
function
|
|
2429
|
+
function Ke(e, t) {
|
|
2417
2430
|
switch (t.type) {
|
|
2418
2431
|
case "rect":
|
|
2419
|
-
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
2432
|
+
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = L(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
2420
2433
|
break;
|
|
2421
2434
|
case "circle":
|
|
2422
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
2435
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = L(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
2423
2436
|
break;
|
|
2424
2437
|
case "line": {
|
|
2425
2438
|
if (t.points.length < 4) break;
|
|
@@ -2433,7 +2446,7 @@ function He(e, t) {
|
|
|
2433
2446
|
if (t.vertices.length < 4) break;
|
|
2434
2447
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
2435
2448
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
2436
|
-
e.closePath(), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
2449
|
+
e.closePath(), t.fill && (e.fillStyle = L(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
2437
2450
|
break;
|
|
2438
2451
|
case "text": {
|
|
2439
2452
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -2470,7 +2483,7 @@ function He(e, t) {
|
|
|
2470
2483
|
break;
|
|
2471
2484
|
}
|
|
2472
2485
|
}
|
|
2473
|
-
var
|
|
2486
|
+
var qe = class {
|
|
2474
2487
|
constructor(e, t) {
|
|
2475
2488
|
this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
|
|
2476
2489
|
}
|
|
@@ -2511,11 +2524,11 @@ var Ue = class {
|
|
|
2511
2524
|
perfectDrawEnabled: !1,
|
|
2512
2525
|
sceneFunc: (e) => {
|
|
2513
2526
|
let n = e._context;
|
|
2514
|
-
for (let e of t)
|
|
2527
|
+
for (let e of t) Ke(n, e);
|
|
2515
2528
|
}
|
|
2516
2529
|
})), this._konvaGroup = e, e;
|
|
2517
2530
|
}
|
|
2518
|
-
},
|
|
2531
|
+
}, Je = class {
|
|
2519
2532
|
constructor(e) {
|
|
2520
2533
|
this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
|
|
2521
2534
|
let t = this;
|
|
@@ -2528,7 +2541,7 @@ var Ue = class {
|
|
|
2528
2541
|
if (!e.visible) continue;
|
|
2529
2542
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
2530
2543
|
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
2531
|
-
for (let t of e.commands)
|
|
2544
|
+
for (let t of e.commands) Ke(n, t);
|
|
2532
2545
|
}
|
|
2533
2546
|
n.setTransform(r);
|
|
2534
2547
|
}
|
|
@@ -2556,7 +2569,7 @@ var Ue = class {
|
|
|
2556
2569
|
ensureShape() {
|
|
2557
2570
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2558
2571
|
}
|
|
2559
|
-
},
|
|
2572
|
+
}, R = class {
|
|
2560
2573
|
constructor(e) {
|
|
2561
2574
|
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
2562
2575
|
let t = this;
|
|
@@ -2569,7 +2582,7 @@ var Ue = class {
|
|
|
2569
2582
|
if (!e._visible) continue;
|
|
2570
2583
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
2571
2584
|
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
2572
|
-
for (let t of e.commands)
|
|
2585
|
+
for (let t of e.commands) Ke(n, t);
|
|
2573
2586
|
}
|
|
2574
2587
|
n.setTransform(r);
|
|
2575
2588
|
}
|
|
@@ -2587,7 +2600,7 @@ var Ue = class {
|
|
|
2587
2600
|
ensureShape() {
|
|
2588
2601
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
2589
2602
|
}
|
|
2590
|
-
},
|
|
2603
|
+
}, Ye = class {
|
|
2591
2604
|
constructor(e) {
|
|
2592
2605
|
this.konvaLayer = e;
|
|
2593
2606
|
}
|
|
@@ -2602,15 +2615,39 @@ var Ue = class {
|
|
|
2602
2615
|
}
|
|
2603
2616
|
};
|
|
2604
2617
|
//#endregion
|
|
2618
|
+
//#region src/scene/Shape.ts
|
|
2619
|
+
function Xe(e) {
|
|
2620
|
+
return typeof e == "object" && !!e;
|
|
2621
|
+
}
|
|
2622
|
+
function z(e, t, n, r, i, a) {
|
|
2623
|
+
return Xe(e) ? e.type === "linear" ? {
|
|
2624
|
+
type: "linear",
|
|
2625
|
+
x0: (t + e.x0) * r + i,
|
|
2626
|
+
y0: (n + e.y0) * r + a,
|
|
2627
|
+
x1: (t + e.x1) * r + i,
|
|
2628
|
+
y1: (n + e.y1) * r + a,
|
|
2629
|
+
stops: e.stops
|
|
2630
|
+
} : {
|
|
2631
|
+
type: "radial",
|
|
2632
|
+
cx: (t + e.cx) * r + i,
|
|
2633
|
+
cy: (n + e.cy) * r + a,
|
|
2634
|
+
r: e.r * r,
|
|
2635
|
+
fx: e.fx === void 0 ? void 0 : (t + e.fx) * r + i,
|
|
2636
|
+
fy: e.fy === void 0 ? void 0 : (n + e.fy) * r + a,
|
|
2637
|
+
fr: e.fr === void 0 ? void 0 : e.fr * r,
|
|
2638
|
+
stops: e.stops
|
|
2639
|
+
} : e;
|
|
2640
|
+
}
|
|
2641
|
+
//#endregion
|
|
2605
2642
|
//#region src/render/shapeToRecording.ts
|
|
2606
|
-
function
|
|
2607
|
-
let t = new
|
|
2608
|
-
return e.noScale && (t.noScaling = !0),
|
|
2643
|
+
function Ze(e) {
|
|
2644
|
+
let t = new qe(e.x, e.y);
|
|
2645
|
+
return e.noScale && (t.noScaling = !0), Qe(t, e.children, 0, 0), t;
|
|
2609
2646
|
}
|
|
2610
|
-
function
|
|
2611
|
-
for (let i of t)
|
|
2647
|
+
function Qe(e, t, n, r) {
|
|
2648
|
+
for (let i of t) $e(e, i, n, r);
|
|
2612
2649
|
}
|
|
2613
|
-
function
|
|
2650
|
+
function $e(e, t, n, r) {
|
|
2614
2651
|
switch (t.type) {
|
|
2615
2652
|
case "rect":
|
|
2616
2653
|
e.commands.push({
|
|
@@ -2619,7 +2656,7 @@ function Je(e, t, n, r) {
|
|
|
2619
2656
|
y: t.y + r,
|
|
2620
2657
|
w: t.width,
|
|
2621
2658
|
h: t.height,
|
|
2622
|
-
fill: t.paint.fill,
|
|
2659
|
+
fill: z(t.paint.fill, n, r, 1, 0, 0),
|
|
2623
2660
|
stroke: t.paint.stroke,
|
|
2624
2661
|
sw: t.paint.strokeWidth ?? 0,
|
|
2625
2662
|
cr: t.cornerRadius ?? 0,
|
|
@@ -2632,14 +2669,14 @@ function Je(e, t, n, r) {
|
|
|
2632
2669
|
cx: t.cx + n,
|
|
2633
2670
|
cy: t.cy + r,
|
|
2634
2671
|
r: t.radius,
|
|
2635
|
-
fill: t.paint.fill,
|
|
2672
|
+
fill: z(t.paint.fill, n, r, 1, 0, 0),
|
|
2636
2673
|
stroke: t.paint.stroke,
|
|
2637
2674
|
sw: t.paint.strokeWidth ?? 0,
|
|
2638
2675
|
dash: t.paint.dashEnabled !== !1 && t.paint.dash ? t.paint.dash : void 0
|
|
2639
2676
|
});
|
|
2640
2677
|
return;
|
|
2641
2678
|
case "line": {
|
|
2642
|
-
let i = n === 0 && r === 0 ? t.points :
|
|
2679
|
+
let i = n === 0 && r === 0 ? t.points : et(t.points, n, r);
|
|
2643
2680
|
e.commands.push({
|
|
2644
2681
|
type: "line",
|
|
2645
2682
|
points: i,
|
|
@@ -2655,8 +2692,8 @@ function Je(e, t, n, r) {
|
|
|
2655
2692
|
case "polygon":
|
|
2656
2693
|
e.commands.push({
|
|
2657
2694
|
type: "polygon",
|
|
2658
|
-
vertices: n === 0 && r === 0 ? t.vertices :
|
|
2659
|
-
fill: t.paint.fill,
|
|
2695
|
+
vertices: n === 0 && r === 0 ? t.vertices : et(t.vertices, n, r),
|
|
2696
|
+
fill: z(t.paint.fill, n, r, 1, 0, 0),
|
|
2660
2697
|
stroke: t.paint.stroke,
|
|
2661
2698
|
sw: t.paint.strokeWidth ?? 0
|
|
2662
2699
|
});
|
|
@@ -2682,7 +2719,7 @@ function Je(e, t, n, r) {
|
|
|
2682
2719
|
});
|
|
2683
2720
|
return;
|
|
2684
2721
|
case "image": {
|
|
2685
|
-
let i =
|
|
2722
|
+
let i = tt(t.src);
|
|
2686
2723
|
e.commands.push({
|
|
2687
2724
|
type: "image",
|
|
2688
2725
|
x: t.x + n,
|
|
@@ -2695,35 +2732,35 @@ function Je(e, t, n, r) {
|
|
|
2695
2732
|
return;
|
|
2696
2733
|
}
|
|
2697
2734
|
case "group":
|
|
2698
|
-
|
|
2735
|
+
Qe(e, t.children, n + t.x, r + t.y);
|
|
2699
2736
|
return;
|
|
2700
2737
|
}
|
|
2701
2738
|
}
|
|
2702
|
-
function
|
|
2739
|
+
function et(e, t, n) {
|
|
2703
2740
|
let r = Array(e.length);
|
|
2704
2741
|
for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
|
|
2705
2742
|
return r;
|
|
2706
2743
|
}
|
|
2707
|
-
function
|
|
2744
|
+
function tt(e) {
|
|
2708
2745
|
let t = r === void 0 ? typeof Image < "u" ? new Image() : null : r.Util.createImageElement();
|
|
2709
2746
|
return t && (t.src = e), t;
|
|
2710
2747
|
}
|
|
2711
2748
|
//#endregion
|
|
2712
2749
|
//#region src/PathData.ts
|
|
2713
|
-
var
|
|
2750
|
+
var B = [
|
|
2714
2751
|
"up",
|
|
2715
2752
|
"down",
|
|
2716
2753
|
"in",
|
|
2717
2754
|
"out"
|
|
2718
2755
|
];
|
|
2719
|
-
function
|
|
2720
|
-
return e.roomShape === "circle" ?
|
|
2756
|
+
function V(e, t, n, r, i) {
|
|
2757
|
+
return e.roomShape === "circle" ? ie(t, n, r, i) : e.roomShape === "roundedRectangle" ? re(t, n, r, i, e.roomSize * .2) : P(t, n, r, i);
|
|
2721
2758
|
}
|
|
2722
|
-
function
|
|
2759
|
+
function nt(e, t, n) {
|
|
2723
2760
|
for (let [e, r] of Object.entries(t.exits)) if (r === n.id) {
|
|
2724
2761
|
let r = e;
|
|
2725
|
-
if (
|
|
2726
|
-
let e =
|
|
2762
|
+
if (B.includes(r)) {
|
|
2763
|
+
let e = k[r];
|
|
2727
2764
|
return {
|
|
2728
2765
|
type: "inner",
|
|
2729
2766
|
fromDir: r,
|
|
@@ -2732,7 +2769,7 @@ function Qe(e, t, n) {
|
|
|
2732
2769
|
toRoom: n
|
|
2733
2770
|
};
|
|
2734
2771
|
}
|
|
2735
|
-
let i =
|
|
2772
|
+
let i = k[r];
|
|
2736
2773
|
return t.customLines[i] ? {
|
|
2737
2774
|
type: "special",
|
|
2738
2775
|
fromDir: r,
|
|
@@ -2748,7 +2785,7 @@ function Qe(e, t, n) {
|
|
|
2748
2785
|
} : {
|
|
2749
2786
|
type: "regular",
|
|
2750
2787
|
fromDir: r,
|
|
2751
|
-
toDir:
|
|
2788
|
+
toDir: rt(n, t.id),
|
|
2752
2789
|
fromRoom: t,
|
|
2753
2790
|
toRoom: n
|
|
2754
2791
|
};
|
|
@@ -2765,8 +2802,8 @@ function Qe(e, t, n) {
|
|
|
2765
2802
|
};
|
|
2766
2803
|
for (let [e, r] of Object.entries(n.exits)) if (r === t.id) {
|
|
2767
2804
|
let r = e;
|
|
2768
|
-
if (
|
|
2769
|
-
let e =
|
|
2805
|
+
if (B.includes(r)) {
|
|
2806
|
+
let e = k[r];
|
|
2770
2807
|
return {
|
|
2771
2808
|
type: "inner",
|
|
2772
2809
|
toDir: r,
|
|
@@ -2775,7 +2812,7 @@ function Qe(e, t, n) {
|
|
|
2775
2812
|
toRoom: n
|
|
2776
2813
|
};
|
|
2777
2814
|
}
|
|
2778
|
-
let i =
|
|
2815
|
+
let i = k[r];
|
|
2779
2816
|
return n.customLines[i] ? {
|
|
2780
2817
|
type: "special",
|
|
2781
2818
|
toDir: r,
|
|
@@ -2811,39 +2848,39 @@ function Qe(e, t, n) {
|
|
|
2811
2848
|
toRoom: n
|
|
2812
2849
|
};
|
|
2813
2850
|
}
|
|
2814
|
-
function
|
|
2851
|
+
function rt(e, t) {
|
|
2815
2852
|
for (let [n, r] of Object.entries(e.exits)) if (r === t) return n;
|
|
2816
2853
|
}
|
|
2817
|
-
function
|
|
2854
|
+
function it(e, t, n) {
|
|
2818
2855
|
return e ? e.area === t && e.z === n : !1;
|
|
2819
2856
|
}
|
|
2820
|
-
function
|
|
2857
|
+
function at(e, t) {
|
|
2821
2858
|
for (let [n, r] of Object.entries(e.exits)) if (r === t.id) return { direction: n };
|
|
2822
2859
|
for (let [n, r] of Object.entries(e.specialExits)) if (r === t.id) return;
|
|
2823
2860
|
}
|
|
2824
|
-
function
|
|
2825
|
-
for (let n of
|
|
2826
|
-
for (let n of
|
|
2861
|
+
function ot(e, t) {
|
|
2862
|
+
for (let n of j) if (e.exits[n] === t.id) return n;
|
|
2863
|
+
for (let n of j) if (t.exits[n] === e.id) return M[n];
|
|
2827
2864
|
}
|
|
2828
|
-
function
|
|
2865
|
+
function st(e, t, n) {
|
|
2829
2866
|
let { fromRoom: r, toRoom: i, fromDir: a, toDir: o } = t;
|
|
2830
|
-
if (n.length === 0 && n.push(r.x, r.y), a &&
|
|
2831
|
-
let t =
|
|
2867
|
+
if (n.length === 0 && n.push(r.x, r.y), a && O.includes(a)) {
|
|
2868
|
+
let t = V(e, r.x, r.y, a, e.roomSize / 2);
|
|
2832
2869
|
n.push(t.x, t.y);
|
|
2833
2870
|
}
|
|
2834
|
-
if (o &&
|
|
2835
|
-
let t =
|
|
2871
|
+
if (o && O.includes(o)) {
|
|
2872
|
+
let t = V(e, i.x, i.y, o, e.roomSize / 2);
|
|
2836
2873
|
n.push(t.x, t.y);
|
|
2837
2874
|
}
|
|
2838
2875
|
n.push(i.x, i.y);
|
|
2839
2876
|
}
|
|
2840
|
-
function
|
|
2877
|
+
function ct(e, t) {
|
|
2841
2878
|
let { fromRoom: n, toRoom: r, customLineKey: i } = e, a = n, o;
|
|
2842
2879
|
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) => {
|
|
2843
2880
|
t.push(e.x, -e.y);
|
|
2844
2881
|
}), t.push(r.x, r.y);
|
|
2845
2882
|
}
|
|
2846
|
-
function
|
|
2883
|
+
function lt(e, t, n, r, i) {
|
|
2847
2884
|
let a = [], o = [], s = [], c = n.map((t) => e.getRoom(t)).filter((e) => e !== void 0), l = [], u = () => {
|
|
2848
2885
|
l.length >= 4 && a.push({ points: [...l] }), l = [];
|
|
2849
2886
|
}, d = (e) => {
|
|
@@ -2857,28 +2894,28 @@ function at(e, t, n, r, i) {
|
|
|
2857
2894
|
}), s.push({ points: t });
|
|
2858
2895
|
}
|
|
2859
2896
|
}
|
|
2860
|
-
r &&
|
|
2897
|
+
r && B.includes(r) && o.push({
|
|
2861
2898
|
room: t,
|
|
2862
2899
|
direction: r
|
|
2863
|
-
}), i &&
|
|
2900
|
+
}), i && B.includes(i) && o.push({
|
|
2864
2901
|
room: n,
|
|
2865
2902
|
direction: i
|
|
2866
2903
|
});
|
|
2867
2904
|
};
|
|
2868
2905
|
for (let n = 0; n < c.length - 1; n++) {
|
|
2869
|
-
let a = c[n], s = c[n + 1], f =
|
|
2906
|
+
let a = c[n], s = c[n + 1], f = it(a, r, i), p = it(s, r, i);
|
|
2870
2907
|
if (!f && !p) {
|
|
2871
2908
|
u();
|
|
2872
2909
|
continue;
|
|
2873
2910
|
}
|
|
2874
2911
|
if (f && p) {
|
|
2875
|
-
let n =
|
|
2912
|
+
let n = nt(e, a, s);
|
|
2876
2913
|
switch (n.type) {
|
|
2877
2914
|
case "regular":
|
|
2878
|
-
|
|
2915
|
+
st(t, n, l);
|
|
2879
2916
|
break;
|
|
2880
2917
|
case "special":
|
|
2881
|
-
|
|
2918
|
+
ct(n, l);
|
|
2882
2919
|
break;
|
|
2883
2920
|
case "inner":
|
|
2884
2921
|
u(), d(n);
|
|
@@ -2888,22 +2925,22 @@ function at(e, t, n, r, i) {
|
|
|
2888
2925
|
break;
|
|
2889
2926
|
}
|
|
2890
2927
|
} else {
|
|
2891
|
-
let e = f ? a : s, n = f ? s : a, r =
|
|
2928
|
+
let e = f ? a : s, n = f ? s : a, r = at(e, n);
|
|
2892
2929
|
if (r) {
|
|
2893
|
-
if (
|
|
2930
|
+
if (B.includes(r.direction)) u(), o.push({
|
|
2894
2931
|
room: e,
|
|
2895
2932
|
direction: r.direction
|
|
2896
2933
|
});
|
|
2897
|
-
else if (
|
|
2934
|
+
else if (O.includes(r.direction)) {
|
|
2898
2935
|
l.length === 0 && l.push(e.x, e.y);
|
|
2899
|
-
let n =
|
|
2936
|
+
let n = V(t, e.x, e.y, r.direction, t.roomSize / 2), i = P(e.x, e.y, r.direction, t.roomSize);
|
|
2900
2937
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2901
2938
|
}
|
|
2902
2939
|
} else {
|
|
2903
|
-
let r =
|
|
2940
|
+
let r = ot(e, n);
|
|
2904
2941
|
if (r) {
|
|
2905
2942
|
l.length === 0 && l.push(e.x, e.y);
|
|
2906
|
-
let n =
|
|
2943
|
+
let n = V(t, e.x, e.y, r, t.roomSize / 2), i = P(e.x, e.y, r, t.roomSize);
|
|
2907
2944
|
l.push(n.x, n.y, i.x, i.y), u();
|
|
2908
2945
|
}
|
|
2909
2946
|
}
|
|
@@ -2917,7 +2954,7 @@ function at(e, t, n, r, i) {
|
|
|
2917
2954
|
}
|
|
2918
2955
|
//#endregion
|
|
2919
2956
|
//#region src/scene/OverlayStyle.ts
|
|
2920
|
-
function
|
|
2957
|
+
function ut(e, t, n) {
|
|
2921
2958
|
let r = n.highlight, i = n.roomSize, a = r.sizeFactor, o = r.matchRoomShape && n.roomShape !== "circle";
|
|
2922
2959
|
return {
|
|
2923
2960
|
shape: o ? "rect" : "circle",
|
|
@@ -2934,7 +2971,7 @@ function ot(e, t, n) {
|
|
|
2934
2971
|
dashEnabled: r.dashEnabled
|
|
2935
2972
|
};
|
|
2936
2973
|
}
|
|
2937
|
-
function
|
|
2974
|
+
function dt(e, t) {
|
|
2938
2975
|
let n = t.playerMarker, r = t.roomSize * n.sizeFactor, i = n.matchRoomShape && t.roomShape !== "circle";
|
|
2939
2976
|
return {
|
|
2940
2977
|
shape: i ? "rect" : "circle",
|
|
@@ -2951,12 +2988,12 @@ function st(e, t) {
|
|
|
2951
2988
|
dashEnabled: n.dashEnabled
|
|
2952
2989
|
};
|
|
2953
2990
|
}
|
|
2954
|
-
function
|
|
2955
|
-
let o =
|
|
2991
|
+
function ft(e, t, n, r, i, a) {
|
|
2992
|
+
let o = lt(e, t, n, i, a), s = t.lineWidth, c = [];
|
|
2956
2993
|
for (let e of o.segments) e.points.length >= 4 && c.push({ points: e.points });
|
|
2957
2994
|
for (let e of o.customLines) e.points.length >= 4 && c.push({ points: e.points });
|
|
2958
2995
|
let l = [];
|
|
2959
|
-
for (let e of o.innerMarkers) for (let n of
|
|
2996
|
+
for (let e of o.innerMarkers) for (let n of Te(e.room, e.direction, t)) l.push({ vertices: n.vertices });
|
|
2960
2997
|
return {
|
|
2961
2998
|
segments: c,
|
|
2962
2999
|
triangles: l,
|
|
@@ -2967,7 +3004,7 @@ function ct(e, t, n, r, i, a) {
|
|
|
2967
3004
|
}
|
|
2968
3005
|
//#endregion
|
|
2969
3006
|
//#region src/scene/elements/OverlayLayout.ts
|
|
2970
|
-
function
|
|
3007
|
+
function pt(e) {
|
|
2971
3008
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
2972
3009
|
if (e.shape === "circle") return {
|
|
2973
3010
|
type: "circle",
|
|
@@ -3039,7 +3076,7 @@ function lt(e) {
|
|
|
3039
3076
|
layer: "overlay"
|
|
3040
3077
|
};
|
|
3041
3078
|
}
|
|
3042
|
-
function
|
|
3079
|
+
function mt(e) {
|
|
3043
3080
|
let t = x(e.strokeColor, e.strokeAlpha), n = e.fillAlpha > 0 ? x(e.fillColor, e.fillAlpha) : void 0;
|
|
3044
3081
|
return e.shape === "circle" ? {
|
|
3045
3082
|
type: "circle",
|
|
@@ -3071,7 +3108,7 @@ function ut(e) {
|
|
|
3071
3108
|
layer: "overlay"
|
|
3072
3109
|
};
|
|
3073
3110
|
}
|
|
3074
|
-
function
|
|
3111
|
+
function ht(e) {
|
|
3075
3112
|
let t = [];
|
|
3076
3113
|
for (let n of e.segments) t.push({
|
|
3077
3114
|
type: "line",
|
|
@@ -3110,29 +3147,29 @@ function dt(e) {
|
|
|
3110
3147
|
}
|
|
3111
3148
|
//#endregion
|
|
3112
3149
|
//#region src/hit/HitTester.ts
|
|
3113
|
-
var
|
|
3150
|
+
var gt = {
|
|
3114
3151
|
areaExit: 110,
|
|
3115
3152
|
room: 100,
|
|
3116
3153
|
label: 80,
|
|
3117
3154
|
specialExit: 60,
|
|
3118
3155
|
exit: 40,
|
|
3119
3156
|
stub: 20
|
|
3120
|
-
},
|
|
3157
|
+
}, _t = {
|
|
3121
3158
|
room: .3,
|
|
3122
3159
|
areaExit: 1,
|
|
3123
3160
|
label: 1,
|
|
3124
3161
|
specialExit: .5,
|
|
3125
3162
|
exit: .35,
|
|
3126
3163
|
stub: .3
|
|
3127
|
-
},
|
|
3164
|
+
}, vt = (e, t) => ({
|
|
3128
3165
|
x: e,
|
|
3129
3166
|
y: t
|
|
3130
|
-
}),
|
|
3167
|
+
}), yt = class {
|
|
3131
3168
|
constructor() {
|
|
3132
|
-
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform =
|
|
3169
|
+
this.entries = [], this.bucketSize = 5, this.roomSize = 1, this.spatialIndex = /* @__PURE__ */ new Map(), this.transform = vt;
|
|
3133
3170
|
}
|
|
3134
3171
|
build(e, t, n) {
|
|
3135
|
-
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ??
|
|
3172
|
+
this.clear(), this.roomSize = t, this.bucketSize = Math.max(t * 10, 5), this.transform = n ?? vt, this.collectHitShapes(e, 0, 0);
|
|
3136
3173
|
}
|
|
3137
3174
|
clear() {
|
|
3138
3175
|
this.entries = [], this.spatialIndex.clear();
|
|
@@ -3176,13 +3213,13 @@ var ft = {
|
|
|
3176
3213
|
forEachCandidate(e, t, n) {
|
|
3177
3214
|
let r = Math.floor(e / this.bucketSize), i = Math.floor(t / this.bucketSize), a = /* @__PURE__ */ new Set();
|
|
3178
3215
|
for (let o = -1; o <= 1; o++) for (let s = -1; s <= 1; s++) {
|
|
3179
|
-
let c = this.spatialIndex.get(
|
|
3216
|
+
let c = this.spatialIndex.get(Ot(r + o, i + s));
|
|
3180
3217
|
if (c) for (let r of c) {
|
|
3181
3218
|
if (a.has(r)) continue;
|
|
3182
3219
|
a.add(r);
|
|
3183
3220
|
let i = r.margin * this.roomSize;
|
|
3184
3221
|
if (e < r.rMinX - i || e > r.rMaxX + i || t < r.rMinY - i || t > r.rMaxY + i) continue;
|
|
3185
|
-
let o =
|
|
3222
|
+
let o = Ct(r, e, t);
|
|
3186
3223
|
o > i || n(r, o);
|
|
3187
3224
|
}
|
|
3188
3225
|
}
|
|
@@ -3201,14 +3238,14 @@ var ft = {
|
|
|
3201
3238
|
collectHitShapes(e, t, n) {
|
|
3202
3239
|
for (let r of e) {
|
|
3203
3240
|
if (r.hit) {
|
|
3204
|
-
let e = [], i =
|
|
3205
|
-
|
|
3241
|
+
let e = [], i = bt();
|
|
3242
|
+
xt(r, t, n, this.transform, e, i), e.length > 0 && i.minX <= i.maxX && this.indexEntry(i, e, r.hit);
|
|
3206
3243
|
}
|
|
3207
3244
|
r.type === "group" && this.collectHitShapes(r.children, t + r.x, n + r.y);
|
|
3208
3245
|
}
|
|
3209
3246
|
}
|
|
3210
3247
|
indexEntry(e, t, n) {
|
|
3211
|
-
let r = n.margin ??
|
|
3248
|
+
let r = n.margin ?? _t[n.kind] ?? 1, i = n.priority ?? gt[n.kind] ?? 50, a = (e.minX + e.maxX) / 2, o = (e.minY + e.maxY) / 2, s = {
|
|
3212
3249
|
info: n,
|
|
3213
3250
|
margin: r,
|
|
3214
3251
|
priority: i,
|
|
@@ -3223,12 +3260,12 @@ var ft = {
|
|
|
3223
3260
|
this.entries.push(s);
|
|
3224
3261
|
let c = this.bucketSize, l = Math.floor(e.minX / c), u = Math.floor(e.maxX / c), d = Math.floor(e.minY / c), f = Math.floor(e.maxY / c);
|
|
3225
3262
|
for (let e = l; e <= u; e++) for (let t = d; t <= f; t++) {
|
|
3226
|
-
let n =
|
|
3263
|
+
let n = Ot(e, t), r = this.spatialIndex.get(n);
|
|
3227
3264
|
r || (r = [], this.spatialIndex.set(n, r)), r.push(s);
|
|
3228
3265
|
}
|
|
3229
3266
|
}
|
|
3230
3267
|
};
|
|
3231
|
-
function
|
|
3268
|
+
function bt() {
|
|
3232
3269
|
return {
|
|
3233
3270
|
minX: Infinity,
|
|
3234
3271
|
minY: Infinity,
|
|
@@ -3236,17 +3273,17 @@ function gt() {
|
|
|
3236
3273
|
maxY: -Infinity
|
|
3237
3274
|
};
|
|
3238
3275
|
}
|
|
3239
|
-
function
|
|
3276
|
+
function H(e, t, n) {
|
|
3240
3277
|
t < e.minX && (e.minX = t), t > e.maxX && (e.maxX = t), n < e.minY && (e.minY = n), n > e.maxY && (e.maxY = n);
|
|
3241
3278
|
}
|
|
3242
|
-
function
|
|
3279
|
+
function xt(e, t, n, r, i, a) {
|
|
3243
3280
|
if (e.type === "group") {
|
|
3244
|
-
for (let o of e.children) o.hit ||
|
|
3281
|
+
for (let o of e.children) o.hit || St(o, t + e.x, n + e.y, r, i, a);
|
|
3245
3282
|
return;
|
|
3246
3283
|
}
|
|
3247
|
-
|
|
3284
|
+
St(e, t, n, r, i, a);
|
|
3248
3285
|
}
|
|
3249
|
-
function
|
|
3286
|
+
function St(e, t, n, r, i, a) {
|
|
3250
3287
|
switch (e.type) {
|
|
3251
3288
|
case "rect":
|
|
3252
3289
|
case "image": {
|
|
@@ -3265,14 +3302,14 @@ function vt(e, t, n, r, i, a) {
|
|
|
3265
3302
|
pts: u,
|
|
3266
3303
|
closed: !0
|
|
3267
3304
|
});
|
|
3268
|
-
for (let e = 0; e < u.length; e += 2)
|
|
3305
|
+
for (let e = 0; e < u.length; e += 2) H(a, u[e], u[e + 1]);
|
|
3269
3306
|
return;
|
|
3270
3307
|
}
|
|
3271
3308
|
case "text": {
|
|
3272
3309
|
let o = e.width ?? 0, s = e.height ?? 0;
|
|
3273
3310
|
if (o === 0 || s === 0) {
|
|
3274
3311
|
let i = r(t + e.x, n + e.y);
|
|
3275
|
-
|
|
3312
|
+
H(a, i.x, i.y);
|
|
3276
3313
|
return;
|
|
3277
3314
|
}
|
|
3278
3315
|
let c = r(t + e.x, n + e.y), l = r(t + e.x + o, n + e.y), u = r(t + e.x + o, n + e.y + s), d = r(t + e.x, n + e.y + s), f = [
|
|
@@ -3290,7 +3327,7 @@ function vt(e, t, n, r, i, a) {
|
|
|
3290
3327
|
pts: f,
|
|
3291
3328
|
closed: !0
|
|
3292
3329
|
});
|
|
3293
|
-
for (let e = 0; e < f.length; e += 2)
|
|
3330
|
+
for (let e = 0; e < f.length; e += 2) H(a, f[e], f[e + 1]);
|
|
3294
3331
|
return;
|
|
3295
3332
|
}
|
|
3296
3333
|
case "circle": {
|
|
@@ -3300,14 +3337,14 @@ function vt(e, t, n, r, i, a) {
|
|
|
3300
3337
|
cx: o.x,
|
|
3301
3338
|
cy: o.y,
|
|
3302
3339
|
r: e.radius
|
|
3303
|
-
}),
|
|
3340
|
+
}), H(a, o.x - e.radius, o.y - e.radius), H(a, o.x + e.radius, o.y + e.radius);
|
|
3304
3341
|
return;
|
|
3305
3342
|
}
|
|
3306
3343
|
case "line": {
|
|
3307
3344
|
let o = [];
|
|
3308
3345
|
for (let i = 0; i < e.points.length; i += 2) {
|
|
3309
3346
|
let s = r(t + e.points[i], n + e.points[i + 1]);
|
|
3310
|
-
o.push(s.x, s.y),
|
|
3347
|
+
o.push(s.x, s.y), H(a, s.x, s.y);
|
|
3311
3348
|
}
|
|
3312
3349
|
o.length >= 2 && i.push({
|
|
3313
3350
|
type: "polyline",
|
|
@@ -3320,7 +3357,7 @@ function vt(e, t, n, r, i, a) {
|
|
|
3320
3357
|
let o = [];
|
|
3321
3358
|
for (let i = 0; i < e.vertices.length; i += 2) {
|
|
3322
3359
|
let s = r(t + e.vertices[i], n + e.vertices[i + 1]);
|
|
3323
|
-
o.push(s.x, s.y),
|
|
3360
|
+
o.push(s.x, s.y), H(a, s.x, s.y);
|
|
3324
3361
|
}
|
|
3325
3362
|
o.length >= 2 && i.push({
|
|
3326
3363
|
type: "polyline",
|
|
@@ -3330,42 +3367,42 @@ function vt(e, t, n, r, i, a) {
|
|
|
3330
3367
|
return;
|
|
3331
3368
|
}
|
|
3332
3369
|
case "group":
|
|
3333
|
-
for (let o of e.children) o.hit ||
|
|
3370
|
+
for (let o of e.children) o.hit || St(o, t + e.x, n + e.y, r, i, a);
|
|
3334
3371
|
return;
|
|
3335
3372
|
}
|
|
3336
3373
|
}
|
|
3337
|
-
function
|
|
3374
|
+
function Ct(e, t, n) {
|
|
3338
3375
|
let r = Infinity;
|
|
3339
3376
|
for (let i of e.geoms) {
|
|
3340
|
-
let e =
|
|
3377
|
+
let e = wt(i, t, n);
|
|
3341
3378
|
if (e < r && (r = e), r === 0) return 0;
|
|
3342
3379
|
}
|
|
3343
3380
|
return r;
|
|
3344
3381
|
}
|
|
3345
|
-
function
|
|
3382
|
+
function wt(e, t, n) {
|
|
3346
3383
|
if (e.type === "circle") {
|
|
3347
3384
|
let r = t - e.cx, i = n - e.cy;
|
|
3348
3385
|
return Math.max(0, Math.hypot(r, i) - e.r);
|
|
3349
3386
|
}
|
|
3350
|
-
return e.closed &&
|
|
3387
|
+
return e.closed && Dt(e.pts, t, n) ? 0 : Tt(e.pts, t, n, e.closed);
|
|
3351
3388
|
}
|
|
3352
|
-
function
|
|
3389
|
+
function Tt(e, t, n, r) {
|
|
3353
3390
|
let i = e.length / 2;
|
|
3354
3391
|
if (i < 2) return i === 1 ? Math.hypot(t - e[0], n - e[1]) : Infinity;
|
|
3355
3392
|
let a = Infinity, o = r ? i : i - 1;
|
|
3356
3393
|
for (let r = 0; r < o; r++) {
|
|
3357
|
-
let o = r * 2, s = (r + 1) % i * 2, c =
|
|
3394
|
+
let o = r * 2, s = (r + 1) % i * 2, c = Et(t, n, e[o], e[o + 1], e[s], e[s + 1]);
|
|
3358
3395
|
c < a && (a = c);
|
|
3359
3396
|
}
|
|
3360
3397
|
return a;
|
|
3361
3398
|
}
|
|
3362
|
-
function
|
|
3399
|
+
function Et(e, t, n, r, i, a) {
|
|
3363
3400
|
let o = i - n, s = a - r, c = o * o + s * s, l = c === 0 ? 0 : ((e - n) * o + (t - r) * s) / c;
|
|
3364
3401
|
l < 0 ? l = 0 : l > 1 && (l = 1);
|
|
3365
3402
|
let u = n + l * o, d = r + l * s;
|
|
3366
3403
|
return Math.hypot(e - u, t - d);
|
|
3367
3404
|
}
|
|
3368
|
-
function
|
|
3405
|
+
function Dt(e, t, n) {
|
|
3369
3406
|
let r = !1, i = e.length / 2;
|
|
3370
3407
|
for (let a = 0, o = i - 1; a < i; o = a++) {
|
|
3371
3408
|
let i = e[a * 2], s = e[a * 2 + 1], c = e[o * 2], l = e[o * 2 + 1], u = l - s || 1e-12;
|
|
@@ -3373,14 +3410,14 @@ function Ct(e, t, n) {
|
|
|
3373
3410
|
}
|
|
3374
3411
|
return r;
|
|
3375
3412
|
}
|
|
3376
|
-
function
|
|
3413
|
+
function Ot(e, t) {
|
|
3377
3414
|
return e * 1000003 + t;
|
|
3378
3415
|
}
|
|
3379
3416
|
//#endregion
|
|
3380
3417
|
//#region src/style/Style.ts
|
|
3381
|
-
var
|
|
3382
|
-
function
|
|
3383
|
-
return e.length === 0 ?
|
|
3418
|
+
var U = { transform: (e) => e };
|
|
3419
|
+
function kt(...e) {
|
|
3420
|
+
return e.length === 0 ? U : e.length === 1 ? e[0] : {
|
|
3384
3421
|
transform(t, n) {
|
|
3385
3422
|
let r = [t];
|
|
3386
3423
|
for (let t of e) {
|
|
@@ -3416,19 +3453,19 @@ function Tt(...e) {
|
|
|
3416
3453
|
}
|
|
3417
3454
|
//#endregion
|
|
3418
3455
|
//#region src/style/applyStyle.ts
|
|
3419
|
-
function
|
|
3456
|
+
function W(e, t, n) {
|
|
3420
3457
|
let r = [];
|
|
3421
3458
|
for (let i of e) {
|
|
3422
|
-
let e =
|
|
3459
|
+
let e = At(i, t, n);
|
|
3423
3460
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3424
3461
|
}
|
|
3425
3462
|
return r;
|
|
3426
3463
|
}
|
|
3427
|
-
function
|
|
3464
|
+
function At(e, t, n) {
|
|
3428
3465
|
if (e.type === "group") {
|
|
3429
3466
|
let r = [];
|
|
3430
3467
|
for (let i of e.children) {
|
|
3431
|
-
let e =
|
|
3468
|
+
let e = At(i, t, n);
|
|
3432
3469
|
Array.isArray(e) ? r.push(...e) : r.push(e);
|
|
3433
3470
|
}
|
|
3434
3471
|
return t.transform({
|
|
@@ -3440,27 +3477,27 @@ function Et(e, t, n) {
|
|
|
3440
3477
|
}
|
|
3441
3478
|
//#endregion
|
|
3442
3479
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
3443
|
-
var
|
|
3480
|
+
var jt = "rgb(120, 72, 0)", Mt = class {
|
|
3444
3481
|
get coordinateTransform() {
|
|
3445
3482
|
return this._coordinateTransform;
|
|
3446
3483
|
}
|
|
3447
3484
|
constructor(e, t) {
|
|
3448
|
-
this.gridCachedBounds = null, this.currentStyle =
|
|
3485
|
+
this.gridCachedBounds = null, this.currentStyle = U, this.hitTester = new yt(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = D, this.coordinateInverse = D, 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({
|
|
3449
3486
|
container: t,
|
|
3450
3487
|
width: t.clientWidth,
|
|
3451
3488
|
height: t.clientHeight,
|
|
3452
3489
|
draggable: !1
|
|
3453
|
-
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new
|
|
3490
|
+
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new E(t.clientWidth, t.clientHeight)) : (this.stage = new r.Stage({
|
|
3454
3491
|
width: 1,
|
|
3455
3492
|
height: 1
|
|
3456
|
-
}), this.camera = new
|
|
3493
|
+
}), this.camera = new E(1, 1)), this.gridLayer = new r.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
3457
3494
|
let n = new r.Layer({ listening: !1 });
|
|
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
|
|
3495
|
+
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new r.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new r.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new r.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Ye(this.positionLayer), this.overlayLayerNode = new Ye(this.overlayLayer), this.sceneNode = new Je(n), this.gridLayerNode = new R(this.gridLayer), this.topLabelLayerNode = new R(this.topLabelLayer), this.sceneManager = new We(this.camera, e.settings, e.mapReader), this.events = new S(t), this.culling = new te(e.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), t) {
|
|
3459
3496
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
3460
3497
|
let n = this.origSetSize;
|
|
3461
3498
|
this.camera.setSize = (e, t) => {
|
|
3462
3499
|
n(e, t), this.stage.width(e), this.stage.height(t);
|
|
3463
|
-
}, this.interactionHandler = new
|
|
3500
|
+
}, this.interactionHandler = new Ge(t, this.camera, e, {
|
|
3464
3501
|
clientToMapPoint: (e, n) => this.camera.clientToMapPoint(e, n, t.getBoundingClientRect()),
|
|
3465
3502
|
pickAtPoint: (e, t) => this.hitTester.pick(e, t)
|
|
3466
3503
|
}, this.events);
|
|
@@ -3468,10 +3505,10 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3468
3505
|
this.applyStyleTransforms(), this.subscribeToState(e);
|
|
3469
3506
|
}
|
|
3470
3507
|
setStyle(e) {
|
|
3471
|
-
this.currentStyle = e, this.sceneNode = new
|
|
3508
|
+
this.currentStyle = e, this.sceneNode = new Je(this.linkLayer), this.gridLayerNode = new R(this.gridLayer), this.topLabelLayerNode = new R(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
|
|
3472
3509
|
}
|
|
3473
3510
|
applyStyleTransforms() {
|
|
3474
|
-
let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) :
|
|
3511
|
+
let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) : D, n = e.sceneToWorld ? (t, n) => e.sceneToWorld(t, n) : D, r = this.coordinateInverse;
|
|
3475
3512
|
this._coordinateTransform = t, this.coordinateInverse = n, this.culling.setCoordinateTransform(t), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, t);
|
|
3476
3513
|
let i = this.camera.getScale(), a = this.camera.width / 2, o = this.camera.height / 2, s = r((a - this.camera.position.x) / i, (o - this.camera.position.y) / i), c = t(s.x, s.y);
|
|
3477
3514
|
this.camera.position = {
|
|
@@ -3625,22 +3662,20 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3625
3662
|
}
|
|
3626
3663
|
for (let e of r.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
|
|
3627
3664
|
}
|
|
3628
|
-
|
|
3629
|
-
|
|
3665
|
+
addStyledShape(e, t) {
|
|
3666
|
+
let n = this.currentStyle === U ? [e] : W([e], this.currentStyle, this.styleContext());
|
|
3667
|
+
if (n.length === 0) return;
|
|
3668
|
+
let r;
|
|
3669
|
+
r = n.length === 1 && n[0].type === "group" ? n[0] : {
|
|
3630
3670
|
type: "group",
|
|
3631
3671
|
x: 0,
|
|
3632
3672
|
y: 0,
|
|
3633
|
-
children:
|
|
3634
|
-
layer: e.layer
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
for (let e of n) {
|
|
3640
|
-
let n = this.shapeToRecordingNode(e);
|
|
3641
|
-
t.addNode(n), r ||= n;
|
|
3642
|
-
}
|
|
3643
|
-
return r;
|
|
3673
|
+
children: n,
|
|
3674
|
+
layer: e.layer,
|
|
3675
|
+
noScale: e.noScale
|
|
3676
|
+
};
|
|
3677
|
+
let i = Ze(r);
|
|
3678
|
+
return t.addNode(i), i;
|
|
3644
3679
|
}
|
|
3645
3680
|
refreshGrid(e) {
|
|
3646
3681
|
let t = this.state.settings;
|
|
@@ -3651,7 +3686,7 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3651
3686
|
let n = this.coordinateInverse, r = n(e.minX, e.minY), i = n(e.maxX, e.minY), a = n(e.maxX, e.maxY), o = n(e.minX, e.maxY), s = Math.min(r.x, i.x, a.x, o.x), c = Math.max(r.x, i.x, a.x, o.x), l = Math.min(r.y, i.y, a.y, o.y), u = Math.max(r.y, i.y, a.y, o.y), d = t.gridSize * 2, f = Math.floor((s - d) / t.gridSize) * t.gridSize, p = Math.ceil((c + d) / t.gridSize) * t.gridSize, m = Math.floor((l - d) / t.gridSize) * t.gridSize, h = Math.ceil((u + d) / t.gridSize) * t.gridSize, g = this.gridCachedBounds;
|
|
3652
3687
|
if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
|
|
3653
3688
|
this.gridLayerNode.destroyChildren();
|
|
3654
|
-
let _ =
|
|
3689
|
+
let _ = ze(e, t, { inverseTransform: this.coordinateInverse });
|
|
3655
3690
|
for (let e of _) this.addStyledShape(e, this.gridLayerNode);
|
|
3656
3691
|
this.gridCachedBounds = {
|
|
3657
3692
|
left: f,
|
|
@@ -3661,7 +3696,7 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3661
3696
|
}, this.gridLayerNode.batchDraw();
|
|
3662
3697
|
}
|
|
3663
3698
|
onSceneBuilt() {
|
|
3664
|
-
this.
|
|
3699
|
+
this.lastHitShapes = this.sceneManager.hitShapes, this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, this._coordinateTransform);
|
|
3665
3700
|
let e = this.camera.getScale();
|
|
3666
3701
|
this.stage.scale({
|
|
3667
3702
|
x: e,
|
|
@@ -3697,9 +3732,12 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3697
3732
|
}
|
|
3698
3733
|
}
|
|
3699
3734
|
applyPositionMarker(e) {
|
|
3700
|
-
this.positionMarker
|
|
3701
|
-
|
|
3702
|
-
|
|
3735
|
+
if (this.positionMarker &&= (this.positionMarker.destroy(), void 0), e.area !== this.state.currentArea || e.z !== this.state.currentZIndex) {
|
|
3736
|
+
this.positionLayerNode.batchDraw();
|
|
3737
|
+
return;
|
|
3738
|
+
}
|
|
3739
|
+
let t = dt(e, this.state.settings);
|
|
3740
|
+
this.positionMarker = this.addStyledShape(mt(t), this.positionLayerNode);
|
|
3703
3741
|
}
|
|
3704
3742
|
clearCurrentRoomOverlay() {
|
|
3705
3743
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3718,11 +3756,11 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3718
3756
|
n.set(e.id, e);
|
|
3719
3757
|
let r = [], i = this.sceneManager.exitRenderer, a = this.state.lens;
|
|
3720
3758
|
this.state.currentAreaInstance && this.state.currentZIndex !== void 0 && this.state.currentAreaInstance.getLinkExits(this.state.currentZIndex).filter((t) => t.a === e.id || t.b === e.id).forEach((e) => {
|
|
3721
|
-
let t = i.renderDataWithColor(e,
|
|
3759
|
+
let t = i.renderDataWithColor(e, jt, this.state.currentZIndex);
|
|
3722
3760
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3723
3761
|
});
|
|
3724
|
-
for (let n of
|
|
3725
|
-
for (let n of
|
|
3762
|
+
for (let n of fe(e, t, jt)) r.push(Ae(n, e.id));
|
|
3763
|
+
for (let n of ue(e, t, jt)) r.push(je(n));
|
|
3726
3764
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3727
3765
|
let t = this.state.mapReader.getRoom(e);
|
|
3728
3766
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -3730,11 +3768,11 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3730
3768
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3731
3769
|
t && this.currentRoomOverlay.push(t);
|
|
3732
3770
|
}), n.forEach((n, r) => {
|
|
3733
|
-
let i = r === e.id, a =
|
|
3734
|
-
strokeOverride: i ?
|
|
3771
|
+
let i = r === e.id, a = be(n, this.state.mapReader, t, {
|
|
3772
|
+
strokeOverride: i ? jt : t.lineColor,
|
|
3735
3773
|
flatPipeline: !0
|
|
3736
3774
|
});
|
|
3737
|
-
a.children.push(...
|
|
3775
|
+
a.children.push(...De(n, this.state.mapReader, t));
|
|
3738
3776
|
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
3739
3777
|
o && this.currentRoomOverlay.push(o);
|
|
3740
3778
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
@@ -3744,7 +3782,7 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3744
3782
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3745
3783
|
let n = this.state.mapReader.getRoom(e);
|
|
3746
3784
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3747
|
-
let r =
|
|
3785
|
+
let r = ut(n, t, this.state.settings), i = this.addStyledShape(pt(r), this.overlayLayerNode);
|
|
3748
3786
|
i && this.highlightShapes.set(e, i);
|
|
3749
3787
|
}
|
|
3750
3788
|
}
|
|
@@ -3757,7 +3795,7 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3757
3795
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3758
3796
|
let n = this.state.mapReader.getRoom(e);
|
|
3759
3797
|
if (!n) continue;
|
|
3760
|
-
let r =
|
|
3798
|
+
let r = ut(n, t.color, this.state.settings), i = this.addStyledShape(pt(r), this.overlayLayerNode);
|
|
3761
3799
|
i && this.highlightShapes.set(e, i);
|
|
3762
3800
|
}
|
|
3763
3801
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3767,8 +3805,8 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3767
3805
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3768
3806
|
if (!(e === void 0 || t === void 0)) {
|
|
3769
3807
|
for (let n of this.state.paths) {
|
|
3770
|
-
let r =
|
|
3771
|
-
for (let e of
|
|
3808
|
+
let r = ft(this.state.mapReader, this.state.settings, n.locations, n.color, e, t);
|
|
3809
|
+
for (let e of ht(r)) {
|
|
3772
3810
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3773
3811
|
t && this.pathShapes.push(t);
|
|
3774
3812
|
}
|
|
@@ -3787,7 +3825,16 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3787
3825
|
};
|
|
3788
3826
|
//#endregion
|
|
3789
3827
|
//#region src/style/shape/paintMap.ts
|
|
3790
|
-
function
|
|
3828
|
+
function G(e, t) {
|
|
3829
|
+
if (e !== void 0) return typeof e == "string" ? t(e) : {
|
|
3830
|
+
...e,
|
|
3831
|
+
stops: e.stops.map((e) => ({
|
|
3832
|
+
offset: e.offset,
|
|
3833
|
+
color: t(e.color)
|
|
3834
|
+
}))
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3837
|
+
function K(e) {
|
|
3791
3838
|
let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
3792
3839
|
return t ? {
|
|
3793
3840
|
r: parseInt(t[1]),
|
|
@@ -3801,100 +3848,100 @@ function q(e) {
|
|
|
3801
3848
|
a: 1
|
|
3802
3849
|
} : null;
|
|
3803
3850
|
}
|
|
3804
|
-
function
|
|
3851
|
+
function q(e, t, n, r = 1) {
|
|
3805
3852
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3806
3853
|
}
|
|
3807
|
-
function
|
|
3854
|
+
function Nt(e) {
|
|
3808
3855
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3809
3856
|
}
|
|
3810
3857
|
//#endregion
|
|
3811
3858
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3812
|
-
var
|
|
3813
|
-
function
|
|
3814
|
-
let t =
|
|
3815
|
-
if (!t) return
|
|
3816
|
-
let n =
|
|
3817
|
-
return
|
|
3818
|
-
}
|
|
3819
|
-
function
|
|
3820
|
-
let t =
|
|
3821
|
-
if (!t || t.a >= 1) return
|
|
3822
|
-
let n =
|
|
3823
|
-
return
|
|
3824
|
-
}
|
|
3825
|
-
function
|
|
3859
|
+
var Pt = "#4a3728", Ft = "#3b2a1a", It = 139, Lt = 115, Rt = 85, zt = 244, Bt = 228, Vt = 193;
|
|
3860
|
+
function Ht(e) {
|
|
3861
|
+
let t = K(e);
|
|
3862
|
+
if (!t) return q(zt, Bt, Vt);
|
|
3863
|
+
let n = Nt(t);
|
|
3864
|
+
return q(Math.round(It + (zt - It) * n), Math.round(Lt + (Bt - Lt) * n), Math.round(Rt + (Vt - Rt) * n), t.a);
|
|
3865
|
+
}
|
|
3866
|
+
function Ut(e) {
|
|
3867
|
+
let t = K(e);
|
|
3868
|
+
if (!t || t.a >= 1) return Pt;
|
|
3869
|
+
let n = K(Pt);
|
|
3870
|
+
return q(n.r, n.g, n.b, t.a);
|
|
3871
|
+
}
|
|
3872
|
+
function Wt(e) {
|
|
3826
3873
|
return {
|
|
3827
3874
|
...e,
|
|
3828
|
-
fill: e.fill
|
|
3829
|
-
stroke: e.stroke ?
|
|
3875
|
+
fill: G(e.fill, Ht),
|
|
3876
|
+
stroke: e.stroke ? Ut(e.stroke) : e.stroke
|
|
3830
3877
|
};
|
|
3831
3878
|
}
|
|
3832
|
-
var
|
|
3879
|
+
var Gt = { transform(e) {
|
|
3833
3880
|
switch (e.type) {
|
|
3834
3881
|
case "rect":
|
|
3835
3882
|
case "circle":
|
|
3836
3883
|
case "polygon": return {
|
|
3837
3884
|
...e,
|
|
3838
|
-
paint:
|
|
3885
|
+
paint: Wt(e.paint)
|
|
3839
3886
|
};
|
|
3840
3887
|
case "line": return {
|
|
3841
3888
|
...e,
|
|
3842
3889
|
paint: e.paint.stroke ? {
|
|
3843
3890
|
...e.paint,
|
|
3844
|
-
stroke:
|
|
3891
|
+
stroke: Ut(e.paint.stroke)
|
|
3845
3892
|
} : e.paint
|
|
3846
3893
|
};
|
|
3847
3894
|
case "text": return {
|
|
3848
3895
|
...e,
|
|
3849
|
-
fill:
|
|
3896
|
+
fill: Ft
|
|
3850
3897
|
};
|
|
3851
3898
|
case "image":
|
|
3852
3899
|
case "group": return e;
|
|
3853
3900
|
}
|
|
3854
|
-
} },
|
|
3855
|
-
function
|
|
3856
|
-
let t =
|
|
3857
|
-
if (!t) return
|
|
3858
|
-
let n =
|
|
3859
|
-
return
|
|
3901
|
+
} }, Kt = "#c0deff", qt = "#e0f0ff", Jt = 20, Yt = 40, Xt = 80, Zt = 60, Qt = 100, $t = 160;
|
|
3902
|
+
function en(e) {
|
|
3903
|
+
let t = K(e);
|
|
3904
|
+
if (!t) return q(Zt, Qt, $t);
|
|
3905
|
+
let n = Nt(t);
|
|
3906
|
+
return q(Math.round(Jt + (Zt - Jt) * n), Math.round(Yt + (Qt - Yt) * n), Math.round(Xt + ($t - Xt) * n), t.a);
|
|
3860
3907
|
}
|
|
3861
|
-
function
|
|
3862
|
-
let t =
|
|
3863
|
-
if (!t || t.a >= 1) return
|
|
3864
|
-
let n =
|
|
3865
|
-
return
|
|
3908
|
+
function tn(e) {
|
|
3909
|
+
let t = K(e);
|
|
3910
|
+
if (!t || t.a >= 1) return Kt;
|
|
3911
|
+
let n = K(Kt);
|
|
3912
|
+
return q(n.r, n.g, n.b, t.a);
|
|
3866
3913
|
}
|
|
3867
|
-
function
|
|
3914
|
+
function nn(e) {
|
|
3868
3915
|
return {
|
|
3869
3916
|
...e,
|
|
3870
|
-
fill: e.fill
|
|
3871
|
-
stroke: e.stroke ?
|
|
3917
|
+
fill: G(e.fill, en),
|
|
3918
|
+
stroke: e.stroke ? tn(e.stroke) : e.stroke
|
|
3872
3919
|
};
|
|
3873
3920
|
}
|
|
3874
|
-
var
|
|
3921
|
+
var rn = { transform(e) {
|
|
3875
3922
|
switch (e.type) {
|
|
3876
3923
|
case "rect":
|
|
3877
3924
|
case "circle":
|
|
3878
3925
|
case "polygon": return {
|
|
3879
3926
|
...e,
|
|
3880
|
-
paint:
|
|
3927
|
+
paint: nn(e.paint)
|
|
3881
3928
|
};
|
|
3882
3929
|
case "line": return {
|
|
3883
3930
|
...e,
|
|
3884
3931
|
paint: e.paint.stroke ? {
|
|
3885
3932
|
...e.paint,
|
|
3886
|
-
stroke:
|
|
3933
|
+
stroke: tn(e.paint.stroke)
|
|
3887
3934
|
} : e.paint
|
|
3888
3935
|
};
|
|
3889
3936
|
case "text": return {
|
|
3890
3937
|
...e,
|
|
3891
|
-
fill:
|
|
3938
|
+
fill: qt
|
|
3892
3939
|
};
|
|
3893
3940
|
case "image":
|
|
3894
3941
|
case "group": return e;
|
|
3895
3942
|
}
|
|
3896
|
-
} },
|
|
3897
|
-
function
|
|
3943
|
+
} }, an = "#00ffd0", on = .3, sn = 3;
|
|
3944
|
+
function cn(e, t, n) {
|
|
3898
3945
|
e /= 255, t /= 255, n /= 255;
|
|
3899
3946
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3900
3947
|
if (r === i) return [
|
|
@@ -3909,68 +3956,68 @@ function nn(e, t, n) {
|
|
|
3909
3956
|
a
|
|
3910
3957
|
];
|
|
3911
3958
|
}
|
|
3912
|
-
function
|
|
3959
|
+
function ln(e, t, n, r = 1) {
|
|
3913
3960
|
e = (e % 360 + 360) % 360;
|
|
3914
3961
|
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;
|
|
3915
3962
|
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);
|
|
3916
3963
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3917
3964
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3918
3965
|
}
|
|
3919
|
-
function
|
|
3920
|
-
let t =
|
|
3966
|
+
function un(e) {
|
|
3967
|
+
let t = K(e);
|
|
3921
3968
|
if (!t) return {
|
|
3922
3969
|
h: 150,
|
|
3923
3970
|
a: 1
|
|
3924
3971
|
};
|
|
3925
|
-
let [n] =
|
|
3972
|
+
let [n] = cn(t.r, t.g, t.b);
|
|
3926
3973
|
return {
|
|
3927
3974
|
h: n,
|
|
3928
3975
|
a: t.a
|
|
3929
3976
|
};
|
|
3930
3977
|
}
|
|
3931
|
-
function
|
|
3932
|
-
let { h: t, a: n } =
|
|
3933
|
-
return
|
|
3978
|
+
function dn(e) {
|
|
3979
|
+
let { h: t, a: n } = un(e);
|
|
3980
|
+
return ln(t, .95, .65, n);
|
|
3934
3981
|
}
|
|
3935
|
-
function
|
|
3936
|
-
let t =
|
|
3982
|
+
function fn(e) {
|
|
3983
|
+
let t = K(e);
|
|
3937
3984
|
if (!t) return "rgb(8, 12, 10)";
|
|
3938
|
-
let [n] =
|
|
3939
|
-
return
|
|
3985
|
+
let [n] = cn(t.r, t.g, t.b);
|
|
3986
|
+
return ln(n, .4, .1, t.a);
|
|
3940
3987
|
}
|
|
3941
|
-
function
|
|
3942
|
-
let { h: t, a: n } =
|
|
3943
|
-
return
|
|
3988
|
+
function pn(e) {
|
|
3989
|
+
let { h: t, a: n } = un(e);
|
|
3990
|
+
return ln(t, .95, .65, Math.min(n, on));
|
|
3944
3991
|
}
|
|
3945
|
-
function
|
|
3992
|
+
function mn(e) {
|
|
3946
3993
|
return {
|
|
3947
3994
|
...e,
|
|
3948
|
-
fill: e.fill
|
|
3949
|
-
stroke: e.stroke ?
|
|
3995
|
+
fill: G(e.fill, fn),
|
|
3996
|
+
stroke: e.stroke ? dn(e.stroke) : e.stroke
|
|
3950
3997
|
};
|
|
3951
3998
|
}
|
|
3952
|
-
function
|
|
3999
|
+
function hn(e, t = !1) {
|
|
3953
4000
|
if (!e.stroke) return e;
|
|
3954
|
-
let n = (e.strokeWidth ?? 1) *
|
|
4001
|
+
let n = (e.strokeWidth ?? 1) * sn;
|
|
3955
4002
|
return {
|
|
3956
|
-
stroke:
|
|
4003
|
+
stroke: pn(e.stroke),
|
|
3957
4004
|
strokeWidth: n,
|
|
3958
4005
|
dash: e.dash,
|
|
3959
4006
|
dashEnabled: e.dashEnabled,
|
|
3960
|
-
alpha: t ?
|
|
4007
|
+
alpha: t ? on : e.alpha
|
|
3961
4008
|
};
|
|
3962
4009
|
}
|
|
3963
|
-
var
|
|
4010
|
+
var gn = { transform(e) {
|
|
3964
4011
|
switch (e.type) {
|
|
3965
4012
|
case "rect": {
|
|
3966
4013
|
let t = {
|
|
3967
4014
|
...e,
|
|
3968
|
-
paint:
|
|
4015
|
+
paint: mn(e.paint)
|
|
3969
4016
|
};
|
|
3970
4017
|
return e.paint.stroke ? [{
|
|
3971
4018
|
...e,
|
|
3972
4019
|
paint: {
|
|
3973
|
-
...
|
|
4020
|
+
...hn(e.paint),
|
|
3974
4021
|
fill: void 0
|
|
3975
4022
|
}
|
|
3976
4023
|
}, t] : t;
|
|
@@ -3978,12 +4025,12 @@ var dn = { transform(e) {
|
|
|
3978
4025
|
case "circle": {
|
|
3979
4026
|
let t = {
|
|
3980
4027
|
...e,
|
|
3981
|
-
paint:
|
|
4028
|
+
paint: mn(e.paint)
|
|
3982
4029
|
};
|
|
3983
4030
|
return e.paint.stroke ? [{
|
|
3984
4031
|
...e,
|
|
3985
4032
|
paint: {
|
|
3986
|
-
...
|
|
4033
|
+
...hn(e.paint),
|
|
3987
4034
|
fill: void 0
|
|
3988
4035
|
}
|
|
3989
4036
|
}, t] : t;
|
|
@@ -3993,21 +4040,21 @@ var dn = { transform(e) {
|
|
|
3993
4040
|
...e,
|
|
3994
4041
|
paint: e.paint.stroke ? {
|
|
3995
4042
|
...e.paint,
|
|
3996
|
-
stroke:
|
|
4043
|
+
stroke: dn(e.paint.stroke)
|
|
3997
4044
|
} : e.paint
|
|
3998
4045
|
};
|
|
3999
4046
|
return e.paint.stroke ? [{
|
|
4000
4047
|
...e,
|
|
4001
|
-
paint:
|
|
4048
|
+
paint: hn(e.paint, !0)
|
|
4002
4049
|
}, t] : t;
|
|
4003
4050
|
}
|
|
4004
4051
|
case "polygon": return {
|
|
4005
4052
|
...e,
|
|
4006
|
-
paint:
|
|
4053
|
+
paint: mn(e.paint)
|
|
4007
4054
|
};
|
|
4008
4055
|
case "text": return {
|
|
4009
4056
|
...e,
|
|
4010
|
-
fill:
|
|
4057
|
+
fill: an
|
|
4011
4058
|
};
|
|
4012
4059
|
case "image":
|
|
4013
4060
|
case "group": return e;
|
|
@@ -4015,16 +4062,16 @@ var dn = { transform(e) {
|
|
|
4015
4062
|
} };
|
|
4016
4063
|
//#endregion
|
|
4017
4064
|
//#region src/style/shape/wobble.ts
|
|
4018
|
-
function
|
|
4065
|
+
function _n(e) {
|
|
4019
4066
|
let t = e | 0 || 1;
|
|
4020
4067
|
return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
|
|
4021
4068
|
}
|
|
4022
|
-
function
|
|
4069
|
+
function vn(...e) {
|
|
4023
4070
|
let t = 2654435769;
|
|
4024
4071
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4025
4072
|
return t;
|
|
4026
4073
|
}
|
|
4027
|
-
function
|
|
4074
|
+
function yn(e, t, n, r, i, a) {
|
|
4028
4075
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4029
4076
|
if (c < .001) return [
|
|
4030
4077
|
e,
|
|
@@ -4039,17 +4086,17 @@ function fn(e, t, n, r, i, a) {
|
|
|
4039
4086
|
}
|
|
4040
4087
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4041
4088
|
}
|
|
4042
|
-
function
|
|
4089
|
+
function bn(e, t, n) {
|
|
4043
4090
|
if (e.length < 4) return e;
|
|
4044
4091
|
let r = [];
|
|
4045
4092
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4046
|
-
let a =
|
|
4093
|
+
let a = yn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4047
4094
|
if (i === 0) r.push(...a);
|
|
4048
4095
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4049
4096
|
}
|
|
4050
4097
|
return r;
|
|
4051
4098
|
}
|
|
4052
|
-
function
|
|
4099
|
+
function xn(e, t, n, r, i, a) {
|
|
4053
4100
|
let o = [
|
|
4054
4101
|
e,
|
|
4055
4102
|
t,
|
|
@@ -4061,12 +4108,12 @@ function mn(e, t, n, r, i, a) {
|
|
|
4061
4108
|
t + r
|
|
4062
4109
|
], s = [];
|
|
4063
4110
|
for (let e = 0; e < 4; e++) {
|
|
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 =
|
|
4111
|
+
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = yn(t, n, c, l, i, a);
|
|
4065
4112
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4066
4113
|
}
|
|
4067
4114
|
return s;
|
|
4068
4115
|
}
|
|
4069
|
-
function
|
|
4116
|
+
function Sn(e, t, n, r, i) {
|
|
4070
4117
|
let a = [];
|
|
4071
4118
|
for (let o = 0; o < 24; o++) {
|
|
4072
4119
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4074,31 +4121,31 @@ function hn(e, t, n, r, i) {
|
|
|
4074
4121
|
}
|
|
4075
4122
|
return a;
|
|
4076
4123
|
}
|
|
4077
|
-
function
|
|
4124
|
+
function Cn(e, t, n) {
|
|
4078
4125
|
let r = e.length / 2;
|
|
4079
4126
|
if (r < 2) return e;
|
|
4080
4127
|
let i = [];
|
|
4081
4128
|
for (let a = 0; a < r; a++) {
|
|
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 =
|
|
4129
|
+
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = yn(o, s, l, u, t, n);
|
|
4083
4130
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4084
4131
|
}
|
|
4085
4132
|
return i;
|
|
4086
4133
|
}
|
|
4087
4134
|
//#endregion
|
|
4088
4135
|
//#region src/style/shape/SketchyStyle.ts
|
|
4089
|
-
function
|
|
4136
|
+
function wn(e, t) {
|
|
4090
4137
|
if (!t) return e;
|
|
4091
4138
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4092
4139
|
if (!n) return e;
|
|
4093
4140
|
let r = parseFloat(n[1]);
|
|
4094
4141
|
return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
|
|
4095
4142
|
}
|
|
4096
|
-
function
|
|
4143
|
+
function Tn(e) {
|
|
4097
4144
|
let { jitter: t, color: n } = e;
|
|
4098
4145
|
return { transform(e) {
|
|
4099
4146
|
switch (e.type) {
|
|
4100
4147
|
case "rect": {
|
|
4101
|
-
let r =
|
|
4148
|
+
let r = _n(vn(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
|
|
4102
4149
|
if (e.cornerRadius && e.cornerRadius > 0) {
|
|
4103
4150
|
let n = [];
|
|
4104
4151
|
if (i && n.push({
|
|
@@ -4111,7 +4158,7 @@ function vn(e) {
|
|
|
4111
4158
|
}), a && e.paint.strokeWidth) {
|
|
4112
4159
|
let i = {
|
|
4113
4160
|
type: "polygon",
|
|
4114
|
-
vertices:
|
|
4161
|
+
vertices: xn(e.x, e.y, e.width, e.height, t, r),
|
|
4115
4162
|
paint: {
|
|
4116
4163
|
stroke: a,
|
|
4117
4164
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4126,7 +4173,7 @@ function vn(e) {
|
|
|
4126
4173
|
}
|
|
4127
4174
|
return {
|
|
4128
4175
|
type: "polygon",
|
|
4129
|
-
vertices:
|
|
4176
|
+
vertices: xn(e.x, e.y, e.width, e.height, t, r),
|
|
4130
4177
|
paint: {
|
|
4131
4178
|
fill: i,
|
|
4132
4179
|
stroke: a,
|
|
@@ -4138,10 +4185,10 @@ function vn(e) {
|
|
|
4138
4185
|
};
|
|
4139
4186
|
}
|
|
4140
4187
|
case "circle": {
|
|
4141
|
-
let r =
|
|
4188
|
+
let r = _n(vn(e.cx, e.cy, e.radius));
|
|
4142
4189
|
return {
|
|
4143
4190
|
type: "polygon",
|
|
4144
|
-
vertices:
|
|
4191
|
+
vertices: Sn(e.cx, e.cy, e.radius, t, r),
|
|
4145
4192
|
paint: {
|
|
4146
4193
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4147
4194
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4153,7 +4200,7 @@ function vn(e) {
|
|
|
4153
4200
|
};
|
|
4154
4201
|
}
|
|
4155
4202
|
case "line": {
|
|
4156
|
-
let r =
|
|
4203
|
+
let r = _n(vn(...e.points.slice(0, 4))), i = bn(e.points, t, r), a = wn(n, e.paint.stroke), o = {
|
|
4157
4204
|
...e.paint,
|
|
4158
4205
|
stroke: a
|
|
4159
4206
|
};
|
|
@@ -4164,7 +4211,7 @@ function vn(e) {
|
|
|
4164
4211
|
};
|
|
4165
4212
|
}
|
|
4166
4213
|
case "polygon": {
|
|
4167
|
-
let r =
|
|
4214
|
+
let r = _n(vn(...e.vertices.slice(0, 4))), i = Cn(e.vertices, t, r);
|
|
4168
4215
|
return {
|
|
4169
4216
|
...e,
|
|
4170
4217
|
vertices: i,
|
|
@@ -4186,16 +4233,42 @@ function vn(e) {
|
|
|
4186
4233
|
}
|
|
4187
4234
|
//#endregion
|
|
4188
4235
|
//#region src/style/shape/IsometricStyle.ts
|
|
4189
|
-
function
|
|
4236
|
+
function En(e, t) {
|
|
4237
|
+
return G(e, (e) => v(e, t));
|
|
4238
|
+
}
|
|
4239
|
+
function Dn(e, t) {
|
|
4240
|
+
if (!t || typeof t == "string") return t;
|
|
4241
|
+
if (t.type === "linear") {
|
|
4242
|
+
let [n, r] = e(t.x0, t.y0), [i, a] = e(t.x1, t.y1);
|
|
4243
|
+
return {
|
|
4244
|
+
...t,
|
|
4245
|
+
x0: n,
|
|
4246
|
+
y0: r,
|
|
4247
|
+
x1: i,
|
|
4248
|
+
y1: a
|
|
4249
|
+
};
|
|
4250
|
+
}
|
|
4251
|
+
let [n, r] = e(t.cx, t.cy), i = {
|
|
4252
|
+
...t,
|
|
4253
|
+
cx: n,
|
|
4254
|
+
cy: r
|
|
4255
|
+
};
|
|
4256
|
+
if (t.fx !== void 0 && t.fy !== void 0) {
|
|
4257
|
+
let [n, r] = e(t.fx, t.fy);
|
|
4258
|
+
i.fx = n, i.fy = r;
|
|
4259
|
+
}
|
|
4260
|
+
return i;
|
|
4261
|
+
}
|
|
4262
|
+
function On(e) {
|
|
4190
4263
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4191
4264
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4192
4265
|
}
|
|
4193
|
-
function
|
|
4266
|
+
function kn(e) {
|
|
4194
4267
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4195
4268
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4196
4269
|
}
|
|
4197
|
-
var
|
|
4198
|
-
function
|
|
4270
|
+
var J = 32;
|
|
4271
|
+
function An(e, t) {
|
|
4199
4272
|
let n = Array(t.length);
|
|
4200
4273
|
for (let r = 0; r < t.length; r += 2) {
|
|
4201
4274
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4203,7 +4276,7 @@ function xn(e, t) {
|
|
|
4203
4276
|
}
|
|
4204
4277
|
return n;
|
|
4205
4278
|
}
|
|
4206
|
-
function
|
|
4279
|
+
function jn(e, t, n, r, i) {
|
|
4207
4280
|
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);
|
|
4208
4281
|
return [
|
|
4209
4282
|
a,
|
|
@@ -4216,8 +4289,8 @@ function Sn(e, t, n, r, i) {
|
|
|
4216
4289
|
f
|
|
4217
4290
|
];
|
|
4218
4291
|
}
|
|
4219
|
-
function
|
|
4220
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
4292
|
+
function Mn(e = {}) {
|
|
4293
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = On(t), i = kn(t);
|
|
4221
4294
|
function a(e, t, n, i) {
|
|
4222
4295
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4223
4296
|
return [
|
|
@@ -4230,7 +4303,7 @@ function Cn(e = {}) {
|
|
|
4230
4303
|
];
|
|
4231
4304
|
}
|
|
4232
4305
|
function o(e) {
|
|
4233
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
4306
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = jn(r, t, i, a, o);
|
|
4234
4307
|
if (s.dash || s.dashEnabled) {
|
|
4235
4308
|
let t = [];
|
|
4236
4309
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4254,83 +4327,83 @@ function Cn(e = {}) {
|
|
|
4254
4327
|
return t;
|
|
4255
4328
|
}
|
|
4256
4329
|
if (n > 0 && s.fill) {
|
|
4257
|
-
let t = [],
|
|
4258
|
-
for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[
|
|
4259
|
-
let
|
|
4330
|
+
let t = [], i = 0;
|
|
4331
|
+
for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[i * 2 + 1] && (i = e);
|
|
4332
|
+
let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = Dn(r, s.fill);
|
|
4260
4333
|
if (t.push({
|
|
4261
4334
|
type: "polygon",
|
|
4262
4335
|
vertices: [
|
|
4263
|
-
l,
|
|
4264
4336
|
u,
|
|
4265
|
-
|
|
4337
|
+
d,
|
|
4338
|
+
a,
|
|
4339
|
+
o,
|
|
4266
4340
|
a,
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
u + n
|
|
4341
|
+
o + n,
|
|
4342
|
+
u,
|
|
4343
|
+
d + n
|
|
4271
4344
|
],
|
|
4272
|
-
paint: { fill: v
|
|
4345
|
+
paint: { fill: En(v, .2) },
|
|
4273
4346
|
layer: e.layer
|
|
4274
4347
|
}), t.push({
|
|
4275
4348
|
type: "polygon",
|
|
4276
4349
|
vertices: [
|
|
4277
|
-
i,
|
|
4278
4350
|
a,
|
|
4279
|
-
|
|
4351
|
+
o,
|
|
4352
|
+
p,
|
|
4353
|
+
m,
|
|
4280
4354
|
p,
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
a + n
|
|
4355
|
+
m + n,
|
|
4356
|
+
a,
|
|
4357
|
+
o + n
|
|
4285
4358
|
],
|
|
4286
|
-
paint: { fill: v
|
|
4359
|
+
paint: { fill: En(v, .4) },
|
|
4287
4360
|
layer: e.layer
|
|
4288
4361
|
}), t.push({
|
|
4289
4362
|
type: "polygon",
|
|
4290
4363
|
vertices: c,
|
|
4291
|
-
paint: { fill:
|
|
4364
|
+
paint: { fill: v },
|
|
4292
4365
|
layer: e.layer,
|
|
4293
4366
|
hit: e.hit
|
|
4294
4367
|
}), s.stroke && s.strokeWidth) {
|
|
4295
|
-
let r = s.strokeWidth,
|
|
4368
|
+
let r = s.strokeWidth, i = s.stroke, c = e.layer, l = (e) => t.push({
|
|
4296
4369
|
type: "line",
|
|
4297
4370
|
points: e,
|
|
4298
4371
|
paint: {
|
|
4299
|
-
stroke:
|
|
4372
|
+
stroke: i,
|
|
4300
4373
|
strokeWidth: r
|
|
4301
4374
|
},
|
|
4302
4375
|
layer: c
|
|
4303
4376
|
});
|
|
4304
|
-
|
|
4305
|
-
h,
|
|
4377
|
+
l([
|
|
4306
4378
|
g,
|
|
4307
|
-
|
|
4308
|
-
u
|
|
4309
|
-
|
|
4310
|
-
|
|
4379
|
+
_,
|
|
4380
|
+
u,
|
|
4381
|
+
d
|
|
4382
|
+
]), l([
|
|
4383
|
+
p,
|
|
4384
|
+
m,
|
|
4385
|
+
g,
|
|
4386
|
+
_
|
|
4387
|
+
]), l([
|
|
4388
|
+
u,
|
|
4389
|
+
d,
|
|
4390
|
+
u,
|
|
4391
|
+
d + n
|
|
4392
|
+
]), l([
|
|
4393
|
+
p,
|
|
4394
|
+
m,
|
|
4311
4395
|
p,
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
]), d([
|
|
4315
|
-
l,
|
|
4396
|
+
m + n
|
|
4397
|
+
]), l([
|
|
4316
4398
|
u,
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4399
|
+
d + n,
|
|
4400
|
+
a,
|
|
4401
|
+
o + n
|
|
4402
|
+
]), l([
|
|
4403
|
+
a,
|
|
4404
|
+
o + n,
|
|
4321
4405
|
p,
|
|
4322
|
-
|
|
4323
|
-
p + n
|
|
4324
|
-
]), d([
|
|
4325
|
-
l,
|
|
4326
|
-
u + n,
|
|
4327
|
-
i,
|
|
4328
|
-
a + n
|
|
4329
|
-
]), d([
|
|
4330
|
-
i,
|
|
4331
|
-
a + n,
|
|
4332
|
-
f,
|
|
4333
|
-
p + n
|
|
4406
|
+
m + n
|
|
4334
4407
|
]);
|
|
4335
4408
|
}
|
|
4336
4409
|
return t;
|
|
@@ -4339,7 +4412,7 @@ function Cn(e = {}) {
|
|
|
4339
4412
|
type: "polygon",
|
|
4340
4413
|
vertices: c,
|
|
4341
4414
|
paint: {
|
|
4342
|
-
fill: s.fill,
|
|
4415
|
+
fill: Dn(r, s.fill),
|
|
4343
4416
|
stroke: s.stroke,
|
|
4344
4417
|
strokeWidth: s.strokeWidth
|
|
4345
4418
|
},
|
|
@@ -4349,15 +4422,15 @@ function Cn(e = {}) {
|
|
|
4349
4422
|
};
|
|
4350
4423
|
}
|
|
4351
4424
|
function s(e) {
|
|
4352
|
-
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(
|
|
4353
|
-
for (let e = 0; e <
|
|
4354
|
-
let n = e /
|
|
4425
|
+
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(J * 2);
|
|
4426
|
+
for (let e = 0; e < J; e++) {
|
|
4427
|
+
let n = e / J * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
|
|
4355
4428
|
s[e * 2] = o, s[e * 2 + 1] = c;
|
|
4356
4429
|
}
|
|
4357
4430
|
if (o.dash || o.dashEnabled) {
|
|
4358
4431
|
let t = [];
|
|
4359
|
-
for (let n = 0; n <
|
|
4360
|
-
let r = (n + 1) %
|
|
4432
|
+
for (let n = 0; n < J; n++) {
|
|
4433
|
+
let r = (n + 1) % J;
|
|
4361
4434
|
t.push({
|
|
4362
4435
|
type: "line",
|
|
4363
4436
|
points: [
|
|
@@ -4376,43 +4449,43 @@ function Cn(e = {}) {
|
|
|
4376
4449
|
}
|
|
4377
4450
|
return t;
|
|
4378
4451
|
}
|
|
4379
|
-
let c = [];
|
|
4452
|
+
let c = [], l = Dn(r, o.fill);
|
|
4380
4453
|
if (n > 0 && o.fill) {
|
|
4381
|
-
let t = 0, r = 0, i = 0, a = -Infinity,
|
|
4382
|
-
for (let e = 0; e <
|
|
4383
|
-
let
|
|
4384
|
-
for (let e = 0; e <=
|
|
4385
|
-
for (let e =
|
|
4454
|
+
let t = 0, r = 0, i = 0, a = -Infinity, u = Infinity, d = -Infinity;
|
|
4455
|
+
for (let e = 0; e < J; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
|
|
4456
|
+
let f = [], p = t;
|
|
4457
|
+
for (let e = 0; e <= J && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % J;
|
|
4458
|
+
for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + n);
|
|
4386
4459
|
c.push({
|
|
4387
4460
|
type: "polygon",
|
|
4388
|
-
vertices:
|
|
4461
|
+
vertices: f,
|
|
4389
4462
|
paint: {
|
|
4390
|
-
fill:
|
|
4463
|
+
fill: En(l, .2),
|
|
4391
4464
|
stroke: o.stroke,
|
|
4392
4465
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4393
4466
|
},
|
|
4394
4467
|
layer: e.layer
|
|
4395
4468
|
});
|
|
4396
|
-
let
|
|
4397
|
-
|
|
4398
|
-
for (let e = 0; e <=
|
|
4399
|
-
for (let e =
|
|
4469
|
+
let m = [];
|
|
4470
|
+
p = i;
|
|
4471
|
+
for (let e = 0; e <= J && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % J;
|
|
4472
|
+
for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + n);
|
|
4400
4473
|
c.push({
|
|
4401
4474
|
type: "polygon",
|
|
4402
|
-
vertices:
|
|
4475
|
+
vertices: m,
|
|
4403
4476
|
paint: {
|
|
4404
|
-
fill:
|
|
4477
|
+
fill: En(l, .4),
|
|
4405
4478
|
stroke: o.stroke,
|
|
4406
4479
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4407
4480
|
},
|
|
4408
4481
|
layer: e.layer
|
|
4409
4482
|
});
|
|
4410
4483
|
}
|
|
4411
|
-
let
|
|
4484
|
+
let u = {
|
|
4412
4485
|
type: "polygon",
|
|
4413
4486
|
vertices: s,
|
|
4414
4487
|
paint: {
|
|
4415
|
-
fill:
|
|
4488
|
+
fill: l,
|
|
4416
4489
|
stroke: o.stroke,
|
|
4417
4490
|
strokeWidth: o.strokeWidth
|
|
4418
4491
|
},
|
|
@@ -4420,7 +4493,7 @@ function Cn(e = {}) {
|
|
|
4420
4493
|
hit: e.hit,
|
|
4421
4494
|
noScale: e.noScale
|
|
4422
4495
|
};
|
|
4423
|
-
return c.push(
|
|
4496
|
+
return c.push(u), c.length === 1 ? c[0] : c;
|
|
4424
4497
|
}
|
|
4425
4498
|
return {
|
|
4426
4499
|
transform(e) {
|
|
@@ -4429,11 +4502,15 @@ function Cn(e = {}) {
|
|
|
4429
4502
|
case "circle": return s(e);
|
|
4430
4503
|
case "line": return {
|
|
4431
4504
|
...e,
|
|
4432
|
-
points:
|
|
4505
|
+
points: An(r, e.points)
|
|
4433
4506
|
};
|
|
4434
4507
|
case "polygon": return {
|
|
4435
4508
|
...e,
|
|
4436
|
-
vertices:
|
|
4509
|
+
vertices: An(r, e.vertices),
|
|
4510
|
+
paint: {
|
|
4511
|
+
...e.paint,
|
|
4512
|
+
fill: Dn(r, e.paint.fill)
|
|
4513
|
+
}
|
|
4437
4514
|
};
|
|
4438
4515
|
case "text": {
|
|
4439
4516
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
@@ -4488,21 +4565,21 @@ function Cn(e = {}) {
|
|
|
4488
4565
|
}
|
|
4489
4566
|
//#endregion
|
|
4490
4567
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4491
|
-
var
|
|
4492
|
-
function
|
|
4493
|
-
let t =
|
|
4494
|
-
if (!t) return
|
|
4495
|
-
let n =
|
|
4496
|
-
return
|
|
4497
|
-
}
|
|
4498
|
-
function
|
|
4568
|
+
var Y = "#1a1a1a", Nn = "#ffc200", Pn = "#ff6600", Fn = 26, In = 26, Ln = 26, Rn = 255, zn = 194, Bn = 0;
|
|
4569
|
+
function Vn(e) {
|
|
4570
|
+
let t = K(e);
|
|
4571
|
+
if (!t) return q(Rn, zn, Bn);
|
|
4572
|
+
let n = Nt(t);
|
|
4573
|
+
return q(Math.round(Fn + (Rn - Fn) * n), Math.round(In + (zn - In) * n), Math.round(Ln + (Bn - Ln) * n), t.a);
|
|
4574
|
+
}
|
|
4575
|
+
function Hn(e) {
|
|
4499
4576
|
return {
|
|
4500
4577
|
...e,
|
|
4501
|
-
fill: e.fill
|
|
4502
|
-
stroke: e.stroke ?
|
|
4578
|
+
fill: G(e.fill, Vn),
|
|
4579
|
+
stroke: e.stroke ? Y : e.stroke
|
|
4503
4580
|
};
|
|
4504
4581
|
}
|
|
4505
|
-
function
|
|
4582
|
+
function Un(e, t, n, r) {
|
|
4506
4583
|
let i = [], a = e.length;
|
|
4507
4584
|
for (let o = 0; o < a; o++) {
|
|
4508
4585
|
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;
|
|
@@ -4513,7 +4590,7 @@ function Pn(e, t, n, r) {
|
|
|
4513
4590
|
}
|
|
4514
4591
|
return i;
|
|
4515
4592
|
}
|
|
4516
|
-
function
|
|
4593
|
+
function Wn(e, t, n, r, i) {
|
|
4517
4594
|
let a = [
|
|
4518
4595
|
[e, t],
|
|
4519
4596
|
[e + n, t],
|
|
@@ -4521,37 +4598,37 @@ function Fn(e, t, n, r, i) {
|
|
|
4521
4598
|
[e, t + r]
|
|
4522
4599
|
], 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 = [];
|
|
4523
4600
|
for (let e = u; e <= d; e++) {
|
|
4524
|
-
let t = e * o, n = t + s, r =
|
|
4525
|
-
r =
|
|
4601
|
+
let t = e * o, n = t + s, r = Un(a, 1, 1, t);
|
|
4602
|
+
r = Un(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
4526
4603
|
}
|
|
4527
4604
|
return f;
|
|
4528
4605
|
}
|
|
4529
|
-
var
|
|
4606
|
+
var Gn = { transform(e, t) {
|
|
4530
4607
|
switch (e.type) {
|
|
4531
4608
|
case "rect": {
|
|
4532
4609
|
if (!e.paint.fill) return {
|
|
4533
4610
|
...e,
|
|
4534
|
-
paint:
|
|
4611
|
+
paint: Hn(e.paint)
|
|
4535
4612
|
};
|
|
4536
4613
|
let n = {
|
|
4537
4614
|
...e,
|
|
4538
4615
|
paint: {
|
|
4539
|
-
fill:
|
|
4616
|
+
fill: Y,
|
|
4540
4617
|
strokeWidth: e.paint.strokeWidth
|
|
4541
4618
|
}
|
|
4542
|
-
}, r =
|
|
4619
|
+
}, r = Wn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4543
4620
|
type: "polygon",
|
|
4544
4621
|
vertices: t,
|
|
4545
4622
|
layer: e.layer,
|
|
4546
4623
|
paint: {
|
|
4547
|
-
fill:
|
|
4624
|
+
fill: Nn,
|
|
4548
4625
|
alpha: .65
|
|
4549
4626
|
}
|
|
4550
4627
|
})), i = {
|
|
4551
4628
|
...e,
|
|
4552
4629
|
hit: void 0,
|
|
4553
4630
|
paint: {
|
|
4554
|
-
stroke:
|
|
4631
|
+
stroke: Y,
|
|
4555
4632
|
strokeWidth: e.paint.strokeWidth
|
|
4556
4633
|
}
|
|
4557
4634
|
};
|
|
@@ -4563,38 +4640,38 @@ var In = { transform(e, t) {
|
|
|
4563
4640
|
}
|
|
4564
4641
|
case "circle": return {
|
|
4565
4642
|
...e,
|
|
4566
|
-
paint:
|
|
4643
|
+
paint: Hn(e.paint)
|
|
4567
4644
|
};
|
|
4568
4645
|
case "polygon": return {
|
|
4569
4646
|
...e,
|
|
4570
4647
|
paint: {
|
|
4571
4648
|
...e.paint,
|
|
4572
|
-
fill: e.paint.fill ?
|
|
4573
|
-
stroke: e.paint.stroke ?
|
|
4649
|
+
fill: e.paint.fill ? Pn : e.paint.fill,
|
|
4650
|
+
stroke: e.paint.stroke ? Y : e.paint.stroke
|
|
4574
4651
|
}
|
|
4575
4652
|
};
|
|
4576
4653
|
case "line": return {
|
|
4577
4654
|
...e,
|
|
4578
4655
|
paint: e.paint.stroke ? {
|
|
4579
4656
|
...e.paint,
|
|
4580
|
-
stroke:
|
|
4657
|
+
stroke: Pn
|
|
4581
4658
|
} : e.paint
|
|
4582
4659
|
};
|
|
4583
4660
|
case "text": return {
|
|
4584
4661
|
...e,
|
|
4585
|
-
fill:
|
|
4586
|
-
stroke:
|
|
4662
|
+
fill: Pn,
|
|
4663
|
+
stroke: Y,
|
|
4587
4664
|
strokeWidth: t.roomSize * .25
|
|
4588
4665
|
};
|
|
4589
4666
|
case "image":
|
|
4590
4667
|
case "group": return e;
|
|
4591
4668
|
}
|
|
4592
|
-
} },
|
|
4593
|
-
function
|
|
4669
|
+
} }, Kn = "#c8eeff", qn = "#00c8ff", Jn = "#00ffaa", Yn = .2, Xn = 5, Zn = 190;
|
|
4670
|
+
function Qn(e, t, n) {
|
|
4594
4671
|
e /= 255, t /= 255, n /= 255;
|
|
4595
4672
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4596
4673
|
if (r === i) return [
|
|
4597
|
-
|
|
4674
|
+
Zn,
|
|
4598
4675
|
0,
|
|
4599
4676
|
a
|
|
4600
4677
|
];
|
|
@@ -4605,54 +4682,54 @@ function Un(e, t, n) {
|
|
|
4605
4682
|
a
|
|
4606
4683
|
];
|
|
4607
4684
|
}
|
|
4608
|
-
function
|
|
4685
|
+
function $n(e, t, n, r = 1) {
|
|
4609
4686
|
e = (e % 360 + 360) % 360;
|
|
4610
4687
|
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;
|
|
4611
4688
|
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);
|
|
4612
4689
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4613
4690
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4614
4691
|
}
|
|
4615
|
-
function
|
|
4616
|
-
let t =
|
|
4617
|
-
if (!t) return
|
|
4618
|
-
let [n, r] =
|
|
4619
|
-
return
|
|
4692
|
+
function er(e) {
|
|
4693
|
+
let t = K(e);
|
|
4694
|
+
if (!t) return $n(Zn, .55, .18);
|
|
4695
|
+
let [n, r] = Qn(t.r, t.g, t.b);
|
|
4696
|
+
return $n(r < .08 ? Zn : n, .55, .18, t.a);
|
|
4620
4697
|
}
|
|
4621
|
-
function
|
|
4698
|
+
function tr(e) {
|
|
4622
4699
|
return {
|
|
4623
4700
|
...e,
|
|
4624
|
-
fill: e.fill
|
|
4625
|
-
stroke: e.stroke ?
|
|
4701
|
+
fill: G(e.fill, er),
|
|
4702
|
+
stroke: e.stroke ? qn : e.stroke
|
|
4626
4703
|
};
|
|
4627
4704
|
}
|
|
4628
|
-
function
|
|
4705
|
+
function nr(e) {
|
|
4629
4706
|
return {
|
|
4630
|
-
stroke:
|
|
4631
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4632
|
-
alpha:
|
|
4707
|
+
stroke: qn,
|
|
4708
|
+
strokeWidth: (e.strokeWidth ?? 1) * Xn,
|
|
4709
|
+
alpha: Yn
|
|
4633
4710
|
};
|
|
4634
4711
|
}
|
|
4635
|
-
function
|
|
4712
|
+
function rr(e) {
|
|
4636
4713
|
return {
|
|
4637
|
-
stroke:
|
|
4638
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4639
|
-
alpha:
|
|
4714
|
+
stroke: Jn,
|
|
4715
|
+
strokeWidth: (e.strokeWidth ?? 1) * Xn,
|
|
4716
|
+
alpha: Yn,
|
|
4640
4717
|
dash: e.dash,
|
|
4641
4718
|
dashEnabled: e.dashEnabled
|
|
4642
4719
|
};
|
|
4643
4720
|
}
|
|
4644
|
-
var
|
|
4721
|
+
var ir = { transform(e) {
|
|
4645
4722
|
switch (e.type) {
|
|
4646
4723
|
case "rect": {
|
|
4647
4724
|
let t = {
|
|
4648
4725
|
...e,
|
|
4649
|
-
paint:
|
|
4726
|
+
paint: tr(e.paint)
|
|
4650
4727
|
};
|
|
4651
4728
|
return e.paint.stroke ? [{
|
|
4652
4729
|
...e,
|
|
4653
4730
|
hit: void 0,
|
|
4654
4731
|
paint: {
|
|
4655
|
-
...
|
|
4732
|
+
...nr(e.paint),
|
|
4656
4733
|
fill: void 0
|
|
4657
4734
|
}
|
|
4658
4735
|
}, t] : t;
|
|
@@ -4660,13 +4737,13 @@ var Yn = { transform(e) {
|
|
|
4660
4737
|
case "circle": {
|
|
4661
4738
|
let t = {
|
|
4662
4739
|
...e,
|
|
4663
|
-
paint:
|
|
4740
|
+
paint: tr(e.paint)
|
|
4664
4741
|
};
|
|
4665
4742
|
return e.paint.stroke ? [{
|
|
4666
4743
|
...e,
|
|
4667
4744
|
hit: void 0,
|
|
4668
4745
|
paint: {
|
|
4669
|
-
...
|
|
4746
|
+
...nr(e.paint),
|
|
4670
4747
|
fill: void 0
|
|
4671
4748
|
}
|
|
4672
4749
|
}, t] : t;
|
|
@@ -4683,38 +4760,100 @@ var Yn = { transform(e) {
|
|
|
4683
4760
|
...e,
|
|
4684
4761
|
paint: e.paint.stroke ? {
|
|
4685
4762
|
...e.paint,
|
|
4686
|
-
stroke:
|
|
4763
|
+
stroke: Jn
|
|
4687
4764
|
} : e.paint
|
|
4688
4765
|
};
|
|
4689
4766
|
return e.paint.stroke ? [{
|
|
4690
4767
|
...e,
|
|
4691
4768
|
hit: void 0,
|
|
4692
|
-
paint:
|
|
4769
|
+
paint: rr(e.paint)
|
|
4693
4770
|
}, t] : t;
|
|
4694
4771
|
}
|
|
4695
4772
|
case "polygon": return {
|
|
4696
4773
|
...e,
|
|
4697
4774
|
paint: {
|
|
4698
4775
|
...e.paint,
|
|
4699
|
-
fill: e.paint.fill ?
|
|
4776
|
+
fill: e.paint.fill ? Jn : e.paint.fill,
|
|
4700
4777
|
stroke: void 0
|
|
4701
4778
|
}
|
|
4702
4779
|
};
|
|
4703
4780
|
case "text": return {
|
|
4704
4781
|
...e,
|
|
4705
|
-
fill:
|
|
4782
|
+
fill: Kn
|
|
4706
4783
|
};
|
|
4707
4784
|
case "image":
|
|
4708
4785
|
case "group": return e;
|
|
4709
4786
|
}
|
|
4710
|
-
} },
|
|
4711
|
-
|
|
4712
|
-
|
|
4787
|
+
} }, ar = {
|
|
4788
|
+
lighten: .35,
|
|
4789
|
+
darken: .25
|
|
4790
|
+
};
|
|
4791
|
+
function or(e = {}) {
|
|
4792
|
+
let t = e.lighten ?? ar.lighten, n = e.darken ?? ar.darken;
|
|
4793
|
+
function r(e, r, i, a, o) {
|
|
4794
|
+
let s = e.fill;
|
|
4795
|
+
if (typeof s != "string") return e;
|
|
4796
|
+
let c = {
|
|
4797
|
+
type: "linear",
|
|
4798
|
+
x0: r,
|
|
4799
|
+
y0: i,
|
|
4800
|
+
x1: r,
|
|
4801
|
+
y1: i + o,
|
|
4802
|
+
stops: [{
|
|
4803
|
+
offset: 0,
|
|
4804
|
+
color: y(s, t)
|
|
4805
|
+
}, {
|
|
4806
|
+
offset: 1,
|
|
4807
|
+
color: v(s, n)
|
|
4808
|
+
}]
|
|
4809
|
+
};
|
|
4810
|
+
return {
|
|
4811
|
+
...e,
|
|
4812
|
+
fill: c
|
|
4813
|
+
};
|
|
4814
|
+
}
|
|
4815
|
+
return { transform(e) {
|
|
4816
|
+
switch (e.type) {
|
|
4817
|
+
case "rect": return {
|
|
4818
|
+
...e,
|
|
4819
|
+
paint: r(e.paint, e.x, e.y, e.width, e.height)
|
|
4820
|
+
};
|
|
4821
|
+
case "circle": return {
|
|
4822
|
+
...e,
|
|
4823
|
+
paint: r(e.paint, e.cx - e.radius, e.cy - e.radius, e.radius * 2, e.radius * 2)
|
|
4824
|
+
};
|
|
4825
|
+
case "polygon": {
|
|
4826
|
+
if (typeof e.paint.fill != "string") return e;
|
|
4827
|
+
let t = Infinity, n = -Infinity, i = Infinity;
|
|
4828
|
+
for (let r = 0; r < e.vertices.length; r += 2) {
|
|
4829
|
+
let a = e.vertices[r], o = e.vertices[r + 1];
|
|
4830
|
+
o < t && (t = o), o > n && (n = o), a < i && (i = a);
|
|
4831
|
+
}
|
|
4832
|
+
return {
|
|
4833
|
+
...e,
|
|
4834
|
+
paint: r(e.paint, i, t, 1, n - t)
|
|
4835
|
+
};
|
|
4836
|
+
}
|
|
4837
|
+
default: return e;
|
|
4838
|
+
}
|
|
4839
|
+
} };
|
|
4840
|
+
}
|
|
4841
|
+
//#endregion
|
|
4842
|
+
//#region src/style/index.ts
|
|
4843
|
+
var sr = Gt, cr = rn, lr = gn;
|
|
4844
|
+
function ur(e) {
|
|
4845
|
+
return Tn(e);
|
|
4713
4846
|
}
|
|
4714
|
-
function
|
|
4715
|
-
return
|
|
4847
|
+
function dr(e = {}) {
|
|
4848
|
+
return Mn(e);
|
|
4716
4849
|
}
|
|
4717
|
-
var
|
|
4850
|
+
var fr = Gn, pr = ir;
|
|
4851
|
+
function mr(e = {}) {
|
|
4852
|
+
return or(e);
|
|
4853
|
+
}
|
|
4854
|
+
//#endregion
|
|
4855
|
+
//#region src/rendering/MapRenderer.ts
|
|
4856
|
+
var hr = class {
|
|
4718
4857
|
get settings() {
|
|
4719
4858
|
return this.state.settings;
|
|
4720
4859
|
}
|
|
@@ -4731,7 +4870,7 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4731
4870
|
return this.backend.events;
|
|
4732
4871
|
}
|
|
4733
4872
|
constructor(e, t, n, r) {
|
|
4734
|
-
this.currentStyle =
|
|
4873
|
+
this.currentStyle = U, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new Mt(this.state, n);
|
|
4735
4874
|
}
|
|
4736
4875
|
destroy() {
|
|
4737
4876
|
this.backend.destroy();
|
|
@@ -4785,7 +4924,7 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4785
4924
|
this.currentStyle = e, this.backend.setStyle(e);
|
|
4786
4925
|
}
|
|
4787
4926
|
clearStyle() {
|
|
4788
|
-
this.setStyle(
|
|
4927
|
+
this.setStyle(U);
|
|
4789
4928
|
}
|
|
4790
4929
|
getStyle() {
|
|
4791
4930
|
return this.currentStyle;
|
|
@@ -4803,10 +4942,10 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4803
4942
|
this.backend.removeSceneOverlay(e);
|
|
4804
4943
|
}
|
|
4805
4944
|
addLiveEffect(e, t) {
|
|
4806
|
-
this.backend instanceof
|
|
4945
|
+
this.backend instanceof Mt && this.backend.addLiveEffect(e, t);
|
|
4807
4946
|
}
|
|
4808
4947
|
removeLiveEffect(e) {
|
|
4809
|
-
this.backend instanceof
|
|
4948
|
+
this.backend instanceof Mt && this.backend.removeLiveEffect(e);
|
|
4810
4949
|
}
|
|
4811
4950
|
hitTest(e, t) {
|
|
4812
4951
|
let n = this.backend.coordinateTransform(e, t);
|
|
@@ -4887,15 +5026,15 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4887
5026
|
getCullingMode() {
|
|
4888
5027
|
return this.state.settings.cullingMode;
|
|
4889
5028
|
}
|
|
4890
|
-
},
|
|
4891
|
-
function
|
|
5029
|
+
}, gr = "room";
|
|
5030
|
+
function _r(e, t) {
|
|
4892
5031
|
let n = /* @__PURE__ */ new Map();
|
|
4893
5032
|
function r(e) {
|
|
4894
5033
|
let t = n.get(e);
|
|
4895
5034
|
return t || (t = [], n.set(e, t)), t;
|
|
4896
5035
|
}
|
|
4897
5036
|
function i(e, t, n, i, o, s, c) {
|
|
4898
|
-
let l = e.layer ?? c ??
|
|
5037
|
+
let l = e.layer ?? c ?? gr;
|
|
4899
5038
|
switch (e.type) {
|
|
4900
5039
|
case "rect": {
|
|
4901
5040
|
let a = {
|
|
@@ -4904,11 +5043,11 @@ function ar(e, t) {
|
|
|
4904
5043
|
y: (n + e.y) * i + s,
|
|
4905
5044
|
w: e.width * i,
|
|
4906
5045
|
h: e.height * i,
|
|
4907
|
-
fill: e.paint.fill,
|
|
5046
|
+
fill: z(e.paint.fill, t, n, i, o, s),
|
|
4908
5047
|
stroke: e.paint.stroke,
|
|
4909
5048
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4910
5049
|
cr: (e.cornerRadius ?? 0) * i,
|
|
4911
|
-
dash:
|
|
5050
|
+
dash: yr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4912
5051
|
};
|
|
4913
5052
|
r(l).push(a);
|
|
4914
5053
|
return;
|
|
@@ -4919,19 +5058,19 @@ function ar(e, t) {
|
|
|
4919
5058
|
cx: (t + e.cx) * i + o,
|
|
4920
5059
|
cy: (n + e.cy) * i + s,
|
|
4921
5060
|
r: e.radius * i,
|
|
4922
|
-
fill: e.paint.fill,
|
|
5061
|
+
fill: z(e.paint.fill, t, n, i, o, s),
|
|
4923
5062
|
stroke: e.paint.stroke,
|
|
4924
5063
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4925
|
-
dash:
|
|
5064
|
+
dash: yr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4926
5065
|
});
|
|
4927
5066
|
return;
|
|
4928
5067
|
case "line": {
|
|
4929
5068
|
let a = {
|
|
4930
5069
|
type: "line",
|
|
4931
|
-
points:
|
|
5070
|
+
points: vr(e.points, t, n, i, o, s),
|
|
4932
5071
|
stroke: e.paint.stroke,
|
|
4933
5072
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4934
|
-
dash:
|
|
5073
|
+
dash: yr(e.paint.dash, i, e.paint.dashEnabled),
|
|
4935
5074
|
lineCap: e.lineCap,
|
|
4936
5075
|
lineJoin: e.lineJoin,
|
|
4937
5076
|
alpha: e.paint.alpha
|
|
@@ -4942,8 +5081,8 @@ function ar(e, t) {
|
|
|
4942
5081
|
case "polygon": {
|
|
4943
5082
|
let a = {
|
|
4944
5083
|
type: "polygon",
|
|
4945
|
-
vertices:
|
|
4946
|
-
fill: e.paint.fill,
|
|
5084
|
+
vertices: vr(e.vertices, t, n, i, o, s),
|
|
5085
|
+
fill: z(e.paint.fill, t, n, i, o, s),
|
|
4947
5086
|
stroke: e.paint.stroke,
|
|
4948
5087
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
4949
5088
|
};
|
|
@@ -4951,7 +5090,7 @@ function ar(e, t) {
|
|
|
4951
5090
|
return;
|
|
4952
5091
|
}
|
|
4953
5092
|
case "text": {
|
|
4954
|
-
let a =
|
|
5093
|
+
let a = br(e.transform, t, n, i, o, s), c = {
|
|
4955
5094
|
type: "text",
|
|
4956
5095
|
x: a ? 0 : (t + e.x) * i + o,
|
|
4957
5096
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -4974,7 +5113,7 @@ function ar(e, t) {
|
|
|
4974
5113
|
return;
|
|
4975
5114
|
}
|
|
4976
5115
|
case "image": {
|
|
4977
|
-
let a =
|
|
5116
|
+
let a = br(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
|
|
4978
5117
|
r(l).push({
|
|
4979
5118
|
type: "image",
|
|
4980
5119
|
x: c,
|
|
@@ -4994,7 +5133,7 @@ function ar(e, t) {
|
|
|
4994
5133
|
function a(e, t, n, a, o, s, c) {
|
|
4995
5134
|
let l = e.layer ?? c;
|
|
4996
5135
|
if (e.noScale) {
|
|
4997
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
5136
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? gr);
|
|
4998
5137
|
d.push({
|
|
4999
5138
|
type: "pushTransform",
|
|
5000
5139
|
matrix: [
|
|
@@ -5021,19 +5160,19 @@ function ar(e, t) {
|
|
|
5021
5160
|
});
|
|
5022
5161
|
return o;
|
|
5023
5162
|
}
|
|
5024
|
-
function
|
|
5163
|
+
function vr(e, t, n, r, i, a) {
|
|
5025
5164
|
let o = Array(e.length);
|
|
5026
5165
|
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;
|
|
5027
5166
|
return o;
|
|
5028
5167
|
}
|
|
5029
|
-
function
|
|
5168
|
+
function yr(e, t, n) {
|
|
5030
5169
|
if (n === !1) return;
|
|
5031
5170
|
if (!e || e.length === 0) return e;
|
|
5032
5171
|
let r = Array(e.length);
|
|
5033
5172
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5034
5173
|
return r;
|
|
5035
5174
|
}
|
|
5036
|
-
function
|
|
5175
|
+
function br(e, t, n, r, i, a) {
|
|
5037
5176
|
if (!e) return;
|
|
5038
5177
|
let [o, s, c, l, u, d] = e;
|
|
5039
5178
|
return [
|
|
@@ -5047,21 +5186,39 @@ function cr(e, t, n, r, i, a) {
|
|
|
5047
5186
|
}
|
|
5048
5187
|
//#endregion
|
|
5049
5188
|
//#region src/render/SvgRenderer.ts
|
|
5050
|
-
function
|
|
5189
|
+
function X(e) {
|
|
5051
5190
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5052
5191
|
}
|
|
5053
|
-
function
|
|
5054
|
-
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ?
|
|
5192
|
+
function Z(e, t) {
|
|
5193
|
+
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? X(t) : t}"`;
|
|
5055
5194
|
}
|
|
5056
|
-
function
|
|
5195
|
+
function xr(e) {
|
|
5057
5196
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5058
5197
|
}
|
|
5059
|
-
|
|
5198
|
+
var Sr = 0;
|
|
5199
|
+
function Cr() {
|
|
5200
|
+
return `mmr-grad-${++Sr}`;
|
|
5201
|
+
}
|
|
5202
|
+
function wr(e, t) {
|
|
5203
|
+
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${X(e.color)}"/>`).join("");
|
|
5204
|
+
return `<defs><linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${t.x0}" y1="${t.y0}" x2="${t.x1}" y2="${t.y1}">${n}</linearGradient></defs>`;
|
|
5205
|
+
}
|
|
5206
|
+
function Tr(e, t) {
|
|
5207
|
+
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${X(e.color)}"/>`).join(""), r = (t.fx === void 0 ? "" : ` fx="${t.fx}"`) + (t.fy === void 0 ? "" : ` fy="${t.fy}"`) + (t.fr === void 0 ? "" : ` fr="${t.fr}"`);
|
|
5208
|
+
return `<defs><radialGradient id="${e}" gradientUnits="userSpaceOnUse" cx="${t.cx}" cy="${t.cy}" r="${t.r}"${r}>${n}</radialGradient></defs>`;
|
|
5209
|
+
}
|
|
5210
|
+
function Er(e, t) {
|
|
5211
|
+
if (e === void 0) return;
|
|
5212
|
+
if (typeof e == "string") return e;
|
|
5213
|
+
let n = Cr();
|
|
5214
|
+
return t.push(e.type === "linear" ? wr(n, e) : Tr(n, e)), `url(#${n})`;
|
|
5215
|
+
}
|
|
5216
|
+
function Dr(e) {
|
|
5060
5217
|
let t = [];
|
|
5061
|
-
for (let n of e)
|
|
5218
|
+
for (let n of e) Or(n.commands, t);
|
|
5062
5219
|
return t;
|
|
5063
5220
|
}
|
|
5064
|
-
function
|
|
5221
|
+
function Or(e, t) {
|
|
5065
5222
|
let n = [];
|
|
5066
5223
|
for (let r of e) switch (r.type) {
|
|
5067
5224
|
case "pushTransform": {
|
|
@@ -5078,66 +5235,72 @@ function fr(e, t) {
|
|
|
5078
5235
|
e && t.push(e);
|
|
5079
5236
|
break;
|
|
5080
5237
|
}
|
|
5081
|
-
default:
|
|
5082
|
-
|
|
5083
|
-
e && t.push(e);
|
|
5238
|
+
default:
|
|
5239
|
+
kr(r, t);
|
|
5084
5240
|
break;
|
|
5085
|
-
}
|
|
5086
5241
|
}
|
|
5087
5242
|
for (; n.length > 0;) t.push(n.pop());
|
|
5088
5243
|
}
|
|
5089
|
-
function
|
|
5244
|
+
function kr(e, t) {
|
|
5090
5245
|
switch (e.type) {
|
|
5091
5246
|
case "rect": {
|
|
5092
|
-
let
|
|
5093
|
-
|
|
5247
|
+
let n = Er(e.fill, t) ?? "none", r = e.cr > 0 ? `${Z("rx", e.cr)}${Z("ry", e.cr)}` : "";
|
|
5248
|
+
t.push(`<rect${Z("x", e.x)}${Z("y", e.y)}${Z("width", e.w)}${Z("height", e.h)}${Z("fill", n)}${Z("stroke", e.stroke)}${e.sw ? Z("stroke-width", e.sw) : ""}${r}${xr(e.dash)}/>`);
|
|
5249
|
+
return;
|
|
5094
5250
|
}
|
|
5095
5251
|
case "circle": {
|
|
5096
|
-
let
|
|
5097
|
-
|
|
5252
|
+
let n = Er(e.fill, t) ?? "none";
|
|
5253
|
+
t.push(`<circle${Z("cx", e.cx)}${Z("cy", e.cy)}${Z("r", e.r)}${Z("fill", n)}${Z("stroke", e.stroke)}${e.sw ? Z("stroke-width", e.sw) : ""}${xr(e.dash)}/>`);
|
|
5254
|
+
return;
|
|
5098
5255
|
}
|
|
5099
5256
|
case "line": {
|
|
5100
|
-
let
|
|
5101
|
-
if (
|
|
5102
|
-
let
|
|
5103
|
-
for (let e = 0; e <
|
|
5104
|
-
|
|
5257
|
+
let n = e.points;
|
|
5258
|
+
if (n.length < 2) return;
|
|
5259
|
+
let r = [];
|
|
5260
|
+
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
5261
|
+
t.push(`<polyline points="${r.join(" ")}"${Z("stroke", e.stroke)}${e.sw ? Z("stroke-width", e.sw) : ""}${xr(e.dash)}${Z("stroke-linecap", e.lineCap)}${Z("stroke-linejoin", e.lineJoin)}${Z("opacity", e.alpha)} fill="none"/>`);
|
|
5262
|
+
return;
|
|
5105
5263
|
}
|
|
5106
5264
|
case "polygon": {
|
|
5107
|
-
let
|
|
5108
|
-
if (
|
|
5109
|
-
let
|
|
5110
|
-
for (let e = 0; e <
|
|
5111
|
-
|
|
5265
|
+
let n = e.vertices;
|
|
5266
|
+
if (n.length < 4) return;
|
|
5267
|
+
let r = [];
|
|
5268
|
+
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
5269
|
+
let i = Er(e.fill, t);
|
|
5270
|
+
t.push(`<polygon points="${r.join(" ")}"${Z("fill", i)}${Z("stroke", e.stroke)}${e.sw ? Z("stroke-width", e.sw) : ""}/>`);
|
|
5271
|
+
return;
|
|
5112
5272
|
}
|
|
5113
5273
|
case "text": {
|
|
5114
|
-
let
|
|
5115
|
-
e.w > 0 && (e.align === "center" ? (
|
|
5116
|
-
let
|
|
5117
|
-
|
|
5274
|
+
let n = e.x, r = e.y, i = "start", a = "auto";
|
|
5275
|
+
e.w > 0 && (e.align === "center" ? (n = e.x + e.w / 2, i = "middle") : e.align === "right" && (n = e.x + e.w, i = "end")), e.h > 0 && e.vAlign === "middle" && (e.baselineRatio === void 0 ? (r = e.y + e.h / 2, a = "central") : r = e.y + e.h / 2 + e.baselineRatio * e.fontSize);
|
|
5276
|
+
let o = e.transform ? ` transform="matrix(${e.transform.join(",")})"` : "", s = e.fontStyle === "bold" ? " font-weight=\"bold\"" : "", c = e.stroke && e.sw > 0 ? ` stroke="${e.stroke}" stroke-width="${e.sw}" paint-order="stroke fill"` : "";
|
|
5277
|
+
t.push(`<text${Z("x", n)}${Z("y", r)}${Z("font-size", e.fontSize)}${e.fontFamily ? Z("font-family", e.fontFamily) : ""}${s}${Z("fill", e.fill)}${c} text-anchor="${i}" dominant-baseline="${a}"${o}>${X(e.text)}</text>`);
|
|
5278
|
+
return;
|
|
5118
5279
|
}
|
|
5119
5280
|
case "image":
|
|
5120
5281
|
if (e.transform) {
|
|
5121
|
-
let [
|
|
5122
|
-
|
|
5282
|
+
let [n, r, i, a, o, s] = e.transform;
|
|
5283
|
+
t.push(`<image${Z("width", e.w)}${Z("height", e.h)} href="${X(e.src)}" transform="matrix(${n},${r},${i},${a},${o},${s})"/>`);
|
|
5284
|
+
return;
|
|
5123
5285
|
}
|
|
5124
|
-
|
|
5286
|
+
t.push(`<image${Z("x", e.x)}${Z("y", e.y)}${Z("width", e.w)}${Z("height", e.h)} href="${X(e.src)}"/>`);
|
|
5287
|
+
return;
|
|
5125
5288
|
}
|
|
5126
5289
|
}
|
|
5127
5290
|
//#endregion
|
|
5128
5291
|
//#region src/render/CanvasRenderer.ts
|
|
5129
|
-
var
|
|
5292
|
+
var Ar = (e) => {
|
|
5130
5293
|
if (typeof Image < "u") {
|
|
5131
5294
|
let t = new Image();
|
|
5132
5295
|
return t.src = e, t;
|
|
5133
5296
|
}
|
|
5134
5297
|
return null;
|
|
5135
5298
|
};
|
|
5136
|
-
function
|
|
5137
|
-
let r = n.imageFactory ??
|
|
5138
|
-
for (let n of t)
|
|
5299
|
+
function jr(e, t, n = {}) {
|
|
5300
|
+
let r = n.imageFactory ?? Ar;
|
|
5301
|
+
for (let n of t) Mr(e, n.commands, r);
|
|
5139
5302
|
}
|
|
5140
|
-
function
|
|
5303
|
+
function Mr(e, t, n) {
|
|
5141
5304
|
let r = 0;
|
|
5142
5305
|
for (let i of t) switch (i.type) {
|
|
5143
5306
|
case "pushTransform":
|
|
@@ -5151,18 +5314,18 @@ function gr(e, t, n) {
|
|
|
5151
5314
|
r > 0 && (e.restore(), r--);
|
|
5152
5315
|
break;
|
|
5153
5316
|
default:
|
|
5154
|
-
|
|
5317
|
+
Nr(e, i, n);
|
|
5155
5318
|
break;
|
|
5156
5319
|
}
|
|
5157
5320
|
for (; r > 0;) e.restore(), r--;
|
|
5158
5321
|
}
|
|
5159
|
-
function
|
|
5322
|
+
function Nr(e, t, n) {
|
|
5160
5323
|
switch (t.type) {
|
|
5161
5324
|
case "rect":
|
|
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());
|
|
5325
|
+
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = L(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
5163
5326
|
break;
|
|
5164
5327
|
case "circle":
|
|
5165
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), 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());
|
|
5328
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = L(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
5166
5329
|
break;
|
|
5167
5330
|
case "line": {
|
|
5168
5331
|
if (t.points.length < 4) break;
|
|
@@ -5176,7 +5339,7 @@ function _r(e, t, n) {
|
|
|
5176
5339
|
if (t.vertices.length < 4) break;
|
|
5177
5340
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
5178
5341
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
5179
|
-
e.closePath(), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
5342
|
+
e.closePath(), t.fill && (e.fillStyle = L(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
5180
5343
|
break;
|
|
5181
5344
|
case "text": {
|
|
5182
5345
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -5217,35 +5380,35 @@ function _r(e, t, n) {
|
|
|
5217
5380
|
}
|
|
5218
5381
|
//#endregion
|
|
5219
5382
|
//#region src/export/flushSceneShapes.ts
|
|
5220
|
-
function
|
|
5221
|
-
n(e.grid), n(e.link), n(e.room), n(
|
|
5383
|
+
function Pr(e, t, n) {
|
|
5384
|
+
n(e.grid), n(e.link), n(e.room), n(Fr(t.state, t.overlays));
|
|
5222
5385
|
for (let e of t.sceneOverlays) {
|
|
5223
5386
|
let r = e.render(t.state, t.viewportBounds);
|
|
5224
5387
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5225
5388
|
}
|
|
5226
5389
|
n(e.topLabel);
|
|
5227
5390
|
}
|
|
5228
|
-
function
|
|
5391
|
+
function Fr(e, t) {
|
|
5229
5392
|
let n = e.getOverlaysForArea(t);
|
|
5230
5393
|
if (!n) return [];
|
|
5231
5394
|
let r = e.settings, i = [];
|
|
5232
5395
|
if (n.paths) for (let t of n.paths) {
|
|
5233
|
-
let n =
|
|
5234
|
-
i.push(...
|
|
5396
|
+
let n = ft(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5397
|
+
i.push(...ht(n));
|
|
5235
5398
|
}
|
|
5236
5399
|
if (n.highlights) for (let t of n.highlights) {
|
|
5237
5400
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5238
|
-
n && i.push(
|
|
5401
|
+
n && i.push(pt(ut(n, t.color, r)));
|
|
5239
5402
|
}
|
|
5240
5403
|
if (n.position) {
|
|
5241
5404
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5242
|
-
t && i.push(
|
|
5405
|
+
t && i.push(mt(dt(t, r)));
|
|
5243
5406
|
}
|
|
5244
5407
|
return i;
|
|
5245
5408
|
}
|
|
5246
5409
|
//#endregion
|
|
5247
5410
|
//#region src/export/sceneBounds.ts
|
|
5248
|
-
function
|
|
5411
|
+
function Ir(e, t, n = 0) {
|
|
5249
5412
|
if (!t.worldToScene) return e;
|
|
5250
5413
|
let r = [
|
|
5251
5414
|
t.worldToScene(e.x, e.y),
|
|
@@ -5263,15 +5426,15 @@ function br(e, t, n = 0) {
|
|
|
5263
5426
|
}
|
|
5264
5427
|
//#endregion
|
|
5265
5428
|
//#region src/export/SvgExporter.ts
|
|
5266
|
-
var
|
|
5429
|
+
var Lr = {
|
|
5267
5430
|
scale: 1,
|
|
5268
5431
|
offsetX: 0,
|
|
5269
5432
|
offsetY: 0
|
|
5270
5433
|
};
|
|
5271
|
-
function
|
|
5434
|
+
function Rr(e) {
|
|
5272
5435
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5273
5436
|
}
|
|
5274
|
-
var
|
|
5437
|
+
var zr = class {
|
|
5275
5438
|
constructor(e = {}) {
|
|
5276
5439
|
this.options = e;
|
|
5277
5440
|
}
|
|
@@ -5280,30 +5443,30 @@ var Cr = class {
|
|
|
5280
5443
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5281
5444
|
let o = a, s = o.getPlane(i);
|
|
5282
5445
|
if (!s) return;
|
|
5283
|
-
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d =
|
|
5446
|
+
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = E.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = He(new Re(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
|
|
5284
5447
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5285
5448
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5286
5449
|
}), p = {
|
|
5287
5450
|
scale: 1,
|
|
5288
5451
|
roomSize: c.roomSize
|
|
5289
|
-
}, m = (e) => t ===
|
|
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="${
|
|
5452
|
+
}, m = (e) => t === U ? e : W(e, t, p), h = Ir(u, t, c.roomSize * .5), g = [];
|
|
5453
|
+
return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${Rr(c.backgroundColor)}"/>`), Pr(f, {
|
|
5291
5454
|
state: e,
|
|
5292
5455
|
viewportBounds: d,
|
|
5293
5456
|
sceneOverlays: n,
|
|
5294
5457
|
overlays: this.options.overlays
|
|
5295
5458
|
}, (e) => {
|
|
5296
|
-
e.length !== 0 && g.push(...
|
|
5459
|
+
e.length !== 0 && g.push(...Dr(_r(m(e), Lr)));
|
|
5297
5460
|
}), g.push("</svg>"), g.join("\n");
|
|
5298
5461
|
}
|
|
5299
|
-
},
|
|
5462
|
+
}, Br = class {
|
|
5300
5463
|
constructor(e = {}) {
|
|
5301
5464
|
this.options = e;
|
|
5302
5465
|
}
|
|
5303
5466
|
render({ backend: e }) {
|
|
5304
5467
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5305
5468
|
}
|
|
5306
|
-
},
|
|
5469
|
+
}, Vr = class {
|
|
5307
5470
|
constructor(e = {}) {
|
|
5308
5471
|
this.options = e;
|
|
5309
5472
|
}
|
|
@@ -5320,14 +5483,14 @@ var Cr = class {
|
|
|
5320
5483
|
};
|
|
5321
5484
|
//#endregion
|
|
5322
5485
|
//#region src/export/canvasToBytes.ts
|
|
5323
|
-
function
|
|
5486
|
+
function Hr(e, t = "image/png", n) {
|
|
5324
5487
|
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);
|
|
5325
5488
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5326
5489
|
return s;
|
|
5327
5490
|
}
|
|
5328
5491
|
//#endregion
|
|
5329
5492
|
//#region src/export/CanvasExporter.ts
|
|
5330
|
-
var
|
|
5493
|
+
var Ur = class {
|
|
5331
5494
|
constructor(e) {
|
|
5332
5495
|
this.options = e;
|
|
5333
5496
|
}
|
|
@@ -5336,71 +5499,71 @@ var Dr = class {
|
|
|
5336
5499
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5337
5500
|
let s = o, c = s.getPlane(a);
|
|
5338
5501
|
if (!c) return;
|
|
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 =
|
|
5502
|
+
let l = e.settings, { width: u, height: d } = this.options, f = this.options.padding ?? 3, p = e.computeExportBounds(s, c, this.options.roomId, f), m = Ir(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 = {
|
|
5340
5503
|
scale: h,
|
|
5341
5504
|
offsetX: v,
|
|
5342
5505
|
offsetY: y
|
|
5343
|
-
}, x =
|
|
5506
|
+
}, x = E.forRenderCamera(u, d, h, v, y), S = {
|
|
5344
5507
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5345
5508
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5346
|
-
}, C =
|
|
5509
|
+
}, C = He(new Re(e.mapReader, l).buildScene(s, c, a, e.lens), x.getViewportBounds(), l, S), w = r.Util.createCanvasElement();
|
|
5347
5510
|
w.width = u, w.height = d;
|
|
5348
5511
|
let T = w.getContext("2d");
|
|
5349
5512
|
if (!T) return;
|
|
5350
5513
|
T.fillStyle = l.backgroundColor, T.fillRect(0, 0, u, d);
|
|
5351
|
-
let
|
|
5514
|
+
let ee = {
|
|
5352
5515
|
scale: h,
|
|
5353
5516
|
roomSize: l.roomSize
|
|
5354
|
-
},
|
|
5355
|
-
return
|
|
5517
|
+
}, D = (e) => t === U ? e : W(e, t, ee);
|
|
5518
|
+
return Pr(C, {
|
|
5356
5519
|
state: e,
|
|
5357
|
-
viewportBounds:
|
|
5520
|
+
viewportBounds: E.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5358
5521
|
sceneOverlays: n,
|
|
5359
5522
|
overlays: this.options.overlays
|
|
5360
5523
|
}, (e) => {
|
|
5361
|
-
e.length !== 0 &&
|
|
5524
|
+
e.length !== 0 && jr(T, _r(D(e), b));
|
|
5362
5525
|
}), w;
|
|
5363
5526
|
}
|
|
5364
|
-
},
|
|
5527
|
+
}, Wr = class {
|
|
5365
5528
|
constructor(e) {
|
|
5366
|
-
this.options = e, this.canvasExporter = new
|
|
5529
|
+
this.options = e, this.canvasExporter = new Ur(e);
|
|
5367
5530
|
}
|
|
5368
5531
|
render(e) {
|
|
5369
5532
|
let t = this.canvasExporter.render(e);
|
|
5370
|
-
if (t) return
|
|
5533
|
+
if (t) return Hr(t, this.options.mimeType, this.options.quality);
|
|
5371
5534
|
}
|
|
5372
|
-
},
|
|
5373
|
-
function
|
|
5535
|
+
}, Q, Gr, Kr = 256;
|
|
5536
|
+
function qr(e, t, n) {
|
|
5374
5537
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5375
|
-
if (
|
|
5376
|
-
let i =
|
|
5538
|
+
if (Gr === r && Q) return Q;
|
|
5539
|
+
let i = Kr, a = i / 2, o = document.createElement("canvas");
|
|
5377
5540
|
o.width = i, o.height = i;
|
|
5378
5541
|
let s = o.getContext("2d");
|
|
5379
5542
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5380
5543
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5381
5544
|
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";
|
|
5382
5545
|
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);
|
|
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),
|
|
5546
|
+
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), Q = o.toDataURL(), Gr = r, Q;
|
|
5384
5547
|
}
|
|
5385
|
-
function
|
|
5548
|
+
function Jr(e, t, n, r) {
|
|
5386
5549
|
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);
|
|
5387
5550
|
return {
|
|
5388
5551
|
cx: e,
|
|
5389
5552
|
cy: t,
|
|
5390
5553
|
displaySize: u,
|
|
5391
|
-
src:
|
|
5554
|
+
src: qr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5392
5555
|
};
|
|
5393
5556
|
}
|
|
5394
5557
|
//#endregion
|
|
5395
5558
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5396
|
-
var
|
|
5559
|
+
var Yr = {
|
|
5397
5560
|
color: "#ffcc44",
|
|
5398
5561
|
radius: 12,
|
|
5399
5562
|
intensity: .7
|
|
5400
|
-
},
|
|
5563
|
+
}, Xr = class {
|
|
5401
5564
|
constructor(e) {
|
|
5402
5565
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5403
|
-
...
|
|
5566
|
+
...Yr,
|
|
5404
5567
|
...e
|
|
5405
5568
|
};
|
|
5406
5569
|
}
|
|
@@ -5423,7 +5586,7 @@ var Pr = {
|
|
|
5423
5586
|
if (e.positionRoomId === void 0) return;
|
|
5424
5587
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5425
5588
|
if (!n) return;
|
|
5426
|
-
let r =
|
|
5589
|
+
let r = Jr(n.x, n.y, t, this.params);
|
|
5427
5590
|
return {
|
|
5428
5591
|
type: "image",
|
|
5429
5592
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5434,7 +5597,7 @@ var Pr = {
|
|
|
5434
5597
|
layer: "overlay"
|
|
5435
5598
|
};
|
|
5436
5599
|
}
|
|
5437
|
-
},
|
|
5600
|
+
}, Zr = /* @__PURE__ */ u(((e, t) => {
|
|
5438
5601
|
t.exports = class {
|
|
5439
5602
|
constructor() {
|
|
5440
5603
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5464,14 +5627,14 @@ var Pr = {
|
|
|
5464
5627
|
return this.queue.find((t) => t.key === e);
|
|
5465
5628
|
}
|
|
5466
5629
|
};
|
|
5467
|
-
})),
|
|
5630
|
+
})), Qr = /* @__PURE__ */ u(((e, t) => {
|
|
5468
5631
|
function n(e, t) {
|
|
5469
5632
|
let r = /* @__PURE__ */ new Map();
|
|
5470
5633
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5471
5634
|
return r;
|
|
5472
5635
|
}
|
|
5473
5636
|
t.exports = n;
|
|
5474
|
-
})),
|
|
5637
|
+
})), $r = /* @__PURE__ */ u(((e, t) => {
|
|
5475
5638
|
function n(e) {
|
|
5476
5639
|
let t = Number(e);
|
|
5477
5640
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5486,7 +5649,7 @@ var Pr = {
|
|
|
5486
5649
|
}), t;
|
|
5487
5650
|
}
|
|
5488
5651
|
t.exports = r;
|
|
5489
|
-
})),
|
|
5652
|
+
})), ei = /* @__PURE__ */ u(((e, t) => {
|
|
5490
5653
|
function n(e) {
|
|
5491
5654
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5492
5655
|
e.forEach((e, t) => {
|
|
@@ -5498,8 +5661,8 @@ var Pr = {
|
|
|
5498
5661
|
});
|
|
5499
5662
|
}
|
|
5500
5663
|
t.exports = n;
|
|
5501
|
-
})),
|
|
5502
|
-
var n =
|
|
5664
|
+
})), ti = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5665
|
+
var n = Zr(), r = Qr(), i = $r(), a = ei();
|
|
5503
5666
|
t.exports = class {
|
|
5504
5667
|
constructor(e) {
|
|
5505
5668
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5549,7 +5712,7 @@ var Pr = {
|
|
|
5549
5712
|
return this.path(...e);
|
|
5550
5713
|
}
|
|
5551
5714
|
};
|
|
5552
|
-
})))(), 1),
|
|
5715
|
+
})))(), 1), ni = {
|
|
5553
5716
|
1: "north",
|
|
5554
5717
|
2: "northeast",
|
|
5555
5718
|
3: "northwest",
|
|
@@ -5562,7 +5725,7 @@ var Pr = {
|
|
|
5562
5725
|
10: "down",
|
|
5563
5726
|
11: "in",
|
|
5564
5727
|
12: "out"
|
|
5565
|
-
},
|
|
5728
|
+
}, ri = {
|
|
5566
5729
|
north: "n",
|
|
5567
5730
|
northeast: "ne",
|
|
5568
5731
|
northwest: "nw",
|
|
@@ -5575,7 +5738,7 @@ var Pr = {
|
|
|
5575
5738
|
down: "down",
|
|
5576
5739
|
in: "in",
|
|
5577
5740
|
out: "out"
|
|
5578
|
-
},
|
|
5741
|
+
}, ii = class {
|
|
5579
5742
|
constructor(e) {
|
|
5580
5743
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5581
5744
|
}
|
|
@@ -5601,12 +5764,12 @@ var Pr = {
|
|
|
5601
5764
|
buildGraph() {
|
|
5602
5765
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5603
5766
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5604
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
5767
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => ni[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
5605
5768
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5606
5769
|
if (s.has(e)) return;
|
|
5607
5770
|
let c = this.mapReader.getRoom(t);
|
|
5608
5771
|
if (c) {
|
|
5609
|
-
let s =
|
|
5772
|
+
let s = ri[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5610
5773
|
a.push({
|
|
5611
5774
|
id: t,
|
|
5612
5775
|
weight: l
|
|
@@ -5637,7 +5800,7 @@ var Pr = {
|
|
|
5637
5800
|
};
|
|
5638
5801
|
//#endregion
|
|
5639
5802
|
//#region src/PathFinder.ts
|
|
5640
|
-
function
|
|
5803
|
+
function ai(e, t) {
|
|
5641
5804
|
e.push(t);
|
|
5642
5805
|
let n = e.length - 1;
|
|
5643
5806
|
for (; n > 0;) {
|
|
@@ -5646,7 +5809,7 @@ function Wr(e, t) {
|
|
|
5646
5809
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5647
5810
|
}
|
|
5648
5811
|
}
|
|
5649
|
-
function
|
|
5812
|
+
function oi(e) {
|
|
5650
5813
|
if (e.length === 0) return;
|
|
5651
5814
|
let t = e[0], n = e.pop();
|
|
5652
5815
|
if (e.length > 0) {
|
|
@@ -5660,16 +5823,16 @@ function Gr(e) {
|
|
|
5660
5823
|
}
|
|
5661
5824
|
return t;
|
|
5662
5825
|
}
|
|
5663
|
-
function
|
|
5826
|
+
function si(e, t, n) {
|
|
5664
5827
|
let r = [n], i = n;
|
|
5665
5828
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5666
5829
|
return r.reverse(), r;
|
|
5667
5830
|
}
|
|
5668
|
-
function
|
|
5831
|
+
function ci(e, t, n) {
|
|
5669
5832
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5670
5833
|
return i ? i.map((e) => Number(e)) : null;
|
|
5671
5834
|
}
|
|
5672
|
-
function
|
|
5835
|
+
function li(e, t, n, r) {
|
|
5673
5836
|
let i = r.getRoom(n);
|
|
5674
5837
|
if (!i) return null;
|
|
5675
5838
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5678,16 +5841,16 @@ function Jr(e, t, n, r) {
|
|
|
5678
5841
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5679
5842
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5680
5843
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5681
|
-
for (d.set(t, 0),
|
|
5844
|
+
for (d.set(t, 0), ai(p, {
|
|
5682
5845
|
id: t,
|
|
5683
5846
|
priority: u(t)
|
|
5684
5847
|
}); p.length > 0;) {
|
|
5685
|
-
let { id: r } =
|
|
5686
|
-
if (r === n) return
|
|
5848
|
+
let { id: r } = oi(p);
|
|
5849
|
+
if (r === n) return si(f, t, n);
|
|
5687
5850
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5688
5851
|
if (a) for (let e of a) {
|
|
5689
5852
|
let t = i + e.weight;
|
|
5690
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
5853
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), ai(p, {
|
|
5691
5854
|
id: e.id,
|
|
5692
5855
|
priority: t + u(e.id)
|
|
5693
5856
|
}));
|
|
@@ -5695,9 +5858,9 @@ function Jr(e, t, n, r) {
|
|
|
5695
5858
|
}
|
|
5696
5859
|
return null;
|
|
5697
5860
|
}
|
|
5698
|
-
var
|
|
5861
|
+
var ui = class {
|
|
5699
5862
|
constructor(e, t = "dijkstra") {
|
|
5700
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
5863
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new ii(e), this.dijkstraGraph = new ti.default(this.mapGraph.getGraphDefinition());
|
|
5701
5864
|
}
|
|
5702
5865
|
get algorithm() {
|
|
5703
5866
|
return this._algorithm;
|
|
@@ -5716,23 +5879,23 @@ var Yr = class {
|
|
|
5716
5879
|
let r;
|
|
5717
5880
|
switch (this._algorithm) {
|
|
5718
5881
|
case "dijkstra":
|
|
5719
|
-
r =
|
|
5882
|
+
r = ci(this.dijkstraGraph, e, t);
|
|
5720
5883
|
break;
|
|
5721
5884
|
case "astar":
|
|
5722
|
-
r =
|
|
5885
|
+
r = li(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5723
5886
|
break;
|
|
5724
5887
|
}
|
|
5725
5888
|
return this.cache.set(n, r), r;
|
|
5726
5889
|
}
|
|
5727
|
-
},
|
|
5890
|
+
}, $ = {
|
|
5728
5891
|
hidden: 2,
|
|
5729
5892
|
stub: 1,
|
|
5730
5893
|
full: 0
|
|
5731
5894
|
};
|
|
5732
|
-
function
|
|
5733
|
-
return n === "first" ? e : n === "least-restrictive" ?
|
|
5895
|
+
function di(e, t, n) {
|
|
5896
|
+
return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
|
|
5734
5897
|
}
|
|
5735
|
-
function
|
|
5898
|
+
function fi(e, ...t) {
|
|
5736
5899
|
let n = {}, r;
|
|
5737
5900
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5738
5901
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -5748,7 +5911,7 @@ function Qr(e, ...t) {
|
|
|
5748
5911
|
for (let o of r) {
|
|
5749
5912
|
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5750
5913
|
if (a === void 0) a = r;
|
|
5751
|
-
else if (a =
|
|
5914
|
+
else if (a = di(a, r, i), i === "first") break;
|
|
5752
5915
|
}
|
|
5753
5916
|
return a ?? "full";
|
|
5754
5917
|
},
|
|
@@ -5761,7 +5924,7 @@ function Qr(e, ...t) {
|
|
|
5761
5924
|
}
|
|
5762
5925
|
//#endregion
|
|
5763
5926
|
//#region src/lens/ExplorationLens.ts
|
|
5764
|
-
var
|
|
5927
|
+
var pi = class {
|
|
5765
5928
|
constructor(e) {
|
|
5766
5929
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5767
5930
|
}
|
|
@@ -5796,7 +5959,7 @@ var $r = class {
|
|
|
5796
5959
|
clear() {
|
|
5797
5960
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5798
5961
|
}
|
|
5799
|
-
},
|
|
5962
|
+
}, mi = {
|
|
5800
5963
|
1: "north",
|
|
5801
5964
|
2: "northeast",
|
|
5802
5965
|
3: "northwest",
|
|
@@ -5810,7 +5973,7 @@ var $r = class {
|
|
|
5810
5973
|
11: "in",
|
|
5811
5974
|
12: "out"
|
|
5812
5975
|
};
|
|
5813
|
-
function
|
|
5976
|
+
function hi() {
|
|
5814
5977
|
return {
|
|
5815
5978
|
areaWidth: 150,
|
|
5816
5979
|
areaHeight: 80,
|
|
@@ -5824,9 +5987,9 @@ function ti() {
|
|
|
5824
5987
|
highlightColor: "#ff9900"
|
|
5825
5988
|
};
|
|
5826
5989
|
}
|
|
5827
|
-
var
|
|
5990
|
+
var gi = class {
|
|
5828
5991
|
constructor(e, t, 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 ??
|
|
5992
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? hi(), this.stage = new r.Stage({
|
|
5830
5993
|
container: e,
|
|
5831
5994
|
width: e.clientWidth,
|
|
5832
5995
|
height: e.clientHeight,
|
|
@@ -6009,14 +6172,14 @@ var ni = class {
|
|
|
6009
6172
|
toAreaId: e.fromAreaId,
|
|
6010
6173
|
fromRoomId: e.toRoomId,
|
|
6011
6174
|
toRoomId: e.fromRoomId,
|
|
6012
|
-
direction: e.direction ?
|
|
6175
|
+
direction: e.direction ? M[e.direction] : null,
|
|
6013
6176
|
fromRoomPosition: e.toRoomPosition,
|
|
6014
6177
|
toRoomPosition: e.fromRoomPosition
|
|
6015
6178
|
});
|
|
6016
6179
|
}
|
|
6017
6180
|
}
|
|
6018
6181
|
getLockedDirections(e) {
|
|
6019
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6182
|
+
return new Set((e.exitLocks ?? []).map((e) => mi[e]).filter((e) => !!e));
|
|
6020
6183
|
}
|
|
6021
6184
|
createConnection(e, t, n) {
|
|
6022
6185
|
let r = this.toPlanarDirection(n);
|
|
@@ -6085,7 +6248,7 @@ var ni = class {
|
|
|
6085
6248
|
}[e.toLowerCase().trim()] ?? null;
|
|
6086
6249
|
}
|
|
6087
6250
|
toPlanarDirection(e) {
|
|
6088
|
-
return e &&
|
|
6251
|
+
return e && j.includes(e) ? e : null;
|
|
6089
6252
|
}
|
|
6090
6253
|
layoutAreas() {
|
|
6091
6254
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6628,6 +6791,6 @@ var ni = class {
|
|
|
6628
6791
|
}
|
|
6629
6792
|
};
|
|
6630
6793
|
//#endregion
|
|
6631
|
-
export { C as ALL_VISIBLE,
|
|
6794
|
+
export { C as ALL_VISIBLE, Xr as AmbientLightOverlay, e as Area, gi as AreaMapRenderer, cr as Blueprint, E as Camera, Ur as CanvasExporter, fr as Construction, te as CullingManager, Je as DrawCommandLayerNode, pi as ExplorationLens, mr as GradientRooms, yt as HitTester, D as IDENTITY_TRANSFORM, dr as Isometric, ii as MapGraph, n as MapReader, hr as MapRenderer, T as MapState, Ye as MaterializingLayerNode, lr as Neon, sr as Parchment, ui as PathFinder, t as Plane, Vr as PngBlobExporter, Wr as PngBytesExporter, Br as PngExporter, qe as RecordingGroupNode, R as RecordingLayerNode, pr as SciFi, ur as Sketchy, zr as SvgExporter, W as applyStyleToShapes, _r as buildDrawCommands, Hr as canvasToBytes, _ as colorLightness, kt as compose, fi as composeLenses, lt as computePathData, hi as createAreaMapSettings, g as createSettings, v as darkenColor, w as defaultExitTreatment, x as hexToRgba, U as identityStyle, Xe as isGradientFill, jr as renderToCanvas, Ze as shapeToRecording, Dr as svgFromBatches, z as transformFill };
|
|
6632
6795
|
|
|
6633
6796
|
//# sourceMappingURL=index.mjs.map
|