mudlet-map-renderer 1.2.2 → 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 +836 -676
- 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,
|
|
@@ -3701,8 +3736,8 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3701
3736
|
this.positionLayerNode.batchDraw();
|
|
3702
3737
|
return;
|
|
3703
3738
|
}
|
|
3704
|
-
let t =
|
|
3705
|
-
this.positionMarker = this.addStyledShape(
|
|
3739
|
+
let t = dt(e, this.state.settings);
|
|
3740
|
+
this.positionMarker = this.addStyledShape(mt(t), this.positionLayerNode);
|
|
3706
3741
|
}
|
|
3707
3742
|
clearCurrentRoomOverlay() {
|
|
3708
3743
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -3721,11 +3756,11 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3721
3756
|
n.set(e.id, e);
|
|
3722
3757
|
let r = [], i = this.sceneManager.exitRenderer, a = this.state.lens;
|
|
3723
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) => {
|
|
3724
|
-
let t = i.renderDataWithColor(e,
|
|
3759
|
+
let t = i.renderDataWithColor(e, jt, this.state.currentZIndex);
|
|
3725
3760
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
3726
3761
|
});
|
|
3727
|
-
for (let n of
|
|
3728
|
-
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));
|
|
3729
3764
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
3730
3765
|
let t = this.state.mapReader.getRoom(e);
|
|
3731
3766
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -3733,11 +3768,11 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3733
3768
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
3734
3769
|
t && this.currentRoomOverlay.push(t);
|
|
3735
3770
|
}), n.forEach((n, r) => {
|
|
3736
|
-
let i = r === e.id, a =
|
|
3737
|
-
strokeOverride: i ?
|
|
3771
|
+
let i = r === e.id, a = be(n, this.state.mapReader, t, {
|
|
3772
|
+
strokeOverride: i ? jt : t.lineColor,
|
|
3738
3773
|
flatPipeline: !0
|
|
3739
3774
|
});
|
|
3740
|
-
a.children.push(...
|
|
3775
|
+
a.children.push(...De(n, this.state.mapReader, t));
|
|
3741
3776
|
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
3742
3777
|
o && this.currentRoomOverlay.push(o);
|
|
3743
3778
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
@@ -3747,7 +3782,7 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3747
3782
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
3748
3783
|
let n = this.state.mapReader.getRoom(e);
|
|
3749
3784
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
3750
|
-
let r =
|
|
3785
|
+
let r = ut(n, t, this.state.settings), i = this.addStyledShape(pt(r), this.overlayLayerNode);
|
|
3751
3786
|
i && this.highlightShapes.set(e, i);
|
|
3752
3787
|
}
|
|
3753
3788
|
}
|
|
@@ -3760,7 +3795,7 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3760
3795
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
3761
3796
|
let n = this.state.mapReader.getRoom(e);
|
|
3762
3797
|
if (!n) continue;
|
|
3763
|
-
let r =
|
|
3798
|
+
let r = ut(n, t.color, this.state.settings), i = this.addStyledShape(pt(r), this.overlayLayerNode);
|
|
3764
3799
|
i && this.highlightShapes.set(e, i);
|
|
3765
3800
|
}
|
|
3766
3801
|
this.overlayLayerNode.batchDraw();
|
|
@@ -3770,8 +3805,8 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3770
3805
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
3771
3806
|
if (!(e === void 0 || t === void 0)) {
|
|
3772
3807
|
for (let n of this.state.paths) {
|
|
3773
|
-
let r =
|
|
3774
|
-
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)) {
|
|
3775
3810
|
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
3776
3811
|
t && this.pathShapes.push(t);
|
|
3777
3812
|
}
|
|
@@ -3790,7 +3825,16 @@ var K = "rgb(120, 72, 0)", Dt = class {
|
|
|
3790
3825
|
};
|
|
3791
3826
|
//#endregion
|
|
3792
3827
|
//#region src/style/shape/paintMap.ts
|
|
3793
|
-
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) {
|
|
3794
3838
|
let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
3795
3839
|
return t ? {
|
|
3796
3840
|
r: parseInt(t[1]),
|
|
@@ -3804,100 +3848,100 @@ function q(e) {
|
|
|
3804
3848
|
a: 1
|
|
3805
3849
|
} : null;
|
|
3806
3850
|
}
|
|
3807
|
-
function
|
|
3851
|
+
function q(e, t, n, r = 1) {
|
|
3808
3852
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
3809
3853
|
}
|
|
3810
|
-
function
|
|
3854
|
+
function Nt(e) {
|
|
3811
3855
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
3812
3856
|
}
|
|
3813
3857
|
//#endregion
|
|
3814
3858
|
//#region src/style/shape/ParchmentStyle.ts
|
|
3815
|
-
var
|
|
3816
|
-
function
|
|
3817
|
-
let t =
|
|
3818
|
-
if (!t) return
|
|
3819
|
-
let n =
|
|
3820
|
-
return
|
|
3821
|
-
}
|
|
3822
|
-
function
|
|
3823
|
-
let t =
|
|
3824
|
-
if (!t || t.a >= 1) return
|
|
3825
|
-
let n =
|
|
3826
|
-
return
|
|
3827
|
-
}
|
|
3828
|
-
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) {
|
|
3829
3873
|
return {
|
|
3830
3874
|
...e,
|
|
3831
|
-
fill: e.fill
|
|
3832
|
-
stroke: e.stroke ?
|
|
3875
|
+
fill: G(e.fill, Ht),
|
|
3876
|
+
stroke: e.stroke ? Ut(e.stroke) : e.stroke
|
|
3833
3877
|
};
|
|
3834
3878
|
}
|
|
3835
|
-
var
|
|
3879
|
+
var Gt = { transform(e) {
|
|
3836
3880
|
switch (e.type) {
|
|
3837
3881
|
case "rect":
|
|
3838
3882
|
case "circle":
|
|
3839
3883
|
case "polygon": return {
|
|
3840
3884
|
...e,
|
|
3841
|
-
paint:
|
|
3885
|
+
paint: Wt(e.paint)
|
|
3842
3886
|
};
|
|
3843
3887
|
case "line": return {
|
|
3844
3888
|
...e,
|
|
3845
3889
|
paint: e.paint.stroke ? {
|
|
3846
3890
|
...e.paint,
|
|
3847
|
-
stroke:
|
|
3891
|
+
stroke: Ut(e.paint.stroke)
|
|
3848
3892
|
} : e.paint
|
|
3849
3893
|
};
|
|
3850
3894
|
case "text": return {
|
|
3851
3895
|
...e,
|
|
3852
|
-
fill:
|
|
3896
|
+
fill: Ft
|
|
3853
3897
|
};
|
|
3854
3898
|
case "image":
|
|
3855
3899
|
case "group": return e;
|
|
3856
3900
|
}
|
|
3857
|
-
} },
|
|
3858
|
-
function
|
|
3859
|
-
let t =
|
|
3860
|
-
if (!t) return
|
|
3861
|
-
let n =
|
|
3862
|
-
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);
|
|
3863
3907
|
}
|
|
3864
|
-
function
|
|
3865
|
-
let t =
|
|
3866
|
-
if (!t || t.a >= 1) return
|
|
3867
|
-
let n =
|
|
3868
|
-
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);
|
|
3869
3913
|
}
|
|
3870
|
-
function
|
|
3914
|
+
function nn(e) {
|
|
3871
3915
|
return {
|
|
3872
3916
|
...e,
|
|
3873
|
-
fill: e.fill
|
|
3874
|
-
stroke: e.stroke ?
|
|
3917
|
+
fill: G(e.fill, en),
|
|
3918
|
+
stroke: e.stroke ? tn(e.stroke) : e.stroke
|
|
3875
3919
|
};
|
|
3876
3920
|
}
|
|
3877
|
-
var
|
|
3921
|
+
var rn = { transform(e) {
|
|
3878
3922
|
switch (e.type) {
|
|
3879
3923
|
case "rect":
|
|
3880
3924
|
case "circle":
|
|
3881
3925
|
case "polygon": return {
|
|
3882
3926
|
...e,
|
|
3883
|
-
paint:
|
|
3927
|
+
paint: nn(e.paint)
|
|
3884
3928
|
};
|
|
3885
3929
|
case "line": return {
|
|
3886
3930
|
...e,
|
|
3887
3931
|
paint: e.paint.stroke ? {
|
|
3888
3932
|
...e.paint,
|
|
3889
|
-
stroke:
|
|
3933
|
+
stroke: tn(e.paint.stroke)
|
|
3890
3934
|
} : e.paint
|
|
3891
3935
|
};
|
|
3892
3936
|
case "text": return {
|
|
3893
3937
|
...e,
|
|
3894
|
-
fill:
|
|
3938
|
+
fill: qt
|
|
3895
3939
|
};
|
|
3896
3940
|
case "image":
|
|
3897
3941
|
case "group": return e;
|
|
3898
3942
|
}
|
|
3899
|
-
} },
|
|
3900
|
-
function
|
|
3943
|
+
} }, an = "#00ffd0", on = .3, sn = 3;
|
|
3944
|
+
function cn(e, t, n) {
|
|
3901
3945
|
e /= 255, t /= 255, n /= 255;
|
|
3902
3946
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
3903
3947
|
if (r === i) return [
|
|
@@ -3912,68 +3956,68 @@ function nn(e, t, n) {
|
|
|
3912
3956
|
a
|
|
3913
3957
|
];
|
|
3914
3958
|
}
|
|
3915
|
-
function
|
|
3959
|
+
function ln(e, t, n, r = 1) {
|
|
3916
3960
|
e = (e % 360 + 360) % 360;
|
|
3917
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;
|
|
3918
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);
|
|
3919
3963
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
3920
3964
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
3921
3965
|
}
|
|
3922
|
-
function
|
|
3923
|
-
let t =
|
|
3966
|
+
function un(e) {
|
|
3967
|
+
let t = K(e);
|
|
3924
3968
|
if (!t) return {
|
|
3925
3969
|
h: 150,
|
|
3926
3970
|
a: 1
|
|
3927
3971
|
};
|
|
3928
|
-
let [n] =
|
|
3972
|
+
let [n] = cn(t.r, t.g, t.b);
|
|
3929
3973
|
return {
|
|
3930
3974
|
h: n,
|
|
3931
3975
|
a: t.a
|
|
3932
3976
|
};
|
|
3933
3977
|
}
|
|
3934
|
-
function
|
|
3935
|
-
let { h: t, a: n } =
|
|
3936
|
-
return
|
|
3978
|
+
function dn(e) {
|
|
3979
|
+
let { h: t, a: n } = un(e);
|
|
3980
|
+
return ln(t, .95, .65, n);
|
|
3937
3981
|
}
|
|
3938
|
-
function
|
|
3939
|
-
let t =
|
|
3982
|
+
function fn(e) {
|
|
3983
|
+
let t = K(e);
|
|
3940
3984
|
if (!t) return "rgb(8, 12, 10)";
|
|
3941
|
-
let [n] =
|
|
3942
|
-
return
|
|
3985
|
+
let [n] = cn(t.r, t.g, t.b);
|
|
3986
|
+
return ln(n, .4, .1, t.a);
|
|
3943
3987
|
}
|
|
3944
|
-
function
|
|
3945
|
-
let { h: t, a: n } =
|
|
3946
|
-
return
|
|
3988
|
+
function pn(e) {
|
|
3989
|
+
let { h: t, a: n } = un(e);
|
|
3990
|
+
return ln(t, .95, .65, Math.min(n, on));
|
|
3947
3991
|
}
|
|
3948
|
-
function
|
|
3992
|
+
function mn(e) {
|
|
3949
3993
|
return {
|
|
3950
3994
|
...e,
|
|
3951
|
-
fill: e.fill
|
|
3952
|
-
stroke: e.stroke ?
|
|
3995
|
+
fill: G(e.fill, fn),
|
|
3996
|
+
stroke: e.stroke ? dn(e.stroke) : e.stroke
|
|
3953
3997
|
};
|
|
3954
3998
|
}
|
|
3955
|
-
function
|
|
3999
|
+
function hn(e, t = !1) {
|
|
3956
4000
|
if (!e.stroke) return e;
|
|
3957
|
-
let n = (e.strokeWidth ?? 1) *
|
|
4001
|
+
let n = (e.strokeWidth ?? 1) * sn;
|
|
3958
4002
|
return {
|
|
3959
|
-
stroke:
|
|
4003
|
+
stroke: pn(e.stroke),
|
|
3960
4004
|
strokeWidth: n,
|
|
3961
4005
|
dash: e.dash,
|
|
3962
4006
|
dashEnabled: e.dashEnabled,
|
|
3963
|
-
alpha: t ?
|
|
4007
|
+
alpha: t ? on : e.alpha
|
|
3964
4008
|
};
|
|
3965
4009
|
}
|
|
3966
|
-
var
|
|
4010
|
+
var gn = { transform(e) {
|
|
3967
4011
|
switch (e.type) {
|
|
3968
4012
|
case "rect": {
|
|
3969
4013
|
let t = {
|
|
3970
4014
|
...e,
|
|
3971
|
-
paint:
|
|
4015
|
+
paint: mn(e.paint)
|
|
3972
4016
|
};
|
|
3973
4017
|
return e.paint.stroke ? [{
|
|
3974
4018
|
...e,
|
|
3975
4019
|
paint: {
|
|
3976
|
-
...
|
|
4020
|
+
...hn(e.paint),
|
|
3977
4021
|
fill: void 0
|
|
3978
4022
|
}
|
|
3979
4023
|
}, t] : t;
|
|
@@ -3981,12 +4025,12 @@ var dn = { transform(e) {
|
|
|
3981
4025
|
case "circle": {
|
|
3982
4026
|
let t = {
|
|
3983
4027
|
...e,
|
|
3984
|
-
paint:
|
|
4028
|
+
paint: mn(e.paint)
|
|
3985
4029
|
};
|
|
3986
4030
|
return e.paint.stroke ? [{
|
|
3987
4031
|
...e,
|
|
3988
4032
|
paint: {
|
|
3989
|
-
...
|
|
4033
|
+
...hn(e.paint),
|
|
3990
4034
|
fill: void 0
|
|
3991
4035
|
}
|
|
3992
4036
|
}, t] : t;
|
|
@@ -3996,21 +4040,21 @@ var dn = { transform(e) {
|
|
|
3996
4040
|
...e,
|
|
3997
4041
|
paint: e.paint.stroke ? {
|
|
3998
4042
|
...e.paint,
|
|
3999
|
-
stroke:
|
|
4043
|
+
stroke: dn(e.paint.stroke)
|
|
4000
4044
|
} : e.paint
|
|
4001
4045
|
};
|
|
4002
4046
|
return e.paint.stroke ? [{
|
|
4003
4047
|
...e,
|
|
4004
|
-
paint:
|
|
4048
|
+
paint: hn(e.paint, !0)
|
|
4005
4049
|
}, t] : t;
|
|
4006
4050
|
}
|
|
4007
4051
|
case "polygon": return {
|
|
4008
4052
|
...e,
|
|
4009
|
-
paint:
|
|
4053
|
+
paint: mn(e.paint)
|
|
4010
4054
|
};
|
|
4011
4055
|
case "text": return {
|
|
4012
4056
|
...e,
|
|
4013
|
-
fill:
|
|
4057
|
+
fill: an
|
|
4014
4058
|
};
|
|
4015
4059
|
case "image":
|
|
4016
4060
|
case "group": return e;
|
|
@@ -4018,16 +4062,16 @@ var dn = { transform(e) {
|
|
|
4018
4062
|
} };
|
|
4019
4063
|
//#endregion
|
|
4020
4064
|
//#region src/style/shape/wobble.ts
|
|
4021
|
-
function
|
|
4065
|
+
function _n(e) {
|
|
4022
4066
|
let t = e | 0 || 1;
|
|
4023
4067
|
return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
|
|
4024
4068
|
}
|
|
4025
|
-
function
|
|
4069
|
+
function vn(...e) {
|
|
4026
4070
|
let t = 2654435769;
|
|
4027
4071
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
4028
4072
|
return t;
|
|
4029
4073
|
}
|
|
4030
|
-
function
|
|
4074
|
+
function yn(e, t, n, r, i, a) {
|
|
4031
4075
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
4032
4076
|
if (c < .001) return [
|
|
4033
4077
|
e,
|
|
@@ -4042,17 +4086,17 @@ function fn(e, t, n, r, i, a) {
|
|
|
4042
4086
|
}
|
|
4043
4087
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
4044
4088
|
}
|
|
4045
|
-
function
|
|
4089
|
+
function bn(e, t, n) {
|
|
4046
4090
|
if (e.length < 4) return e;
|
|
4047
4091
|
let r = [];
|
|
4048
4092
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
4049
|
-
let a =
|
|
4093
|
+
let a = yn(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
4050
4094
|
if (i === 0) r.push(...a);
|
|
4051
4095
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
4052
4096
|
}
|
|
4053
4097
|
return r;
|
|
4054
4098
|
}
|
|
4055
|
-
function
|
|
4099
|
+
function xn(e, t, n, r, i, a) {
|
|
4056
4100
|
let o = [
|
|
4057
4101
|
e,
|
|
4058
4102
|
t,
|
|
@@ -4064,12 +4108,12 @@ function mn(e, t, n, r, i, a) {
|
|
|
4064
4108
|
t + r
|
|
4065
4109
|
], s = [];
|
|
4066
4110
|
for (let e = 0; e < 4; e++) {
|
|
4067
|
-
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u =
|
|
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);
|
|
4068
4112
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
4069
4113
|
}
|
|
4070
4114
|
return s;
|
|
4071
4115
|
}
|
|
4072
|
-
function
|
|
4116
|
+
function Sn(e, t, n, r, i) {
|
|
4073
4117
|
let a = [];
|
|
4074
4118
|
for (let o = 0; o < 24; o++) {
|
|
4075
4119
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -4077,31 +4121,31 @@ function hn(e, t, n, r, i) {
|
|
|
4077
4121
|
}
|
|
4078
4122
|
return a;
|
|
4079
4123
|
}
|
|
4080
|
-
function
|
|
4124
|
+
function Cn(e, t, n) {
|
|
4081
4125
|
let r = e.length / 2;
|
|
4082
4126
|
if (r < 2) return e;
|
|
4083
4127
|
let i = [];
|
|
4084
4128
|
for (let a = 0; a < r; a++) {
|
|
4085
|
-
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d =
|
|
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);
|
|
4086
4130
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
4087
4131
|
}
|
|
4088
4132
|
return i;
|
|
4089
4133
|
}
|
|
4090
4134
|
//#endregion
|
|
4091
4135
|
//#region src/style/shape/SketchyStyle.ts
|
|
4092
|
-
function
|
|
4136
|
+
function wn(e, t) {
|
|
4093
4137
|
if (!t) return e;
|
|
4094
4138
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
4095
4139
|
if (!n) return e;
|
|
4096
4140
|
let r = parseFloat(n[1]);
|
|
4097
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})`;
|
|
4098
4142
|
}
|
|
4099
|
-
function
|
|
4143
|
+
function Tn(e) {
|
|
4100
4144
|
let { jitter: t, color: n } = e;
|
|
4101
4145
|
return { transform(e) {
|
|
4102
4146
|
switch (e.type) {
|
|
4103
4147
|
case "rect": {
|
|
4104
|
-
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;
|
|
4105
4149
|
if (e.cornerRadius && e.cornerRadius > 0) {
|
|
4106
4150
|
let n = [];
|
|
4107
4151
|
if (i && n.push({
|
|
@@ -4114,7 +4158,7 @@ function vn(e) {
|
|
|
4114
4158
|
}), a && e.paint.strokeWidth) {
|
|
4115
4159
|
let i = {
|
|
4116
4160
|
type: "polygon",
|
|
4117
|
-
vertices:
|
|
4161
|
+
vertices: xn(e.x, e.y, e.width, e.height, t, r),
|
|
4118
4162
|
paint: {
|
|
4119
4163
|
stroke: a,
|
|
4120
4164
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -4129,7 +4173,7 @@ function vn(e) {
|
|
|
4129
4173
|
}
|
|
4130
4174
|
return {
|
|
4131
4175
|
type: "polygon",
|
|
4132
|
-
vertices:
|
|
4176
|
+
vertices: xn(e.x, e.y, e.width, e.height, t, r),
|
|
4133
4177
|
paint: {
|
|
4134
4178
|
fill: i,
|
|
4135
4179
|
stroke: a,
|
|
@@ -4141,10 +4185,10 @@ function vn(e) {
|
|
|
4141
4185
|
};
|
|
4142
4186
|
}
|
|
4143
4187
|
case "circle": {
|
|
4144
|
-
let r =
|
|
4188
|
+
let r = _n(vn(e.cx, e.cy, e.radius));
|
|
4145
4189
|
return {
|
|
4146
4190
|
type: "polygon",
|
|
4147
|
-
vertices:
|
|
4191
|
+
vertices: Sn(e.cx, e.cy, e.radius, t, r),
|
|
4148
4192
|
paint: {
|
|
4149
4193
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
4150
4194
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -4156,7 +4200,7 @@ function vn(e) {
|
|
|
4156
4200
|
};
|
|
4157
4201
|
}
|
|
4158
4202
|
case "line": {
|
|
4159
|
-
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 = {
|
|
4160
4204
|
...e.paint,
|
|
4161
4205
|
stroke: a
|
|
4162
4206
|
};
|
|
@@ -4167,7 +4211,7 @@ function vn(e) {
|
|
|
4167
4211
|
};
|
|
4168
4212
|
}
|
|
4169
4213
|
case "polygon": {
|
|
4170
|
-
let r =
|
|
4214
|
+
let r = _n(vn(...e.vertices.slice(0, 4))), i = Cn(e.vertices, t, r);
|
|
4171
4215
|
return {
|
|
4172
4216
|
...e,
|
|
4173
4217
|
vertices: i,
|
|
@@ -4189,16 +4233,42 @@ function vn(e) {
|
|
|
4189
4233
|
}
|
|
4190
4234
|
//#endregion
|
|
4191
4235
|
//#region src/style/shape/IsometricStyle.ts
|
|
4192
|
-
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) {
|
|
4193
4263
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4194
4264
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
4195
4265
|
}
|
|
4196
|
-
function
|
|
4266
|
+
function kn(e) {
|
|
4197
4267
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
4198
4268
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
4199
4269
|
}
|
|
4200
|
-
var
|
|
4201
|
-
function
|
|
4270
|
+
var J = 32;
|
|
4271
|
+
function An(e, t) {
|
|
4202
4272
|
let n = Array(t.length);
|
|
4203
4273
|
for (let r = 0; r < t.length; r += 2) {
|
|
4204
4274
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -4206,7 +4276,7 @@ function xn(e, t) {
|
|
|
4206
4276
|
}
|
|
4207
4277
|
return n;
|
|
4208
4278
|
}
|
|
4209
|
-
function
|
|
4279
|
+
function jn(e, t, n, r, i) {
|
|
4210
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);
|
|
4211
4281
|
return [
|
|
4212
4282
|
a,
|
|
@@ -4219,8 +4289,8 @@ function Sn(e, t, n, r, i) {
|
|
|
4219
4289
|
f
|
|
4220
4290
|
];
|
|
4221
4291
|
}
|
|
4222
|
-
function
|
|
4223
|
-
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);
|
|
4224
4294
|
function a(e, t, n, i) {
|
|
4225
4295
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
4226
4296
|
return [
|
|
@@ -4233,7 +4303,7 @@ function Cn(e = {}) {
|
|
|
4233
4303
|
];
|
|
4234
4304
|
}
|
|
4235
4305
|
function o(e) {
|
|
4236
|
-
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);
|
|
4237
4307
|
if (s.dash || s.dashEnabled) {
|
|
4238
4308
|
let t = [];
|
|
4239
4309
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -4257,83 +4327,83 @@ function Cn(e = {}) {
|
|
|
4257
4327
|
return t;
|
|
4258
4328
|
}
|
|
4259
4329
|
if (n > 0 && s.fill) {
|
|
4260
|
-
let t = [],
|
|
4261
|
-
for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[
|
|
4262
|
-
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);
|
|
4263
4333
|
if (t.push({
|
|
4264
4334
|
type: "polygon",
|
|
4265
4335
|
vertices: [
|
|
4266
|
-
l,
|
|
4267
4336
|
u,
|
|
4268
|
-
|
|
4337
|
+
d,
|
|
4338
|
+
a,
|
|
4339
|
+
o,
|
|
4269
4340
|
a,
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
u + n
|
|
4341
|
+
o + n,
|
|
4342
|
+
u,
|
|
4343
|
+
d + n
|
|
4274
4344
|
],
|
|
4275
|
-
paint: { fill: v
|
|
4345
|
+
paint: { fill: En(v, .2) },
|
|
4276
4346
|
layer: e.layer
|
|
4277
4347
|
}), t.push({
|
|
4278
4348
|
type: "polygon",
|
|
4279
4349
|
vertices: [
|
|
4280
|
-
i,
|
|
4281
4350
|
a,
|
|
4282
|
-
|
|
4351
|
+
o,
|
|
4352
|
+
p,
|
|
4353
|
+
m,
|
|
4283
4354
|
p,
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
a + n
|
|
4355
|
+
m + n,
|
|
4356
|
+
a,
|
|
4357
|
+
o + n
|
|
4288
4358
|
],
|
|
4289
|
-
paint: { fill: v
|
|
4359
|
+
paint: { fill: En(v, .4) },
|
|
4290
4360
|
layer: e.layer
|
|
4291
4361
|
}), t.push({
|
|
4292
4362
|
type: "polygon",
|
|
4293
4363
|
vertices: c,
|
|
4294
|
-
paint: { fill:
|
|
4364
|
+
paint: { fill: v },
|
|
4295
4365
|
layer: e.layer,
|
|
4296
4366
|
hit: e.hit
|
|
4297
4367
|
}), s.stroke && s.strokeWidth) {
|
|
4298
|
-
let r = s.strokeWidth,
|
|
4368
|
+
let r = s.strokeWidth, i = s.stroke, c = e.layer, l = (e) => t.push({
|
|
4299
4369
|
type: "line",
|
|
4300
4370
|
points: e,
|
|
4301
4371
|
paint: {
|
|
4302
|
-
stroke:
|
|
4372
|
+
stroke: i,
|
|
4303
4373
|
strokeWidth: r
|
|
4304
4374
|
},
|
|
4305
4375
|
layer: c
|
|
4306
4376
|
});
|
|
4307
|
-
|
|
4308
|
-
h,
|
|
4377
|
+
l([
|
|
4309
4378
|
g,
|
|
4310
|
-
|
|
4311
|
-
u
|
|
4312
|
-
|
|
4313
|
-
|
|
4379
|
+
_,
|
|
4380
|
+
u,
|
|
4381
|
+
d
|
|
4382
|
+
]), l([
|
|
4314
4383
|
p,
|
|
4315
|
-
|
|
4316
|
-
g
|
|
4317
|
-
|
|
4318
|
-
|
|
4384
|
+
m,
|
|
4385
|
+
g,
|
|
4386
|
+
_
|
|
4387
|
+
]), l([
|
|
4319
4388
|
u,
|
|
4320
|
-
|
|
4321
|
-
u
|
|
4322
|
-
|
|
4323
|
-
|
|
4389
|
+
d,
|
|
4390
|
+
u,
|
|
4391
|
+
d + n
|
|
4392
|
+
]), l([
|
|
4393
|
+
p,
|
|
4394
|
+
m,
|
|
4395
|
+
p,
|
|
4396
|
+
m + n
|
|
4397
|
+
]), l([
|
|
4398
|
+
u,
|
|
4399
|
+
d + n,
|
|
4400
|
+
a,
|
|
4401
|
+
o + n
|
|
4402
|
+
]), l([
|
|
4403
|
+
a,
|
|
4404
|
+
o + n,
|
|
4324
4405
|
p,
|
|
4325
|
-
|
|
4326
|
-
p + n
|
|
4327
|
-
]), d([
|
|
4328
|
-
l,
|
|
4329
|
-
u + n,
|
|
4330
|
-
i,
|
|
4331
|
-
a + n
|
|
4332
|
-
]), d([
|
|
4333
|
-
i,
|
|
4334
|
-
a + n,
|
|
4335
|
-
f,
|
|
4336
|
-
p + n
|
|
4406
|
+
m + n
|
|
4337
4407
|
]);
|
|
4338
4408
|
}
|
|
4339
4409
|
return t;
|
|
@@ -4342,7 +4412,7 @@ function Cn(e = {}) {
|
|
|
4342
4412
|
type: "polygon",
|
|
4343
4413
|
vertices: c,
|
|
4344
4414
|
paint: {
|
|
4345
|
-
fill: s.fill,
|
|
4415
|
+
fill: Dn(r, s.fill),
|
|
4346
4416
|
stroke: s.stroke,
|
|
4347
4417
|
strokeWidth: s.strokeWidth
|
|
4348
4418
|
},
|
|
@@ -4352,15 +4422,15 @@ function Cn(e = {}) {
|
|
|
4352
4422
|
};
|
|
4353
4423
|
}
|
|
4354
4424
|
function s(e) {
|
|
4355
|
-
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(
|
|
4356
|
-
for (let e = 0; e <
|
|
4357
|
-
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);
|
|
4358
4428
|
s[e * 2] = o, s[e * 2 + 1] = c;
|
|
4359
4429
|
}
|
|
4360
4430
|
if (o.dash || o.dashEnabled) {
|
|
4361
4431
|
let t = [];
|
|
4362
|
-
for (let n = 0; n <
|
|
4363
|
-
let r = (n + 1) %
|
|
4432
|
+
for (let n = 0; n < J; n++) {
|
|
4433
|
+
let r = (n + 1) % J;
|
|
4364
4434
|
t.push({
|
|
4365
4435
|
type: "line",
|
|
4366
4436
|
points: [
|
|
@@ -4379,43 +4449,43 @@ function Cn(e = {}) {
|
|
|
4379
4449
|
}
|
|
4380
4450
|
return t;
|
|
4381
4451
|
}
|
|
4382
|
-
let c = [];
|
|
4452
|
+
let c = [], l = Dn(r, o.fill);
|
|
4383
4453
|
if (n > 0 && o.fill) {
|
|
4384
|
-
let t = 0, r = 0, i = 0, a = -Infinity,
|
|
4385
|
-
for (let e = 0; e <
|
|
4386
|
-
let
|
|
4387
|
-
for (let e = 0; e <=
|
|
4388
|
-
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);
|
|
4389
4459
|
c.push({
|
|
4390
4460
|
type: "polygon",
|
|
4391
|
-
vertices:
|
|
4461
|
+
vertices: f,
|
|
4392
4462
|
paint: {
|
|
4393
|
-
fill:
|
|
4463
|
+
fill: En(l, .2),
|
|
4394
4464
|
stroke: o.stroke,
|
|
4395
4465
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4396
4466
|
},
|
|
4397
4467
|
layer: e.layer
|
|
4398
4468
|
});
|
|
4399
|
-
let
|
|
4400
|
-
|
|
4401
|
-
for (let e = 0; e <=
|
|
4402
|
-
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);
|
|
4403
4473
|
c.push({
|
|
4404
4474
|
type: "polygon",
|
|
4405
|
-
vertices:
|
|
4475
|
+
vertices: m,
|
|
4406
4476
|
paint: {
|
|
4407
|
-
fill:
|
|
4477
|
+
fill: En(l, .4),
|
|
4408
4478
|
stroke: o.stroke,
|
|
4409
4479
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
4410
4480
|
},
|
|
4411
4481
|
layer: e.layer
|
|
4412
4482
|
});
|
|
4413
4483
|
}
|
|
4414
|
-
let
|
|
4484
|
+
let u = {
|
|
4415
4485
|
type: "polygon",
|
|
4416
4486
|
vertices: s,
|
|
4417
4487
|
paint: {
|
|
4418
|
-
fill:
|
|
4488
|
+
fill: l,
|
|
4419
4489
|
stroke: o.stroke,
|
|
4420
4490
|
strokeWidth: o.strokeWidth
|
|
4421
4491
|
},
|
|
@@ -4423,7 +4493,7 @@ function Cn(e = {}) {
|
|
|
4423
4493
|
hit: e.hit,
|
|
4424
4494
|
noScale: e.noScale
|
|
4425
4495
|
};
|
|
4426
|
-
return c.push(
|
|
4496
|
+
return c.push(u), c.length === 1 ? c[0] : c;
|
|
4427
4497
|
}
|
|
4428
4498
|
return {
|
|
4429
4499
|
transform(e) {
|
|
@@ -4432,11 +4502,15 @@ function Cn(e = {}) {
|
|
|
4432
4502
|
case "circle": return s(e);
|
|
4433
4503
|
case "line": return {
|
|
4434
4504
|
...e,
|
|
4435
|
-
points:
|
|
4505
|
+
points: An(r, e.points)
|
|
4436
4506
|
};
|
|
4437
4507
|
case "polygon": return {
|
|
4438
4508
|
...e,
|
|
4439
|
-
vertices:
|
|
4509
|
+
vertices: An(r, e.vertices),
|
|
4510
|
+
paint: {
|
|
4511
|
+
...e.paint,
|
|
4512
|
+
fill: Dn(r, e.paint.fill)
|
|
4513
|
+
}
|
|
4440
4514
|
};
|
|
4441
4515
|
case "text": {
|
|
4442
4516
|
let t = e.width ?? 0, n = e.height ?? 0;
|
|
@@ -4491,21 +4565,21 @@ function Cn(e = {}) {
|
|
|
4491
4565
|
}
|
|
4492
4566
|
//#endregion
|
|
4493
4567
|
//#region src/style/shape/ConstructionStyle.ts
|
|
4494
|
-
var
|
|
4495
|
-
function
|
|
4496
|
-
let t =
|
|
4497
|
-
if (!t) return
|
|
4498
|
-
let n =
|
|
4499
|
-
return
|
|
4500
|
-
}
|
|
4501
|
-
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) {
|
|
4502
4576
|
return {
|
|
4503
4577
|
...e,
|
|
4504
|
-
fill: e.fill
|
|
4505
|
-
stroke: e.stroke ?
|
|
4578
|
+
fill: G(e.fill, Vn),
|
|
4579
|
+
stroke: e.stroke ? Y : e.stroke
|
|
4506
4580
|
};
|
|
4507
4581
|
}
|
|
4508
|
-
function
|
|
4582
|
+
function Un(e, t, n, r) {
|
|
4509
4583
|
let i = [], a = e.length;
|
|
4510
4584
|
for (let o = 0; o < a; o++) {
|
|
4511
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;
|
|
@@ -4516,7 +4590,7 @@ function Pn(e, t, n, r) {
|
|
|
4516
4590
|
}
|
|
4517
4591
|
return i;
|
|
4518
4592
|
}
|
|
4519
|
-
function
|
|
4593
|
+
function Wn(e, t, n, r, i) {
|
|
4520
4594
|
let a = [
|
|
4521
4595
|
[e, t],
|
|
4522
4596
|
[e + n, t],
|
|
@@ -4524,37 +4598,37 @@ function Fn(e, t, n, r, i) {
|
|
|
4524
4598
|
[e, t + r]
|
|
4525
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 = [];
|
|
4526
4600
|
for (let e = u; e <= d; e++) {
|
|
4527
|
-
let t = e * o, n = t + s, r =
|
|
4528
|
-
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]]));
|
|
4529
4603
|
}
|
|
4530
4604
|
return f;
|
|
4531
4605
|
}
|
|
4532
|
-
var
|
|
4606
|
+
var Gn = { transform(e, t) {
|
|
4533
4607
|
switch (e.type) {
|
|
4534
4608
|
case "rect": {
|
|
4535
4609
|
if (!e.paint.fill) return {
|
|
4536
4610
|
...e,
|
|
4537
|
-
paint:
|
|
4611
|
+
paint: Hn(e.paint)
|
|
4538
4612
|
};
|
|
4539
4613
|
let n = {
|
|
4540
4614
|
...e,
|
|
4541
4615
|
paint: {
|
|
4542
|
-
fill:
|
|
4616
|
+
fill: Y,
|
|
4543
4617
|
strokeWidth: e.paint.strokeWidth
|
|
4544
4618
|
}
|
|
4545
|
-
}, r =
|
|
4619
|
+
}, r = Wn(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
4546
4620
|
type: "polygon",
|
|
4547
4621
|
vertices: t,
|
|
4548
4622
|
layer: e.layer,
|
|
4549
4623
|
paint: {
|
|
4550
|
-
fill:
|
|
4624
|
+
fill: Nn,
|
|
4551
4625
|
alpha: .65
|
|
4552
4626
|
}
|
|
4553
4627
|
})), i = {
|
|
4554
4628
|
...e,
|
|
4555
4629
|
hit: void 0,
|
|
4556
4630
|
paint: {
|
|
4557
|
-
stroke:
|
|
4631
|
+
stroke: Y,
|
|
4558
4632
|
strokeWidth: e.paint.strokeWidth
|
|
4559
4633
|
}
|
|
4560
4634
|
};
|
|
@@ -4566,38 +4640,38 @@ var In = { transform(e, t) {
|
|
|
4566
4640
|
}
|
|
4567
4641
|
case "circle": return {
|
|
4568
4642
|
...e,
|
|
4569
|
-
paint:
|
|
4643
|
+
paint: Hn(e.paint)
|
|
4570
4644
|
};
|
|
4571
4645
|
case "polygon": return {
|
|
4572
4646
|
...e,
|
|
4573
4647
|
paint: {
|
|
4574
4648
|
...e.paint,
|
|
4575
|
-
fill: e.paint.fill ?
|
|
4576
|
-
stroke: e.paint.stroke ?
|
|
4649
|
+
fill: e.paint.fill ? Pn : e.paint.fill,
|
|
4650
|
+
stroke: e.paint.stroke ? Y : e.paint.stroke
|
|
4577
4651
|
}
|
|
4578
4652
|
};
|
|
4579
4653
|
case "line": return {
|
|
4580
4654
|
...e,
|
|
4581
4655
|
paint: e.paint.stroke ? {
|
|
4582
4656
|
...e.paint,
|
|
4583
|
-
stroke:
|
|
4657
|
+
stroke: Pn
|
|
4584
4658
|
} : e.paint
|
|
4585
4659
|
};
|
|
4586
4660
|
case "text": return {
|
|
4587
4661
|
...e,
|
|
4588
|
-
fill:
|
|
4589
|
-
stroke:
|
|
4662
|
+
fill: Pn,
|
|
4663
|
+
stroke: Y,
|
|
4590
4664
|
strokeWidth: t.roomSize * .25
|
|
4591
4665
|
};
|
|
4592
4666
|
case "image":
|
|
4593
4667
|
case "group": return e;
|
|
4594
4668
|
}
|
|
4595
|
-
} },
|
|
4596
|
-
function
|
|
4669
|
+
} }, Kn = "#c8eeff", qn = "#00c8ff", Jn = "#00ffaa", Yn = .2, Xn = 5, Zn = 190;
|
|
4670
|
+
function Qn(e, t, n) {
|
|
4597
4671
|
e /= 255, t /= 255, n /= 255;
|
|
4598
4672
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
4599
4673
|
if (r === i) return [
|
|
4600
|
-
|
|
4674
|
+
Zn,
|
|
4601
4675
|
0,
|
|
4602
4676
|
a
|
|
4603
4677
|
];
|
|
@@ -4608,54 +4682,54 @@ function Un(e, t, n) {
|
|
|
4608
4682
|
a
|
|
4609
4683
|
];
|
|
4610
4684
|
}
|
|
4611
|
-
function
|
|
4685
|
+
function $n(e, t, n, r = 1) {
|
|
4612
4686
|
e = (e % 360 + 360) % 360;
|
|
4613
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;
|
|
4614
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);
|
|
4615
4689
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
4616
4690
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
4617
4691
|
}
|
|
4618
|
-
function
|
|
4619
|
-
let t =
|
|
4620
|
-
if (!t) return
|
|
4621
|
-
let [n, r] =
|
|
4622
|
-
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);
|
|
4623
4697
|
}
|
|
4624
|
-
function
|
|
4698
|
+
function tr(e) {
|
|
4625
4699
|
return {
|
|
4626
4700
|
...e,
|
|
4627
|
-
fill: e.fill
|
|
4628
|
-
stroke: e.stroke ?
|
|
4701
|
+
fill: G(e.fill, er),
|
|
4702
|
+
stroke: e.stroke ? qn : e.stroke
|
|
4629
4703
|
};
|
|
4630
4704
|
}
|
|
4631
|
-
function
|
|
4705
|
+
function nr(e) {
|
|
4632
4706
|
return {
|
|
4633
|
-
stroke:
|
|
4634
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4635
|
-
alpha:
|
|
4707
|
+
stroke: qn,
|
|
4708
|
+
strokeWidth: (e.strokeWidth ?? 1) * Xn,
|
|
4709
|
+
alpha: Yn
|
|
4636
4710
|
};
|
|
4637
4711
|
}
|
|
4638
|
-
function
|
|
4712
|
+
function rr(e) {
|
|
4639
4713
|
return {
|
|
4640
|
-
stroke:
|
|
4641
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
4642
|
-
alpha:
|
|
4714
|
+
stroke: Jn,
|
|
4715
|
+
strokeWidth: (e.strokeWidth ?? 1) * Xn,
|
|
4716
|
+
alpha: Yn,
|
|
4643
4717
|
dash: e.dash,
|
|
4644
4718
|
dashEnabled: e.dashEnabled
|
|
4645
4719
|
};
|
|
4646
4720
|
}
|
|
4647
|
-
var
|
|
4721
|
+
var ir = { transform(e) {
|
|
4648
4722
|
switch (e.type) {
|
|
4649
4723
|
case "rect": {
|
|
4650
4724
|
let t = {
|
|
4651
4725
|
...e,
|
|
4652
|
-
paint:
|
|
4726
|
+
paint: tr(e.paint)
|
|
4653
4727
|
};
|
|
4654
4728
|
return e.paint.stroke ? [{
|
|
4655
4729
|
...e,
|
|
4656
4730
|
hit: void 0,
|
|
4657
4731
|
paint: {
|
|
4658
|
-
...
|
|
4732
|
+
...nr(e.paint),
|
|
4659
4733
|
fill: void 0
|
|
4660
4734
|
}
|
|
4661
4735
|
}, t] : t;
|
|
@@ -4663,13 +4737,13 @@ var Yn = { transform(e) {
|
|
|
4663
4737
|
case "circle": {
|
|
4664
4738
|
let t = {
|
|
4665
4739
|
...e,
|
|
4666
|
-
paint:
|
|
4740
|
+
paint: tr(e.paint)
|
|
4667
4741
|
};
|
|
4668
4742
|
return e.paint.stroke ? [{
|
|
4669
4743
|
...e,
|
|
4670
4744
|
hit: void 0,
|
|
4671
4745
|
paint: {
|
|
4672
|
-
...
|
|
4746
|
+
...nr(e.paint),
|
|
4673
4747
|
fill: void 0
|
|
4674
4748
|
}
|
|
4675
4749
|
}, t] : t;
|
|
@@ -4686,38 +4760,100 @@ var Yn = { transform(e) {
|
|
|
4686
4760
|
...e,
|
|
4687
4761
|
paint: e.paint.stroke ? {
|
|
4688
4762
|
...e.paint,
|
|
4689
|
-
stroke:
|
|
4763
|
+
stroke: Jn
|
|
4690
4764
|
} : e.paint
|
|
4691
4765
|
};
|
|
4692
4766
|
return e.paint.stroke ? [{
|
|
4693
4767
|
...e,
|
|
4694
4768
|
hit: void 0,
|
|
4695
|
-
paint:
|
|
4769
|
+
paint: rr(e.paint)
|
|
4696
4770
|
}, t] : t;
|
|
4697
4771
|
}
|
|
4698
4772
|
case "polygon": return {
|
|
4699
4773
|
...e,
|
|
4700
4774
|
paint: {
|
|
4701
4775
|
...e.paint,
|
|
4702
|
-
fill: e.paint.fill ?
|
|
4776
|
+
fill: e.paint.fill ? Jn : e.paint.fill,
|
|
4703
4777
|
stroke: void 0
|
|
4704
4778
|
}
|
|
4705
4779
|
};
|
|
4706
4780
|
case "text": return {
|
|
4707
4781
|
...e,
|
|
4708
|
-
fill:
|
|
4782
|
+
fill: Kn
|
|
4709
4783
|
};
|
|
4710
4784
|
case "image":
|
|
4711
4785
|
case "group": return e;
|
|
4712
4786
|
}
|
|
4713
|
-
} },
|
|
4714
|
-
|
|
4715
|
-
|
|
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
|
+
} };
|
|
4716
4840
|
}
|
|
4717
|
-
|
|
4718
|
-
|
|
4841
|
+
//#endregion
|
|
4842
|
+
//#region src/style/index.ts
|
|
4843
|
+
var sr = Gt, cr = rn, lr = gn;
|
|
4844
|
+
function ur(e) {
|
|
4845
|
+
return Tn(e);
|
|
4719
4846
|
}
|
|
4720
|
-
|
|
4847
|
+
function dr(e = {}) {
|
|
4848
|
+
return Mn(e);
|
|
4849
|
+
}
|
|
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 {
|
|
4721
4857
|
get settings() {
|
|
4722
4858
|
return this.state.settings;
|
|
4723
4859
|
}
|
|
@@ -4734,7 +4870,7 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4734
4870
|
return this.backend.events;
|
|
4735
4871
|
}
|
|
4736
4872
|
constructor(e, t, n, r) {
|
|
4737
|
-
this.currentStyle =
|
|
4873
|
+
this.currentStyle = U, this.state = new T(e, t ?? g()), this.backend = r ? r(this.state) : new Mt(this.state, n);
|
|
4738
4874
|
}
|
|
4739
4875
|
destroy() {
|
|
4740
4876
|
this.backend.destroy();
|
|
@@ -4788,7 +4924,7 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4788
4924
|
this.currentStyle = e, this.backend.setStyle(e);
|
|
4789
4925
|
}
|
|
4790
4926
|
clearStyle() {
|
|
4791
|
-
this.setStyle(
|
|
4927
|
+
this.setStyle(U);
|
|
4792
4928
|
}
|
|
4793
4929
|
getStyle() {
|
|
4794
4930
|
return this.currentStyle;
|
|
@@ -4806,10 +4942,10 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4806
4942
|
this.backend.removeSceneOverlay(e);
|
|
4807
4943
|
}
|
|
4808
4944
|
addLiveEffect(e, t) {
|
|
4809
|
-
this.backend instanceof
|
|
4945
|
+
this.backend instanceof Mt && this.backend.addLiveEffect(e, t);
|
|
4810
4946
|
}
|
|
4811
4947
|
removeLiveEffect(e) {
|
|
4812
|
-
this.backend instanceof
|
|
4948
|
+
this.backend instanceof Mt && this.backend.removeLiveEffect(e);
|
|
4813
4949
|
}
|
|
4814
4950
|
hitTest(e, t) {
|
|
4815
4951
|
let n = this.backend.coordinateTransform(e, t);
|
|
@@ -4890,15 +5026,15 @@ var tr = In, nr = Yn, rr = class {
|
|
|
4890
5026
|
getCullingMode() {
|
|
4891
5027
|
return this.state.settings.cullingMode;
|
|
4892
5028
|
}
|
|
4893
|
-
},
|
|
4894
|
-
function
|
|
5029
|
+
}, gr = "room";
|
|
5030
|
+
function _r(e, t) {
|
|
4895
5031
|
let n = /* @__PURE__ */ new Map();
|
|
4896
5032
|
function r(e) {
|
|
4897
5033
|
let t = n.get(e);
|
|
4898
5034
|
return t || (t = [], n.set(e, t)), t;
|
|
4899
5035
|
}
|
|
4900
5036
|
function i(e, t, n, i, o, s, c) {
|
|
4901
|
-
let l = e.layer ?? c ??
|
|
5037
|
+
let l = e.layer ?? c ?? gr;
|
|
4902
5038
|
switch (e.type) {
|
|
4903
5039
|
case "rect": {
|
|
4904
5040
|
let a = {
|
|
@@ -4907,11 +5043,11 @@ function ar(e, t) {
|
|
|
4907
5043
|
y: (n + e.y) * i + s,
|
|
4908
5044
|
w: e.width * i,
|
|
4909
5045
|
h: e.height * i,
|
|
4910
|
-
fill: e.paint.fill,
|
|
5046
|
+
fill: z(e.paint.fill, t, n, i, o, s),
|
|
4911
5047
|
stroke: e.paint.stroke,
|
|
4912
5048
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4913
5049
|
cr: (e.cornerRadius ?? 0) * i,
|
|
4914
|
-
dash:
|
|
5050
|
+
dash: yr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4915
5051
|
};
|
|
4916
5052
|
r(l).push(a);
|
|
4917
5053
|
return;
|
|
@@ -4922,19 +5058,19 @@ function ar(e, t) {
|
|
|
4922
5058
|
cx: (t + e.cx) * i + o,
|
|
4923
5059
|
cy: (n + e.cy) * i + s,
|
|
4924
5060
|
r: e.radius * i,
|
|
4925
|
-
fill: e.paint.fill,
|
|
5061
|
+
fill: z(e.paint.fill, t, n, i, o, s),
|
|
4926
5062
|
stroke: e.paint.stroke,
|
|
4927
5063
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4928
|
-
dash:
|
|
5064
|
+
dash: yr(e.paint.dash, i, e.paint.dashEnabled)
|
|
4929
5065
|
});
|
|
4930
5066
|
return;
|
|
4931
5067
|
case "line": {
|
|
4932
5068
|
let a = {
|
|
4933
5069
|
type: "line",
|
|
4934
|
-
points:
|
|
5070
|
+
points: vr(e.points, t, n, i, o, s),
|
|
4935
5071
|
stroke: e.paint.stroke,
|
|
4936
5072
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
4937
|
-
dash:
|
|
5073
|
+
dash: yr(e.paint.dash, i, e.paint.dashEnabled),
|
|
4938
5074
|
lineCap: e.lineCap,
|
|
4939
5075
|
lineJoin: e.lineJoin,
|
|
4940
5076
|
alpha: e.paint.alpha
|
|
@@ -4945,8 +5081,8 @@ function ar(e, t) {
|
|
|
4945
5081
|
case "polygon": {
|
|
4946
5082
|
let a = {
|
|
4947
5083
|
type: "polygon",
|
|
4948
|
-
vertices:
|
|
4949
|
-
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),
|
|
4950
5086
|
stroke: e.paint.stroke,
|
|
4951
5087
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
4952
5088
|
};
|
|
@@ -4954,7 +5090,7 @@ function ar(e, t) {
|
|
|
4954
5090
|
return;
|
|
4955
5091
|
}
|
|
4956
5092
|
case "text": {
|
|
4957
|
-
let a =
|
|
5093
|
+
let a = br(e.transform, t, n, i, o, s), c = {
|
|
4958
5094
|
type: "text",
|
|
4959
5095
|
x: a ? 0 : (t + e.x) * i + o,
|
|
4960
5096
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -4977,7 +5113,7 @@ function ar(e, t) {
|
|
|
4977
5113
|
return;
|
|
4978
5114
|
}
|
|
4979
5115
|
case "image": {
|
|
4980
|
-
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;
|
|
4981
5117
|
r(l).push({
|
|
4982
5118
|
type: "image",
|
|
4983
5119
|
x: c,
|
|
@@ -4997,7 +5133,7 @@ function ar(e, t) {
|
|
|
4997
5133
|
function a(e, t, n, a, o, s, c) {
|
|
4998
5134
|
let l = e.layer ?? c;
|
|
4999
5135
|
if (e.noScale) {
|
|
5000
|
-
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);
|
|
5001
5137
|
d.push({
|
|
5002
5138
|
type: "pushTransform",
|
|
5003
5139
|
matrix: [
|
|
@@ -5024,19 +5160,19 @@ function ar(e, t) {
|
|
|
5024
5160
|
});
|
|
5025
5161
|
return o;
|
|
5026
5162
|
}
|
|
5027
|
-
function
|
|
5163
|
+
function vr(e, t, n, r, i, a) {
|
|
5028
5164
|
let o = Array(e.length);
|
|
5029
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;
|
|
5030
5166
|
return o;
|
|
5031
5167
|
}
|
|
5032
|
-
function
|
|
5168
|
+
function yr(e, t, n) {
|
|
5033
5169
|
if (n === !1) return;
|
|
5034
5170
|
if (!e || e.length === 0) return e;
|
|
5035
5171
|
let r = Array(e.length);
|
|
5036
5172
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
5037
5173
|
return r;
|
|
5038
5174
|
}
|
|
5039
|
-
function
|
|
5175
|
+
function br(e, t, n, r, i, a) {
|
|
5040
5176
|
if (!e) return;
|
|
5041
5177
|
let [o, s, c, l, u, d] = e;
|
|
5042
5178
|
return [
|
|
@@ -5050,21 +5186,39 @@ function cr(e, t, n, r, i, a) {
|
|
|
5050
5186
|
}
|
|
5051
5187
|
//#endregion
|
|
5052
5188
|
//#region src/render/SvgRenderer.ts
|
|
5053
|
-
function
|
|
5189
|
+
function X(e) {
|
|
5054
5190
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5055
5191
|
}
|
|
5056
|
-
function
|
|
5057
|
-
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}"`;
|
|
5058
5194
|
}
|
|
5059
|
-
function
|
|
5195
|
+
function xr(e) {
|
|
5060
5196
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
5061
5197
|
}
|
|
5062
|
-
|
|
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) {
|
|
5063
5217
|
let t = [];
|
|
5064
|
-
for (let n of e)
|
|
5218
|
+
for (let n of e) Or(n.commands, t);
|
|
5065
5219
|
return t;
|
|
5066
5220
|
}
|
|
5067
|
-
function
|
|
5221
|
+
function Or(e, t) {
|
|
5068
5222
|
let n = [];
|
|
5069
5223
|
for (let r of e) switch (r.type) {
|
|
5070
5224
|
case "pushTransform": {
|
|
@@ -5081,66 +5235,72 @@ function fr(e, t) {
|
|
|
5081
5235
|
e && t.push(e);
|
|
5082
5236
|
break;
|
|
5083
5237
|
}
|
|
5084
|
-
default:
|
|
5085
|
-
|
|
5086
|
-
e && t.push(e);
|
|
5238
|
+
default:
|
|
5239
|
+
kr(r, t);
|
|
5087
5240
|
break;
|
|
5088
|
-
}
|
|
5089
5241
|
}
|
|
5090
5242
|
for (; n.length > 0;) t.push(n.pop());
|
|
5091
5243
|
}
|
|
5092
|
-
function
|
|
5244
|
+
function kr(e, t) {
|
|
5093
5245
|
switch (e.type) {
|
|
5094
5246
|
case "rect": {
|
|
5095
|
-
let
|
|
5096
|
-
|
|
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;
|
|
5097
5250
|
}
|
|
5098
5251
|
case "circle": {
|
|
5099
|
-
let
|
|
5100
|
-
|
|
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;
|
|
5101
5255
|
}
|
|
5102
5256
|
case "line": {
|
|
5103
|
-
let
|
|
5104
|
-
if (
|
|
5105
|
-
let
|
|
5106
|
-
for (let e = 0; e <
|
|
5107
|
-
|
|
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;
|
|
5108
5263
|
}
|
|
5109
5264
|
case "polygon": {
|
|
5110
|
-
let
|
|
5111
|
-
if (
|
|
5112
|
-
let
|
|
5113
|
-
for (let e = 0; e <
|
|
5114
|
-
|
|
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;
|
|
5115
5272
|
}
|
|
5116
5273
|
case "text": {
|
|
5117
|
-
let
|
|
5118
|
-
e.w > 0 && (e.align === "center" ? (
|
|
5119
|
-
let
|
|
5120
|
-
|
|
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;
|
|
5121
5279
|
}
|
|
5122
5280
|
case "image":
|
|
5123
5281
|
if (e.transform) {
|
|
5124
|
-
let [
|
|
5125
|
-
|
|
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;
|
|
5126
5285
|
}
|
|
5127
|
-
|
|
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;
|
|
5128
5288
|
}
|
|
5129
5289
|
}
|
|
5130
5290
|
//#endregion
|
|
5131
5291
|
//#region src/render/CanvasRenderer.ts
|
|
5132
|
-
var
|
|
5292
|
+
var Ar = (e) => {
|
|
5133
5293
|
if (typeof Image < "u") {
|
|
5134
5294
|
let t = new Image();
|
|
5135
5295
|
return t.src = e, t;
|
|
5136
5296
|
}
|
|
5137
5297
|
return null;
|
|
5138
5298
|
};
|
|
5139
|
-
function
|
|
5140
|
-
let r = n.imageFactory ??
|
|
5141
|
-
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);
|
|
5142
5302
|
}
|
|
5143
|
-
function
|
|
5303
|
+
function Mr(e, t, n) {
|
|
5144
5304
|
let r = 0;
|
|
5145
5305
|
for (let i of t) switch (i.type) {
|
|
5146
5306
|
case "pushTransform":
|
|
@@ -5154,18 +5314,18 @@ function gr(e, t, n) {
|
|
|
5154
5314
|
r > 0 && (e.restore(), r--);
|
|
5155
5315
|
break;
|
|
5156
5316
|
default:
|
|
5157
|
-
|
|
5317
|
+
Nr(e, i, n);
|
|
5158
5318
|
break;
|
|
5159
5319
|
}
|
|
5160
5320
|
for (; r > 0;) e.restore(), r--;
|
|
5161
5321
|
}
|
|
5162
|
-
function
|
|
5322
|
+
function Nr(e, t, n) {
|
|
5163
5323
|
switch (t.type) {
|
|
5164
5324
|
case "rect":
|
|
5165
|
-
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = t.fill, e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
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());
|
|
5166
5326
|
break;
|
|
5167
5327
|
case "circle":
|
|
5168
|
-
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());
|
|
5169
5329
|
break;
|
|
5170
5330
|
case "line": {
|
|
5171
5331
|
if (t.points.length < 4) break;
|
|
@@ -5179,7 +5339,7 @@ function _r(e, t, n) {
|
|
|
5179
5339
|
if (t.vertices.length < 4) break;
|
|
5180
5340
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
5181
5341
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
5182
|
-
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());
|
|
5183
5343
|
break;
|
|
5184
5344
|
case "text": {
|
|
5185
5345
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -5220,35 +5380,35 @@ function _r(e, t, n) {
|
|
|
5220
5380
|
}
|
|
5221
5381
|
//#endregion
|
|
5222
5382
|
//#region src/export/flushSceneShapes.ts
|
|
5223
|
-
function
|
|
5224
|
-
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));
|
|
5225
5385
|
for (let e of t.sceneOverlays) {
|
|
5226
5386
|
let r = e.render(t.state, t.viewportBounds);
|
|
5227
5387
|
r && n(Array.isArray(r) ? r : [r]);
|
|
5228
5388
|
}
|
|
5229
5389
|
n(e.topLabel);
|
|
5230
5390
|
}
|
|
5231
|
-
function
|
|
5391
|
+
function Fr(e, t) {
|
|
5232
5392
|
let n = e.getOverlaysForArea(t);
|
|
5233
5393
|
if (!n) return [];
|
|
5234
5394
|
let r = e.settings, i = [];
|
|
5235
5395
|
if (n.paths) for (let t of n.paths) {
|
|
5236
|
-
let n =
|
|
5237
|
-
i.push(...
|
|
5396
|
+
let n = ft(e.mapReader, r, t.locations, t.color, e.currentArea, e.currentZIndex);
|
|
5397
|
+
i.push(...ht(n));
|
|
5238
5398
|
}
|
|
5239
5399
|
if (n.highlights) for (let t of n.highlights) {
|
|
5240
5400
|
let n = e.mapReader.getRoom(t.roomId);
|
|
5241
|
-
n && i.push(
|
|
5401
|
+
n && i.push(pt(ut(n, t.color, r)));
|
|
5242
5402
|
}
|
|
5243
5403
|
if (n.position) {
|
|
5244
5404
|
let t = e.mapReader.getRoom(n.position.roomId);
|
|
5245
|
-
t && i.push(
|
|
5405
|
+
t && i.push(mt(dt(t, r)));
|
|
5246
5406
|
}
|
|
5247
5407
|
return i;
|
|
5248
5408
|
}
|
|
5249
5409
|
//#endregion
|
|
5250
5410
|
//#region src/export/sceneBounds.ts
|
|
5251
|
-
function
|
|
5411
|
+
function Ir(e, t, n = 0) {
|
|
5252
5412
|
if (!t.worldToScene) return e;
|
|
5253
5413
|
let r = [
|
|
5254
5414
|
t.worldToScene(e.x, e.y),
|
|
@@ -5266,15 +5426,15 @@ function br(e, t, n = 0) {
|
|
|
5266
5426
|
}
|
|
5267
5427
|
//#endregion
|
|
5268
5428
|
//#region src/export/SvgExporter.ts
|
|
5269
|
-
var
|
|
5429
|
+
var Lr = {
|
|
5270
5430
|
scale: 1,
|
|
5271
5431
|
offsetX: 0,
|
|
5272
5432
|
offsetY: 0
|
|
5273
5433
|
};
|
|
5274
|
-
function
|
|
5434
|
+
function Rr(e) {
|
|
5275
5435
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5276
5436
|
}
|
|
5277
|
-
var
|
|
5437
|
+
var zr = class {
|
|
5278
5438
|
constructor(e = {}) {
|
|
5279
5439
|
this.options = e;
|
|
5280
5440
|
}
|
|
@@ -5283,30 +5443,30 @@ var Cr = class {
|
|
|
5283
5443
|
if (r === void 0 || i === void 0 || !a) return;
|
|
5284
5444
|
let o = a, s = o.getPlane(i);
|
|
5285
5445
|
if (!s) return;
|
|
5286
|
-
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, {
|
|
5287
5447
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5288
5448
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5289
5449
|
}), p = {
|
|
5290
5450
|
scale: 1,
|
|
5291
5451
|
roomSize: c.roomSize
|
|
5292
|
-
}, m = (e) => t ===
|
|
5293
|
-
return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${
|
|
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, {
|
|
5294
5454
|
state: e,
|
|
5295
5455
|
viewportBounds: d,
|
|
5296
5456
|
sceneOverlays: n,
|
|
5297
5457
|
overlays: this.options.overlays
|
|
5298
5458
|
}, (e) => {
|
|
5299
|
-
e.length !== 0 && g.push(...
|
|
5459
|
+
e.length !== 0 && g.push(...Dr(_r(m(e), Lr)));
|
|
5300
5460
|
}), g.push("</svg>"), g.join("\n");
|
|
5301
5461
|
}
|
|
5302
|
-
},
|
|
5462
|
+
}, Br = class {
|
|
5303
5463
|
constructor(e = {}) {
|
|
5304
5464
|
this.options = e;
|
|
5305
5465
|
}
|
|
5306
5466
|
render({ backend: e }) {
|
|
5307
5467
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
5308
5468
|
}
|
|
5309
|
-
},
|
|
5469
|
+
}, Vr = class {
|
|
5310
5470
|
constructor(e = {}) {
|
|
5311
5471
|
this.options = e;
|
|
5312
5472
|
}
|
|
@@ -5323,14 +5483,14 @@ var Cr = class {
|
|
|
5323
5483
|
};
|
|
5324
5484
|
//#endregion
|
|
5325
5485
|
//#region src/export/canvasToBytes.ts
|
|
5326
|
-
function
|
|
5486
|
+
function Hr(e, t = "image/png", n) {
|
|
5327
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);
|
|
5328
5488
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
5329
5489
|
return s;
|
|
5330
5490
|
}
|
|
5331
5491
|
//#endregion
|
|
5332
5492
|
//#region src/export/CanvasExporter.ts
|
|
5333
|
-
var
|
|
5493
|
+
var Ur = class {
|
|
5334
5494
|
constructor(e) {
|
|
5335
5495
|
this.options = e;
|
|
5336
5496
|
}
|
|
@@ -5339,71 +5499,71 @@ var Dr = class {
|
|
|
5339
5499
|
if (i === void 0 || a === void 0 || !o) return;
|
|
5340
5500
|
let s = o, c = s.getPlane(a);
|
|
5341
5501
|
if (!c) return;
|
|
5342
|
-
let l = e.settings, { width: u, height: d } = this.options, f = this.options.padding ?? 3, p = e.computeExportBounds(s, c, this.options.roomId, f), m =
|
|
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 = {
|
|
5343
5503
|
scale: h,
|
|
5344
5504
|
offsetX: v,
|
|
5345
5505
|
offsetY: y
|
|
5346
|
-
}, x =
|
|
5506
|
+
}, x = E.forRenderCamera(u, d, h, v, y), S = {
|
|
5347
5507
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
5348
5508
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
5349
|
-
}, C =
|
|
5509
|
+
}, C = He(new Re(e.mapReader, l).buildScene(s, c, a, e.lens), x.getViewportBounds(), l, S), w = r.Util.createCanvasElement();
|
|
5350
5510
|
w.width = u, w.height = d;
|
|
5351
5511
|
let T = w.getContext("2d");
|
|
5352
5512
|
if (!T) return;
|
|
5353
5513
|
T.fillStyle = l.backgroundColor, T.fillRect(0, 0, u, d);
|
|
5354
|
-
let
|
|
5514
|
+
let ee = {
|
|
5355
5515
|
scale: h,
|
|
5356
5516
|
roomSize: l.roomSize
|
|
5357
|
-
},
|
|
5358
|
-
return
|
|
5517
|
+
}, D = (e) => t === U ? e : W(e, t, ee);
|
|
5518
|
+
return Pr(C, {
|
|
5359
5519
|
state: e,
|
|
5360
|
-
viewportBounds:
|
|
5520
|
+
viewportBounds: E.forMapBounds(p.x, p.x + p.w, p.y, p.y + p.h).getViewportBounds(),
|
|
5361
5521
|
sceneOverlays: n,
|
|
5362
5522
|
overlays: this.options.overlays
|
|
5363
5523
|
}, (e) => {
|
|
5364
|
-
e.length !== 0 &&
|
|
5524
|
+
e.length !== 0 && jr(T, _r(D(e), b));
|
|
5365
5525
|
}), w;
|
|
5366
5526
|
}
|
|
5367
|
-
},
|
|
5527
|
+
}, Wr = class {
|
|
5368
5528
|
constructor(e) {
|
|
5369
|
-
this.options = e, this.canvasExporter = new
|
|
5529
|
+
this.options = e, this.canvasExporter = new Ur(e);
|
|
5370
5530
|
}
|
|
5371
5531
|
render(e) {
|
|
5372
5532
|
let t = this.canvasExporter.render(e);
|
|
5373
|
-
if (t) return
|
|
5533
|
+
if (t) return Hr(t, this.options.mimeType, this.options.quality);
|
|
5374
5534
|
}
|
|
5375
|
-
},
|
|
5376
|
-
function
|
|
5535
|
+
}, Q, Gr, Kr = 256;
|
|
5536
|
+
function qr(e, t, n) {
|
|
5377
5537
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
5378
|
-
if (
|
|
5379
|
-
let i =
|
|
5538
|
+
if (Gr === r && Q) return Q;
|
|
5539
|
+
let i = Kr, a = i / 2, o = document.createElement("canvas");
|
|
5380
5540
|
o.width = i, o.height = i;
|
|
5381
5541
|
let s = o.getContext("2d");
|
|
5382
5542
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
5383
5543
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
5384
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";
|
|
5385
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);
|
|
5386
|
-
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i),
|
|
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;
|
|
5387
5547
|
}
|
|
5388
|
-
function
|
|
5548
|
+
function Jr(e, t, n, r) {
|
|
5389
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);
|
|
5390
5550
|
return {
|
|
5391
5551
|
cx: e,
|
|
5392
5552
|
cy: t,
|
|
5393
5553
|
displaySize: u,
|
|
5394
|
-
src:
|
|
5554
|
+
src: qr(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
5395
5555
|
};
|
|
5396
5556
|
}
|
|
5397
5557
|
//#endregion
|
|
5398
5558
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
5399
|
-
var
|
|
5559
|
+
var Yr = {
|
|
5400
5560
|
color: "#ffcc44",
|
|
5401
5561
|
radius: 12,
|
|
5402
5562
|
intensity: .7
|
|
5403
|
-
},
|
|
5563
|
+
}, Xr = class {
|
|
5404
5564
|
constructor(e) {
|
|
5405
5565
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
5406
|
-
...
|
|
5566
|
+
...Yr,
|
|
5407
5567
|
...e
|
|
5408
5568
|
};
|
|
5409
5569
|
}
|
|
@@ -5426,7 +5586,7 @@ var Pr = {
|
|
|
5426
5586
|
if (e.positionRoomId === void 0) return;
|
|
5427
5587
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
5428
5588
|
if (!n) return;
|
|
5429
|
-
let r =
|
|
5589
|
+
let r = Jr(n.x, n.y, t, this.params);
|
|
5430
5590
|
return {
|
|
5431
5591
|
type: "image",
|
|
5432
5592
|
x: r.cx - r.displaySize / 2,
|
|
@@ -5437,7 +5597,7 @@ var Pr = {
|
|
|
5437
5597
|
layer: "overlay"
|
|
5438
5598
|
};
|
|
5439
5599
|
}
|
|
5440
|
-
},
|
|
5600
|
+
}, Zr = /* @__PURE__ */ u(((e, t) => {
|
|
5441
5601
|
t.exports = class {
|
|
5442
5602
|
constructor() {
|
|
5443
5603
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -5467,14 +5627,14 @@ var Pr = {
|
|
|
5467
5627
|
return this.queue.find((t) => t.key === e);
|
|
5468
5628
|
}
|
|
5469
5629
|
};
|
|
5470
|
-
})),
|
|
5630
|
+
})), Qr = /* @__PURE__ */ u(((e, t) => {
|
|
5471
5631
|
function n(e, t) {
|
|
5472
5632
|
let r = /* @__PURE__ */ new Map();
|
|
5473
5633
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
5474
5634
|
return r;
|
|
5475
5635
|
}
|
|
5476
5636
|
t.exports = n;
|
|
5477
|
-
})),
|
|
5637
|
+
})), $r = /* @__PURE__ */ u(((e, t) => {
|
|
5478
5638
|
function n(e) {
|
|
5479
5639
|
let t = Number(e);
|
|
5480
5640
|
return !(isNaN(t) || t <= 0);
|
|
@@ -5489,7 +5649,7 @@ var Pr = {
|
|
|
5489
5649
|
}), t;
|
|
5490
5650
|
}
|
|
5491
5651
|
t.exports = r;
|
|
5492
|
-
})),
|
|
5652
|
+
})), ei = /* @__PURE__ */ u(((e, t) => {
|
|
5493
5653
|
function n(e) {
|
|
5494
5654
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
5495
5655
|
e.forEach((e, t) => {
|
|
@@ -5501,8 +5661,8 @@ var Pr = {
|
|
|
5501
5661
|
});
|
|
5502
5662
|
}
|
|
5503
5663
|
t.exports = n;
|
|
5504
|
-
})),
|
|
5505
|
-
var n =
|
|
5664
|
+
})), ti = /* @__PURE__ */ f((/* @__PURE__ */ u(((e, t) => {
|
|
5665
|
+
var n = Zr(), r = Qr(), i = $r(), a = ei();
|
|
5506
5666
|
t.exports = class {
|
|
5507
5667
|
constructor(e) {
|
|
5508
5668
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -5552,7 +5712,7 @@ var Pr = {
|
|
|
5552
5712
|
return this.path(...e);
|
|
5553
5713
|
}
|
|
5554
5714
|
};
|
|
5555
|
-
})))(), 1),
|
|
5715
|
+
})))(), 1), ni = {
|
|
5556
5716
|
1: "north",
|
|
5557
5717
|
2: "northeast",
|
|
5558
5718
|
3: "northwest",
|
|
@@ -5565,7 +5725,7 @@ var Pr = {
|
|
|
5565
5725
|
10: "down",
|
|
5566
5726
|
11: "in",
|
|
5567
5727
|
12: "out"
|
|
5568
|
-
},
|
|
5728
|
+
}, ri = {
|
|
5569
5729
|
north: "n",
|
|
5570
5730
|
northeast: "ne",
|
|
5571
5731
|
northwest: "nw",
|
|
@@ -5578,7 +5738,7 @@ var Pr = {
|
|
|
5578
5738
|
down: "down",
|
|
5579
5739
|
in: "in",
|
|
5580
5740
|
out: "out"
|
|
5581
|
-
},
|
|
5741
|
+
}, ii = class {
|
|
5582
5742
|
constructor(e) {
|
|
5583
5743
|
this.mapReader = e, this.data = this.buildGraph();
|
|
5584
5744
|
}
|
|
@@ -5604,12 +5764,12 @@ var Pr = {
|
|
|
5604
5764
|
buildGraph() {
|
|
5605
5765
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
5606
5766
|
return this.mapReader.getRooms().forEach((i) => {
|
|
5607
|
-
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 ?? []);
|
|
5608
5768
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
5609
5769
|
if (s.has(e)) return;
|
|
5610
5770
|
let c = this.mapReader.getRoom(t);
|
|
5611
5771
|
if (c) {
|
|
5612
|
-
let s =
|
|
5772
|
+
let s = ri[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
5613
5773
|
a.push({
|
|
5614
5774
|
id: t,
|
|
5615
5775
|
weight: l
|
|
@@ -5640,7 +5800,7 @@ var Pr = {
|
|
|
5640
5800
|
};
|
|
5641
5801
|
//#endregion
|
|
5642
5802
|
//#region src/PathFinder.ts
|
|
5643
|
-
function
|
|
5803
|
+
function ai(e, t) {
|
|
5644
5804
|
e.push(t);
|
|
5645
5805
|
let n = e.length - 1;
|
|
5646
5806
|
for (; n > 0;) {
|
|
@@ -5649,7 +5809,7 @@ function Wr(e, t) {
|
|
|
5649
5809
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
5650
5810
|
}
|
|
5651
5811
|
}
|
|
5652
|
-
function
|
|
5812
|
+
function oi(e) {
|
|
5653
5813
|
if (e.length === 0) return;
|
|
5654
5814
|
let t = e[0], n = e.pop();
|
|
5655
5815
|
if (e.length > 0) {
|
|
@@ -5663,16 +5823,16 @@ function Gr(e) {
|
|
|
5663
5823
|
}
|
|
5664
5824
|
return t;
|
|
5665
5825
|
}
|
|
5666
|
-
function
|
|
5826
|
+
function si(e, t, n) {
|
|
5667
5827
|
let r = [n], i = n;
|
|
5668
5828
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
5669
5829
|
return r.reverse(), r;
|
|
5670
5830
|
}
|
|
5671
|
-
function
|
|
5831
|
+
function ci(e, t, n) {
|
|
5672
5832
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
5673
5833
|
return i ? i.map((e) => Number(e)) : null;
|
|
5674
5834
|
}
|
|
5675
|
-
function
|
|
5835
|
+
function li(e, t, n, r) {
|
|
5676
5836
|
let i = r.getRoom(n);
|
|
5677
5837
|
if (!i) return null;
|
|
5678
5838
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -5681,16 +5841,16 @@ function Jr(e, t, n, r) {
|
|
|
5681
5841
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
5682
5842
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
5683
5843
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
5684
|
-
for (d.set(t, 0),
|
|
5844
|
+
for (d.set(t, 0), ai(p, {
|
|
5685
5845
|
id: t,
|
|
5686
5846
|
priority: u(t)
|
|
5687
5847
|
}); p.length > 0;) {
|
|
5688
|
-
let { id: r } =
|
|
5689
|
-
if (r === n) return
|
|
5848
|
+
let { id: r } = oi(p);
|
|
5849
|
+
if (r === n) return si(f, t, n);
|
|
5690
5850
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
5691
5851
|
if (a) for (let e of a) {
|
|
5692
5852
|
let t = i + e.weight;
|
|
5693
|
-
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, {
|
|
5694
5854
|
id: e.id,
|
|
5695
5855
|
priority: t + u(e.id)
|
|
5696
5856
|
}));
|
|
@@ -5698,9 +5858,9 @@ function Jr(e, t, n, r) {
|
|
|
5698
5858
|
}
|
|
5699
5859
|
return null;
|
|
5700
5860
|
}
|
|
5701
|
-
var
|
|
5861
|
+
var ui = class {
|
|
5702
5862
|
constructor(e, t = "dijkstra") {
|
|
5703
|
-
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());
|
|
5704
5864
|
}
|
|
5705
5865
|
get algorithm() {
|
|
5706
5866
|
return this._algorithm;
|
|
@@ -5719,23 +5879,23 @@ var Yr = class {
|
|
|
5719
5879
|
let r;
|
|
5720
5880
|
switch (this._algorithm) {
|
|
5721
5881
|
case "dijkstra":
|
|
5722
|
-
r =
|
|
5882
|
+
r = ci(this.dijkstraGraph, e, t);
|
|
5723
5883
|
break;
|
|
5724
5884
|
case "astar":
|
|
5725
|
-
r =
|
|
5885
|
+
r = li(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
5726
5886
|
break;
|
|
5727
5887
|
}
|
|
5728
5888
|
return this.cache.set(n, r), r;
|
|
5729
5889
|
}
|
|
5730
|
-
},
|
|
5890
|
+
}, $ = {
|
|
5731
5891
|
hidden: 2,
|
|
5732
5892
|
stub: 1,
|
|
5733
5893
|
full: 0
|
|
5734
5894
|
};
|
|
5735
|
-
function
|
|
5736
|
-
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;
|
|
5737
5897
|
}
|
|
5738
|
-
function
|
|
5898
|
+
function fi(e, ...t) {
|
|
5739
5899
|
let n = {}, r;
|
|
5740
5900
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
5741
5901
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -5751,7 +5911,7 @@ function Qr(e, ...t) {
|
|
|
5751
5911
|
for (let o of r) {
|
|
5752
5912
|
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : w(o, e, t, n);
|
|
5753
5913
|
if (a === void 0) a = r;
|
|
5754
|
-
else if (a =
|
|
5914
|
+
else if (a = di(a, r, i), i === "first") break;
|
|
5755
5915
|
}
|
|
5756
5916
|
return a ?? "full";
|
|
5757
5917
|
},
|
|
@@ -5764,7 +5924,7 @@ function Qr(e, ...t) {
|
|
|
5764
5924
|
}
|
|
5765
5925
|
//#endregion
|
|
5766
5926
|
//#region src/lens/ExplorationLens.ts
|
|
5767
|
-
var
|
|
5927
|
+
var pi = class {
|
|
5768
5928
|
constructor(e) {
|
|
5769
5929
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
5770
5930
|
}
|
|
@@ -5799,7 +5959,7 @@ var $r = class {
|
|
|
5799
5959
|
clear() {
|
|
5800
5960
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
5801
5961
|
}
|
|
5802
|
-
},
|
|
5962
|
+
}, mi = {
|
|
5803
5963
|
1: "north",
|
|
5804
5964
|
2: "northeast",
|
|
5805
5965
|
3: "northwest",
|
|
@@ -5813,7 +5973,7 @@ var $r = class {
|
|
|
5813
5973
|
11: "in",
|
|
5814
5974
|
12: "out"
|
|
5815
5975
|
};
|
|
5816
|
-
function
|
|
5976
|
+
function hi() {
|
|
5817
5977
|
return {
|
|
5818
5978
|
areaWidth: 150,
|
|
5819
5979
|
areaHeight: 80,
|
|
@@ -5827,9 +5987,9 @@ function ti() {
|
|
|
5827
5987
|
highlightColor: "#ff9900"
|
|
5828
5988
|
};
|
|
5829
5989
|
}
|
|
5830
|
-
var
|
|
5990
|
+
var gi = class {
|
|
5831
5991
|
constructor(e, t, n) {
|
|
5832
|
-
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ??
|
|
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({
|
|
5833
5993
|
container: e,
|
|
5834
5994
|
width: e.clientWidth,
|
|
5835
5995
|
height: e.clientHeight,
|
|
@@ -6012,14 +6172,14 @@ var ni = class {
|
|
|
6012
6172
|
toAreaId: e.fromAreaId,
|
|
6013
6173
|
fromRoomId: e.toRoomId,
|
|
6014
6174
|
toRoomId: e.fromRoomId,
|
|
6015
|
-
direction: e.direction ?
|
|
6175
|
+
direction: e.direction ? M[e.direction] : null,
|
|
6016
6176
|
fromRoomPosition: e.toRoomPosition,
|
|
6017
6177
|
toRoomPosition: e.fromRoomPosition
|
|
6018
6178
|
});
|
|
6019
6179
|
}
|
|
6020
6180
|
}
|
|
6021
6181
|
getLockedDirections(e) {
|
|
6022
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
6182
|
+
return new Set((e.exitLocks ?? []).map((e) => mi[e]).filter((e) => !!e));
|
|
6023
6183
|
}
|
|
6024
6184
|
createConnection(e, t, n) {
|
|
6025
6185
|
let r = this.toPlanarDirection(n);
|
|
@@ -6088,7 +6248,7 @@ var ni = class {
|
|
|
6088
6248
|
}[e.toLowerCase().trim()] ?? null;
|
|
6089
6249
|
}
|
|
6090
6250
|
toPlanarDirection(e) {
|
|
6091
|
-
return e &&
|
|
6251
|
+
return e && j.includes(e) ? e : null;
|
|
6092
6252
|
}
|
|
6093
6253
|
layoutAreas() {
|
|
6094
6254
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -6631,6 +6791,6 @@ var ni = class {
|
|
|
6631
6791
|
}
|
|
6632
6792
|
};
|
|
6633
6793
|
//#endregion
|
|
6634
|
-
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 };
|
|
6635
6795
|
|
|
6636
6796
|
//# sourceMappingURL=index.mjs.map
|