mudlet-map-editor 0.6.1 → 0.7.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-lib/index.js
CHANGED
|
@@ -2684,6 +2684,22 @@ function Ee(e, t, n) {
|
|
|
2684
2684
|
}
|
|
2685
2685
|
return { structural: !1 };
|
|
2686
2686
|
case "batch": {
|
|
2687
|
+
if (n?.reader && t.cmds.length > 1 && t.cmds.every((e) => e.kind === "deleteRoom")) {
|
|
2688
|
+
let r = t.cmds;
|
|
2689
|
+
for (let t of r) {
|
|
2690
|
+
e.rooms[t.id] = { ...t.room };
|
|
2691
|
+
let n = e.areas[t.areaId];
|
|
2692
|
+
n && !n.rooms.includes(t.id) && n.rooms.push(t.id);
|
|
2693
|
+
}
|
|
2694
|
+
for (let t of r) for (let n of t.neighborEdits) {
|
|
2695
|
+
let t = e.rooms[n.roomId];
|
|
2696
|
+
t && (t[n.dir] = n.was);
|
|
2697
|
+
}
|
|
2698
|
+
return n.reader.addRooms(r.map((t) => ({
|
|
2699
|
+
id: t.id,
|
|
2700
|
+
room: e.rooms[t.id]
|
|
2701
|
+
}))), { structural: !0 };
|
|
2702
|
+
}
|
|
2687
2703
|
let r = !1;
|
|
2688
2704
|
for (let i of [...t.cmds].reverse()) Ee(e, i, n).structural && (r = !0);
|
|
2689
2705
|
return { structural: r };
|
|
@@ -7844,8 +7860,266 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
|
|
|
7844
7860
|
});
|
|
7845
7861
|
}
|
|
7846
7862
|
//#endregion
|
|
7863
|
+
//#region src/components/MultiRoomPanel.tsx
|
|
7864
|
+
function fn(e) {
|
|
7865
|
+
if (e.length === 0) return { same: !1 };
|
|
7866
|
+
let t = e[0];
|
|
7867
|
+
return e.every((e) => e === t) ? {
|
|
7868
|
+
same: !0,
|
|
7869
|
+
value: t
|
|
7870
|
+
} : { same: !1 };
|
|
7871
|
+
}
|
|
7872
|
+
var pn = "system.fallback_symbol_color";
|
|
7873
|
+
function mn({ selection: e, map: t, sceneRef: n }) {
|
|
7874
|
+
let r = e.ids, a = r.map((e) => t.rooms[e]).filter((e) => e != null), o = fn(a.map((e) => e.name ?? "")), s = fn(a.map((e) => e.symbol ?? "")), c = fn(a.map((e) => e.userData?.[pn] ?? null)), l = fn(a.map((e) => e.environment)), u = fn(a.map((e) => e.isLocked ?? !1)), [p, m] = i(!1), [h, g] = i(() => o.same ? o.value : ""), [_, v] = i(!1), [y, b] = i(() => s.same ? s.value : ""), [x, S] = i(!1), [C, w] = i(() => c.same && c.value !== null ? c.value : "#ffffff"), [T, E] = i(!1), [O, k] = i(() => l.same ? l.value : -1), [A, j] = i(!1), [M, N] = i(!1), [P, F] = i(() => u.same ? u.value : !1), I = p || _ || x || T || M, L = () => {
|
|
7875
|
+
let e = [];
|
|
7876
|
+
for (let n of r) {
|
|
7877
|
+
let r = t.rooms[n];
|
|
7878
|
+
if (r) {
|
|
7879
|
+
if (p && h !== r.name && e.push({
|
|
7880
|
+
kind: "setRoomField",
|
|
7881
|
+
id: n,
|
|
7882
|
+
field: "name",
|
|
7883
|
+
from: r.name,
|
|
7884
|
+
to: h
|
|
7885
|
+
}), _ && y !== r.symbol && e.push({
|
|
7886
|
+
kind: "setRoomField",
|
|
7887
|
+
id: n,
|
|
7888
|
+
field: "symbol",
|
|
7889
|
+
from: r.symbol,
|
|
7890
|
+
to: y
|
|
7891
|
+
}), x) {
|
|
7892
|
+
let t = r.userData?.[pn] ?? null, i = C;
|
|
7893
|
+
t !== i && e.push({
|
|
7894
|
+
kind: "setUserDataEntry",
|
|
7895
|
+
roomId: n,
|
|
7896
|
+
key: pn,
|
|
7897
|
+
from: t,
|
|
7898
|
+
to: i
|
|
7899
|
+
});
|
|
7900
|
+
}
|
|
7901
|
+
T && O !== r.environment && e.push({
|
|
7902
|
+
kind: "setRoomField",
|
|
7903
|
+
id: n,
|
|
7904
|
+
field: "environment",
|
|
7905
|
+
from: r.environment,
|
|
7906
|
+
to: O
|
|
7907
|
+
}), M && P !== r.isLocked && e.push({
|
|
7908
|
+
kind: "setRoomLock",
|
|
7909
|
+
id: n,
|
|
7910
|
+
lock: P
|
|
7911
|
+
});
|
|
7912
|
+
}
|
|
7913
|
+
}
|
|
7914
|
+
e.length !== 0 && (Y({
|
|
7915
|
+
kind: "batch",
|
|
7916
|
+
cmds: e
|
|
7917
|
+
}, n.current), n.current?.refresh(), D.bumpData(), D.setState({ status: `Applied bulk edit to ${r.length} rooms` }));
|
|
7918
|
+
}, R = n.current?.reader.getColorValue(O) ?? "rgb(114,1,0)";
|
|
7919
|
+
return /* @__PURE__ */ f("div", {
|
|
7920
|
+
className: "panel-content",
|
|
7921
|
+
children: [
|
|
7922
|
+
/* @__PURE__ */ f("h3", { children: [r.length, " rooms selected"] }),
|
|
7923
|
+
/* @__PURE__ */ d("p", {
|
|
7924
|
+
className: "hint",
|
|
7925
|
+
children: "Drag to move all. Delete to remove all. Shift+click/drag to add more. Ctrl+click/drag to toggle. Ctrl+A selects all."
|
|
7926
|
+
}),
|
|
7927
|
+
/* @__PURE__ */ d("h4", { children: "Bulk Edit" }),
|
|
7928
|
+
/* @__PURE__ */ f("div", {
|
|
7929
|
+
className: "multi-room-fields",
|
|
7930
|
+
children: [
|
|
7931
|
+
/* @__PURE__ */ f("div", {
|
|
7932
|
+
className: "multi-field-row",
|
|
7933
|
+
children: [
|
|
7934
|
+
/* @__PURE__ */ d("input", {
|
|
7935
|
+
type: "checkbox",
|
|
7936
|
+
className: "multi-field-check",
|
|
7937
|
+
checked: p,
|
|
7938
|
+
onChange: (e) => m(e.target.checked),
|
|
7939
|
+
title: "Enable name override"
|
|
7940
|
+
}),
|
|
7941
|
+
/* @__PURE__ */ f("span", {
|
|
7942
|
+
className: "multi-field-label",
|
|
7943
|
+
children: ["Name", !o.same && /* @__PURE__ */ d("span", {
|
|
7944
|
+
className: "multi-field-mixed",
|
|
7945
|
+
title: "Rooms have different values",
|
|
7946
|
+
children: "~"
|
|
7947
|
+
})]
|
|
7948
|
+
}),
|
|
7949
|
+
/* @__PURE__ */ d("input", {
|
|
7950
|
+
className: "multi-field-input",
|
|
7951
|
+
disabled: !p,
|
|
7952
|
+
value: h,
|
|
7953
|
+
onChange: (e) => g(e.target.value),
|
|
7954
|
+
placeholder: o.same ? "" : "mixed"
|
|
7955
|
+
})
|
|
7956
|
+
]
|
|
7957
|
+
}),
|
|
7958
|
+
/* @__PURE__ */ f("div", {
|
|
7959
|
+
className: "multi-field-row",
|
|
7960
|
+
children: [
|
|
7961
|
+
/* @__PURE__ */ d("input", {
|
|
7962
|
+
type: "checkbox",
|
|
7963
|
+
className: "multi-field-check",
|
|
7964
|
+
checked: _,
|
|
7965
|
+
onChange: (e) => v(e.target.checked),
|
|
7966
|
+
title: "Enable symbol override"
|
|
7967
|
+
}),
|
|
7968
|
+
/* @__PURE__ */ f("span", {
|
|
7969
|
+
className: "multi-field-label",
|
|
7970
|
+
children: ["Symbol", !s.same && /* @__PURE__ */ d("span", {
|
|
7971
|
+
className: "multi-field-mixed",
|
|
7972
|
+
title: "Rooms have different values",
|
|
7973
|
+
children: "~"
|
|
7974
|
+
})]
|
|
7975
|
+
}),
|
|
7976
|
+
/* @__PURE__ */ d("input", {
|
|
7977
|
+
className: "multi-field-input multi-field-symbol",
|
|
7978
|
+
disabled: !_,
|
|
7979
|
+
value: y,
|
|
7980
|
+
maxLength: 4,
|
|
7981
|
+
onChange: (e) => b(e.target.value),
|
|
7982
|
+
placeholder: s.same ? "" : "mixed"
|
|
7983
|
+
})
|
|
7984
|
+
]
|
|
7985
|
+
}),
|
|
7986
|
+
/* @__PURE__ */ f("div", {
|
|
7987
|
+
className: "multi-field-row",
|
|
7988
|
+
children: [
|
|
7989
|
+
/* @__PURE__ */ d("input", {
|
|
7990
|
+
type: "checkbox",
|
|
7991
|
+
className: "multi-field-check",
|
|
7992
|
+
checked: x,
|
|
7993
|
+
onChange: (e) => S(e.target.checked),
|
|
7994
|
+
title: "Enable symbol color override"
|
|
7995
|
+
}),
|
|
7996
|
+
/* @__PURE__ */ f("span", {
|
|
7997
|
+
className: "multi-field-label",
|
|
7998
|
+
children: ["Symbol color", !c.same && /* @__PURE__ */ d("span", {
|
|
7999
|
+
className: "multi-field-mixed",
|
|
8000
|
+
title: "Rooms have different values",
|
|
8001
|
+
children: "~"
|
|
8002
|
+
})]
|
|
8003
|
+
}),
|
|
8004
|
+
/* @__PURE__ */ d("input", {
|
|
8005
|
+
type: "color",
|
|
8006
|
+
className: "symbol-color-input",
|
|
8007
|
+
disabled: !x || C === null,
|
|
8008
|
+
value: C ?? "#ffffff",
|
|
8009
|
+
onChange: (e) => w(e.target.value)
|
|
8010
|
+
}),
|
|
8011
|
+
/* @__PURE__ */ d("button", {
|
|
8012
|
+
type: "button",
|
|
8013
|
+
className: "symbol-color-clear",
|
|
8014
|
+
disabled: !x,
|
|
8015
|
+
title: C === null ? "Restore: set a color instead of clearing" : "Clear: remove symbol color from all rooms",
|
|
8016
|
+
onClick: () => w((e) => e === null ? "#ffffff" : null),
|
|
8017
|
+
children: C === null ? "+" : "×"
|
|
8018
|
+
})
|
|
8019
|
+
]
|
|
8020
|
+
}),
|
|
8021
|
+
/* @__PURE__ */ f("div", {
|
|
8022
|
+
className: "multi-field-row",
|
|
8023
|
+
children: [
|
|
8024
|
+
/* @__PURE__ */ d("input", {
|
|
8025
|
+
type: "checkbox",
|
|
8026
|
+
className: "multi-field-check",
|
|
8027
|
+
checked: T,
|
|
8028
|
+
onChange: (e) => E(e.target.checked),
|
|
8029
|
+
title: "Enable environment override"
|
|
8030
|
+
}),
|
|
8031
|
+
/* @__PURE__ */ f("span", {
|
|
8032
|
+
className: "multi-field-label",
|
|
8033
|
+
children: ["Env", !l.same && /* @__PURE__ */ d("span", {
|
|
8034
|
+
className: "multi-field-mixed",
|
|
8035
|
+
title: "Rooms have different values",
|
|
8036
|
+
children: "~"
|
|
8037
|
+
})]
|
|
8038
|
+
}),
|
|
8039
|
+
/* @__PURE__ */ f("div", {
|
|
8040
|
+
className: "env-field-row",
|
|
8041
|
+
style: { position: "relative" },
|
|
8042
|
+
children: [
|
|
8043
|
+
/* @__PURE__ */ d("button", {
|
|
8044
|
+
type: "button",
|
|
8045
|
+
className: "env-pick-btn",
|
|
8046
|
+
style: { background: T ? R : "rgba(80,80,90,0.5)" },
|
|
8047
|
+
disabled: !T,
|
|
8048
|
+
onClick: () => j((e) => !e),
|
|
8049
|
+
title: T ? `Env ${O} — click to change` : "Enable to set"
|
|
8050
|
+
}),
|
|
8051
|
+
/* @__PURE__ */ f("span", {
|
|
8052
|
+
className: "env-id-label",
|
|
8053
|
+
children: ["#", O]
|
|
8054
|
+
}),
|
|
8055
|
+
A && T && /* @__PURE__ */ d(Qt, {
|
|
8056
|
+
map: t,
|
|
8057
|
+
sceneRef: n,
|
|
8058
|
+
currentEnvId: O,
|
|
8059
|
+
onSelect: (e) => k(e),
|
|
8060
|
+
onClose: () => j(!1)
|
|
8061
|
+
})
|
|
8062
|
+
]
|
|
8063
|
+
})
|
|
8064
|
+
]
|
|
8065
|
+
}),
|
|
8066
|
+
/* @__PURE__ */ f("div", {
|
|
8067
|
+
className: "multi-field-row",
|
|
8068
|
+
children: [
|
|
8069
|
+
/* @__PURE__ */ d("input", {
|
|
8070
|
+
type: "checkbox",
|
|
8071
|
+
className: "multi-field-check",
|
|
8072
|
+
checked: M,
|
|
8073
|
+
onChange: (e) => N(e.target.checked),
|
|
8074
|
+
title: "Enable lock override"
|
|
8075
|
+
}),
|
|
8076
|
+
/* @__PURE__ */ f("span", {
|
|
8077
|
+
className: "multi-field-label",
|
|
8078
|
+
children: ["Lock", !u.same && /* @__PURE__ */ d("span", {
|
|
8079
|
+
className: "multi-field-mixed",
|
|
8080
|
+
title: "Rooms have different values",
|
|
8081
|
+
children: "~"
|
|
8082
|
+
})]
|
|
8083
|
+
}),
|
|
8084
|
+
/* @__PURE__ */ d("button", {
|
|
8085
|
+
type: "button",
|
|
8086
|
+
className: `multi-lock-btn${P ? " lock-active" : ""}`,
|
|
8087
|
+
disabled: !M,
|
|
8088
|
+
title: P ? "Locked — click to set unlocked" : "Unlocked — click to set locked",
|
|
8089
|
+
onClick: () => F((e) => !e),
|
|
8090
|
+
children: /* @__PURE__ */ d(en, { locked: P })
|
|
8091
|
+
})
|
|
8092
|
+
]
|
|
8093
|
+
})
|
|
8094
|
+
]
|
|
8095
|
+
}),
|
|
8096
|
+
/* @__PURE__ */ f("div", {
|
|
8097
|
+
className: "multi-room-actions",
|
|
8098
|
+
children: [/* @__PURE__ */ f("button", {
|
|
8099
|
+
type: "button",
|
|
8100
|
+
className: "multi-room-apply-btn",
|
|
8101
|
+
disabled: !I,
|
|
8102
|
+
onClick: L,
|
|
8103
|
+
children: [
|
|
8104
|
+
"Apply to ",
|
|
8105
|
+
r.length,
|
|
8106
|
+
" rooms"
|
|
8107
|
+
]
|
|
8108
|
+
}), I && /* @__PURE__ */ f("p", {
|
|
8109
|
+
className: "multi-room-warning",
|
|
8110
|
+
children: [
|
|
8111
|
+
"This will overwrite the checked properties on all ",
|
|
8112
|
+
r.length,
|
|
8113
|
+
" selected rooms."
|
|
8114
|
+
]
|
|
8115
|
+
})]
|
|
8116
|
+
})
|
|
8117
|
+
]
|
|
8118
|
+
});
|
|
8119
|
+
}
|
|
8120
|
+
//#endregion
|
|
7847
8121
|
//#region src/components/SidePanel.tsx
|
|
7848
|
-
var
|
|
8122
|
+
var hn = [
|
|
7849
8123
|
{
|
|
7850
8124
|
id: "selection",
|
|
7851
8125
|
label: "Sel"
|
|
@@ -7867,7 +8141,7 @@ var fn = [
|
|
|
7867
8141
|
label: "Map"
|
|
7868
8142
|
}
|
|
7869
8143
|
];
|
|
7870
|
-
function
|
|
8144
|
+
function gn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
7871
8145
|
let r = O((e) => e.selection), i = O((e) => e.map), a = O((e) => e.activeTool), o = O((e) => e.pending), s = O((e) => e.sidebarTab), c = O((e) => e.panelCollapsed), l = O((e) => e.undo.length);
|
|
7872
8146
|
O((e) => e.dataVersion);
|
|
7873
8147
|
let u = i ? Object.keys(i.mCustomEnvColors).length : 0, p = i ? Object.keys(i.areaNames).length : 0;
|
|
@@ -7885,7 +8159,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
|
7885
8159
|
children: "◀"
|
|
7886
8160
|
}), /* @__PURE__ */ d("div", {
|
|
7887
8161
|
className: "side-panel-tabs side-panel-tabs--vert",
|
|
7888
|
-
children: [...
|
|
8162
|
+
children: [...hn, ...t].map((e) => /* @__PURE__ */ d("button", {
|
|
7889
8163
|
type: "button",
|
|
7890
8164
|
className: `side-panel-tab${s === e.id ? " active" : ""}`,
|
|
7891
8165
|
onClick: () => D.setState({
|
|
@@ -8006,14 +8280,12 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
|
8006
8280
|
})
|
|
8007
8281
|
})]
|
|
8008
8282
|
});
|
|
8009
|
-
if (r?.kind === "room" && r.ids.length > 1) return /* @__PURE__ */ f("div", {
|
|
8283
|
+
if (r?.kind === "room" && r.ids.length > 1 && i) return /* @__PURE__ */ f("div", {
|
|
8010
8284
|
className: "side-panel",
|
|
8011
|
-
children: [m, /* @__PURE__ */
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
children: "Drag to move all. Delete to remove all. Shift+click/drag to add more. Ctrl+click/drag to toggle. Ctrl+A selects all."
|
|
8016
|
-
})]
|
|
8285
|
+
children: [m, /* @__PURE__ */ d(mn, {
|
|
8286
|
+
selection: r,
|
|
8287
|
+
map: i,
|
|
8288
|
+
sceneRef: e
|
|
8017
8289
|
})]
|
|
8018
8290
|
});
|
|
8019
8291
|
let g = r?.kind === "room" && i ? i.rooms[r.ids[0]] : null;
|
|
@@ -8043,7 +8315,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
|
8043
8315
|
}
|
|
8044
8316
|
//#endregion
|
|
8045
8317
|
//#region src/components/ContextMenu.tsx
|
|
8046
|
-
function
|
|
8318
|
+
function _n({ sceneRef: e }) {
|
|
8047
8319
|
let n = O((e) => e.contextMenu), a = r(null), [o, s] = i(null), [c, l] = i(null);
|
|
8048
8320
|
if (t(() => {
|
|
8049
8321
|
if (!n) {
|
|
@@ -8560,46 +8832,46 @@ function mn({ sceneRef: e }) {
|
|
|
8560
8832
|
}
|
|
8561
8833
|
//#endregion
|
|
8562
8834
|
//#region src/editor/session.ts
|
|
8563
|
-
var
|
|
8564
|
-
function
|
|
8835
|
+
var vn = "mudlet-map-editor", yn = "sessions", bn = 2;
|
|
8836
|
+
function xn() {
|
|
8565
8837
|
return new Promise((e, t) => {
|
|
8566
|
-
let n = indexedDB.open(
|
|
8838
|
+
let n = indexedDB.open(vn, bn);
|
|
8567
8839
|
n.onupgradeneeded = (e) => {
|
|
8568
8840
|
let t = n.result;
|
|
8569
|
-
e.oldVersion < 2 && t.objectStoreNames.contains(
|
|
8841
|
+
e.oldVersion < 2 && t.objectStoreNames.contains(yn) && t.deleteObjectStore(yn), t.createObjectStore(yn, { keyPath: "id" });
|
|
8570
8842
|
}, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
|
|
8571
8843
|
});
|
|
8572
8844
|
}
|
|
8573
|
-
function
|
|
8845
|
+
function Sn(e) {
|
|
8574
8846
|
let t = {};
|
|
8575
8847
|
for (let n of Object.values(e.labels)) for (let e of n) e.imageSrc && (t[String(e.id)] = e.imageSrc);
|
|
8576
8848
|
return t;
|
|
8577
8849
|
}
|
|
8578
|
-
async function
|
|
8850
|
+
async function Cn(e, t, n, r, i, a) {
|
|
8579
8851
|
let o = H(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
|
|
8580
8852
|
id: c,
|
|
8581
8853
|
fileName: e,
|
|
8582
8854
|
mapBytes: s,
|
|
8583
|
-
imageSrcs:
|
|
8855
|
+
imageSrcs: Sn(t),
|
|
8584
8856
|
undoStack: n,
|
|
8585
8857
|
currentAreaId: r,
|
|
8586
8858
|
currentZ: i,
|
|
8587
8859
|
savedAt: Date.now(),
|
|
8588
8860
|
roomCount: Object.keys(t.rooms).length
|
|
8589
|
-
}, u = await
|
|
8861
|
+
}, u = await xn();
|
|
8590
8862
|
return new Promise((e, t) => {
|
|
8591
|
-
let n = u.transaction(
|
|
8592
|
-
n.objectStore(
|
|
8863
|
+
let n = u.transaction(yn, "readwrite");
|
|
8864
|
+
n.objectStore(yn).put(l), n.oncomplete = () => {
|
|
8593
8865
|
u.close(), e(c);
|
|
8594
8866
|
}, n.onerror = () => {
|
|
8595
8867
|
u.close(), t(n.error);
|
|
8596
8868
|
};
|
|
8597
8869
|
});
|
|
8598
8870
|
}
|
|
8599
|
-
async function
|
|
8600
|
-
let e = await
|
|
8871
|
+
async function wn() {
|
|
8872
|
+
let e = await xn();
|
|
8601
8873
|
return new Promise((t, n) => {
|
|
8602
|
-
let r = e.transaction(
|
|
8874
|
+
let r = e.transaction(yn, "readonly").objectStore(yn).getAll();
|
|
8603
8875
|
r.onsuccess = () => {
|
|
8604
8876
|
e.close(), t(r.result.sort((e, t) => t.savedAt - e.savedAt));
|
|
8605
8877
|
}, r.onerror = () => {
|
|
@@ -8607,29 +8879,29 @@ async function xn() {
|
|
|
8607
8879
|
};
|
|
8608
8880
|
});
|
|
8609
8881
|
}
|
|
8610
|
-
async function
|
|
8611
|
-
let e = await
|
|
8882
|
+
async function Tn() {
|
|
8883
|
+
let e = await xn();
|
|
8612
8884
|
return new Promise((t, n) => {
|
|
8613
|
-
let r = e.transaction(
|
|
8614
|
-
r.objectStore(
|
|
8885
|
+
let r = e.transaction(yn, "readwrite");
|
|
8886
|
+
r.objectStore(yn).clear(), r.oncomplete = () => {
|
|
8615
8887
|
e.close(), t();
|
|
8616
8888
|
}, r.onerror = () => {
|
|
8617
8889
|
e.close(), n(r.error);
|
|
8618
8890
|
};
|
|
8619
8891
|
});
|
|
8620
8892
|
}
|
|
8621
|
-
async function
|
|
8622
|
-
let t = await
|
|
8893
|
+
async function En(e) {
|
|
8894
|
+
let t = await xn();
|
|
8623
8895
|
return new Promise((n, r) => {
|
|
8624
|
-
let i = t.transaction(
|
|
8625
|
-
i.objectStore(
|
|
8896
|
+
let i = t.transaction(yn, "readwrite");
|
|
8897
|
+
i.objectStore(yn).delete(e), i.oncomplete = () => {
|
|
8626
8898
|
t.close(), n();
|
|
8627
8899
|
}, i.onerror = () => {
|
|
8628
8900
|
t.close(), r(i.error);
|
|
8629
8901
|
};
|
|
8630
8902
|
});
|
|
8631
8903
|
}
|
|
8632
|
-
function
|
|
8904
|
+
function Dn(e) {
|
|
8633
8905
|
let t = ie(e.mapBytes);
|
|
8634
8906
|
if (Object.keys(e.imageSrcs).length > 0) for (let n of Object.values(t.labels)) for (let t of n) {
|
|
8635
8907
|
let n = e.imageSrcs[String(t.id)];
|
|
@@ -8639,10 +8911,10 @@ function wn(e) {
|
|
|
8639
8911
|
}
|
|
8640
8912
|
//#endregion
|
|
8641
8913
|
//#region src/components/SessionsPanel.tsx
|
|
8642
|
-
var
|
|
8643
|
-
function
|
|
8914
|
+
var On = "mudlet-session-autodelete";
|
|
8915
|
+
function kn() {
|
|
8644
8916
|
try {
|
|
8645
|
-
let e = localStorage.getItem(
|
|
8917
|
+
let e = localStorage.getItem(On);
|
|
8646
8918
|
if (e) return JSON.parse(e);
|
|
8647
8919
|
} catch {}
|
|
8648
8920
|
return {
|
|
@@ -8650,24 +8922,24 @@ function En() {
|
|
|
8650
8922
|
days: 30
|
|
8651
8923
|
};
|
|
8652
8924
|
}
|
|
8653
|
-
function
|
|
8654
|
-
localStorage.setItem(
|
|
8925
|
+
function An(e) {
|
|
8926
|
+
localStorage.setItem(On, JSON.stringify(e));
|
|
8655
8927
|
}
|
|
8656
|
-
function
|
|
8928
|
+
function jn(e, t) {
|
|
8657
8929
|
let n = Date.now() - t * 24 * 60 * 60 * 1e3, r = [];
|
|
8658
|
-
for (let t of e) t.savedAt < n ?
|
|
8930
|
+
for (let t of e) t.savedAt < n ? En(t.id).catch(console.error) : r.push(t);
|
|
8659
8931
|
return r;
|
|
8660
8932
|
}
|
|
8661
|
-
function
|
|
8662
|
-
let [e, n] = i([]), [r, a] = i(!1), [o, s] = i(
|
|
8933
|
+
function Mn() {
|
|
8934
|
+
let [e, n] = i([]), [r, a] = i(!1), [o, s] = i(kn);
|
|
8663
8935
|
t(() => {
|
|
8664
|
-
let e =
|
|
8665
|
-
|
|
8666
|
-
n(e.enabled ?
|
|
8936
|
+
let e = kn();
|
|
8937
|
+
wn().then((t) => {
|
|
8938
|
+
n(e.enabled ? jn(t, e.days) : t), a(!0);
|
|
8667
8939
|
}).catch(() => a(!0));
|
|
8668
8940
|
}, []);
|
|
8669
8941
|
let c = (e) => {
|
|
8670
|
-
let t =
|
|
8942
|
+
let t = Dn(e);
|
|
8671
8943
|
D.setState({
|
|
8672
8944
|
map: t,
|
|
8673
8945
|
loaded: { fileName: e.fileName },
|
|
@@ -8683,21 +8955,21 @@ function kn() {
|
|
|
8683
8955
|
sessionId: e.id
|
|
8684
8956
|
}), D.bumpStructure();
|
|
8685
8957
|
}, l = (e) => {
|
|
8686
|
-
|
|
8958
|
+
En(e.id).catch(console.error), n((t) => t.filter((t) => t.id !== e.id));
|
|
8687
8959
|
}, u = () => {
|
|
8688
|
-
|
|
8960
|
+
Tn().catch(console.error), n([]);
|
|
8689
8961
|
}, p = (e) => {
|
|
8690
8962
|
let t = {
|
|
8691
8963
|
...o,
|
|
8692
8964
|
enabled: e
|
|
8693
8965
|
};
|
|
8694
|
-
s(t),
|
|
8966
|
+
s(t), An(t), e && n((e) => jn(e, t.days));
|
|
8695
8967
|
}, m = (e) => {
|
|
8696
8968
|
let t = {
|
|
8697
8969
|
...o,
|
|
8698
8970
|
days: e
|
|
8699
8971
|
};
|
|
8700
|
-
s(t),
|
|
8972
|
+
s(t), An(t), t.enabled && n((t) => jn(t, e));
|
|
8701
8973
|
};
|
|
8702
8974
|
return r ? e.length === 0 ? /* @__PURE__ */ f("div", {
|
|
8703
8975
|
className: "empty-state",
|
|
@@ -8794,7 +9066,7 @@ function kn() {
|
|
|
8794
9066
|
}
|
|
8795
9067
|
//#endregion
|
|
8796
9068
|
//#region src/components/SwatchPalette.tsx
|
|
8797
|
-
function
|
|
9069
|
+
function Nn({ sceneRef: e }) {
|
|
8798
9070
|
let n = O((e) => e.swatchSets), a = O((e) => e.pluginSwatchSets), o = O((e) => e.activeSwatchSetId), s = O((e) => e.activeSwatchId), c = O((e) => e.map), l = O((e) => e.pending?.kind === "pickSwatch"), [p, m] = i({
|
|
8799
9071
|
x: 12,
|
|
8800
9072
|
y: 120
|
|
@@ -9134,10 +9406,10 @@ function An({ sceneRef: e }) {
|
|
|
9134
9406
|
}
|
|
9135
9407
|
//#endregion
|
|
9136
9408
|
//#region src/components/SearchPanel.tsx
|
|
9137
|
-
function
|
|
9409
|
+
function Pn(e, t = 40) {
|
|
9138
9410
|
return e.length > t ? e.slice(0, t) + "…" : e;
|
|
9139
9411
|
}
|
|
9140
|
-
function
|
|
9412
|
+
function Fn({ onClose: e }) {
|
|
9141
9413
|
let a = O((e) => e.map), [o, s] = i(""), [c, l] = i("rooms"), [p, m] = i(0), h = r(null), g = r(null);
|
|
9142
9414
|
t(() => {
|
|
9143
9415
|
h.current?.focus();
|
|
@@ -9154,7 +9426,7 @@ function Mn({ onClose: e }) {
|
|
|
9154
9426
|
else if (n.includes(e)) o = "id";
|
|
9155
9427
|
else if (r.userData) {
|
|
9156
9428
|
for (let [t, n] of Object.entries(r.userData)) if (t.toLowerCase().includes(e) || String(n).toLowerCase().includes(e)) {
|
|
9157
|
-
o = `${t}: ${
|
|
9429
|
+
o = `${t}: ${Pn(String(n))}`;
|
|
9158
9430
|
break;
|
|
9159
9431
|
}
|
|
9160
9432
|
}
|
|
@@ -9376,7 +9648,7 @@ function Mn({ onClose: e }) {
|
|
|
9376
9648
|
}
|
|
9377
9649
|
//#endregion
|
|
9378
9650
|
//#region src/components/SpreadShrinkPopup.tsx
|
|
9379
|
-
function
|
|
9651
|
+
function In({ sceneRef: e }) {
|
|
9380
9652
|
let n = O((e) => e.spreadShrink), i = O((e) => e.selection), a = r(null);
|
|
9381
9653
|
if (t(() => {
|
|
9382
9654
|
if (!n) return;
|
|
@@ -9534,14 +9806,14 @@ function Nn({ sceneRef: e }) {
|
|
|
9534
9806
|
}
|
|
9535
9807
|
//#endregion
|
|
9536
9808
|
//#region src/editor/reader/EditorMapReader.ts
|
|
9537
|
-
var
|
|
9809
|
+
var Ln = {
|
|
9538
9810
|
1: "solid line",
|
|
9539
9811
|
2: "dash line",
|
|
9540
9812
|
3: "dot line",
|
|
9541
9813
|
4: "dash dot line",
|
|
9542
9814
|
5: "dash dot dot line"
|
|
9543
9815
|
};
|
|
9544
|
-
function
|
|
9816
|
+
function Rn(e, t) {
|
|
9545
9817
|
let n = {
|
|
9546
9818
|
id: e,
|
|
9547
9819
|
__raw: t
|
|
@@ -9630,7 +9902,7 @@ function Fn(e, t) {
|
|
|
9630
9902
|
g: 255,
|
|
9631
9903
|
b: 255
|
|
9632
9904
|
},
|
|
9633
|
-
style:
|
|
9905
|
+
style: Ln[t.customLinesStyle?.[r]] ?? "solid line",
|
|
9634
9906
|
arrow: t.customLinesArrow?.[r] ?? !1
|
|
9635
9907
|
}
|
|
9636
9908
|
};
|
|
@@ -9641,7 +9913,7 @@ function Fn(e, t) {
|
|
|
9641
9913
|
configurable: !0
|
|
9642
9914
|
}), n;
|
|
9643
9915
|
}
|
|
9644
|
-
function
|
|
9916
|
+
function zn(e) {
|
|
9645
9917
|
let t = {
|
|
9646
9918
|
north: "south",
|
|
9647
9919
|
south: "north",
|
|
@@ -9707,7 +9979,7 @@ function In(e) {
|
|
|
9707
9979
|
}
|
|
9708
9980
|
return r;
|
|
9709
9981
|
}
|
|
9710
|
-
function
|
|
9982
|
+
function Bn(e) {
|
|
9711
9983
|
if (!e || e.length === 0) return "";
|
|
9712
9984
|
if (typeof e == "string") return e.includes(",") ? e.split(",")[1] : e;
|
|
9713
9985
|
try {
|
|
@@ -9716,10 +9988,10 @@ function Ln(e) {
|
|
|
9716
9988
|
return "";
|
|
9717
9989
|
}
|
|
9718
9990
|
}
|
|
9719
|
-
function
|
|
9720
|
-
e.pixMapBase64 === void 0 && (e.pixMapBase64 =
|
|
9991
|
+
function Vn(e) {
|
|
9992
|
+
e.pixMapBase64 === void 0 && (e.pixMapBase64 = Bn(e.pixMap));
|
|
9721
9993
|
}
|
|
9722
|
-
function
|
|
9994
|
+
function Hn(e, t) {
|
|
9723
9995
|
let n = e.id;
|
|
9724
9996
|
if (!e.font) {
|
|
9725
9997
|
let r = t[`system.labelFont_${n}`];
|
|
@@ -9749,7 +10021,7 @@ function zn(e, t) {
|
|
|
9749
10021
|
});
|
|
9750
10022
|
}
|
|
9751
10023
|
}
|
|
9752
|
-
function
|
|
10024
|
+
function Un(e, t) {
|
|
9753
10025
|
let n = e.id, r = e.font;
|
|
9754
10026
|
if (r?.family) {
|
|
9755
10027
|
let e = r.bold ? 75 : 50;
|
|
@@ -9760,7 +10032,7 @@ function Bn(e, t) {
|
|
|
9760
10032
|
t[`system.labelOutlineColor_${n}`] = `${r}|${i}|${a}|${o}`;
|
|
9761
10033
|
} else t[`system.labelOutlineColor_${n}`] = "0|0|0|0";
|
|
9762
10034
|
}
|
|
9763
|
-
function
|
|
10035
|
+
function Wn(e) {
|
|
9764
10036
|
return {
|
|
9765
10037
|
id: e.id,
|
|
9766
10038
|
pos: [...e.pos],
|
|
@@ -9776,7 +10048,7 @@ function Vn(e) {
|
|
|
9776
10048
|
imageSrc: e.imageSrc
|
|
9777
10049
|
};
|
|
9778
10050
|
}
|
|
9779
|
-
var
|
|
10051
|
+
var Gn = class {
|
|
9780
10052
|
constructor(e, t) {
|
|
9781
10053
|
this.rooms = e, this.labels = t;
|
|
9782
10054
|
}
|
|
@@ -9806,7 +10078,7 @@ var Hn = class {
|
|
|
9806
10078
|
setLabels(e) {
|
|
9807
10079
|
this.labels = e;
|
|
9808
10080
|
}
|
|
9809
|
-
},
|
|
10081
|
+
}, Kn = class {
|
|
9810
10082
|
planes = {};
|
|
9811
10083
|
exits = /* @__PURE__ */ new Map();
|
|
9812
10084
|
version = 0;
|
|
@@ -9862,6 +10134,9 @@ var Hn = class {
|
|
|
9862
10134
|
addRoomLive(e) {
|
|
9863
10135
|
this.rooms.push(e), this.rebuildPlanes(), this.rebuildExits(), this.markDirty();
|
|
9864
10136
|
}
|
|
10137
|
+
addRoomsLive(e) {
|
|
10138
|
+
this.rooms.push(...e), this.rebuildPlanes(), this.rebuildExits(), this.markDirty();
|
|
10139
|
+
}
|
|
9865
10140
|
removeRoomById(e) {
|
|
9866
10141
|
this.rooms = this.rooms.filter((t) => t.id !== e), this.rebuildPlanes(), this.rebuildExits(), this.markDirty();
|
|
9867
10142
|
}
|
|
@@ -9874,19 +10149,19 @@ var Hn = class {
|
|
|
9874
10149
|
let t = {};
|
|
9875
10150
|
for (let [n, r] of Object.entries(e)) {
|
|
9876
10151
|
let e = Number(n);
|
|
9877
|
-
t[e] = new
|
|
10152
|
+
t[e] = new Gn(r, this.labels.filter((t) => t.Z === e));
|
|
9878
10153
|
}
|
|
9879
10154
|
this.planes = t;
|
|
9880
10155
|
}
|
|
9881
10156
|
rebuildExits() {
|
|
9882
|
-
this.exits =
|
|
10157
|
+
this.exits = zn(this.rooms);
|
|
9883
10158
|
}
|
|
9884
10159
|
};
|
|
9885
|
-
function
|
|
10160
|
+
function qn(e) {
|
|
9886
10161
|
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
|
|
9887
10162
|
return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
|
|
9888
10163
|
}
|
|
9889
|
-
var
|
|
10164
|
+
var Jn = {
|
|
9890
10165
|
rgb: [
|
|
9891
10166
|
114,
|
|
9892
10167
|
1,
|
|
@@ -9899,7 +10174,7 @@ var Gn = {
|
|
|
9899
10174
|
225
|
|
9900
10175
|
],
|
|
9901
10176
|
symbolColorValue: "rgb(225,225,225)"
|
|
9902
|
-
},
|
|
10177
|
+
}, Yn = class {
|
|
9903
10178
|
rooms = {};
|
|
9904
10179
|
areas = {};
|
|
9905
10180
|
colors = {};
|
|
@@ -9909,7 +10184,7 @@ var Gn = {
|
|
|
9909
10184
|
for (let e of t) this.colors[e.envId] = {
|
|
9910
10185
|
rgb: e.colors,
|
|
9911
10186
|
rgbValue: `rgb(${e.colors.join(",")})`,
|
|
9912
|
-
symbolColor:
|
|
10187
|
+
symbolColor: qn(e.colors) > .41 ? [
|
|
9913
10188
|
25,
|
|
9914
10189
|
25,
|
|
9915
10190
|
25
|
|
@@ -9918,19 +10193,19 @@ var Gn = {
|
|
|
9918
10193
|
255,
|
|
9919
10194
|
255
|
|
9920
10195
|
],
|
|
9921
|
-
symbolColorValue:
|
|
10196
|
+
symbolColorValue: qn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
|
|
9922
10197
|
};
|
|
9923
10198
|
for (let [t, n] of Object.entries(e.areas)) {
|
|
9924
10199
|
let r = Number(t), i = [];
|
|
9925
10200
|
for (let t of n.rooms) {
|
|
9926
10201
|
let n = e.rooms[t];
|
|
9927
10202
|
if (!n) continue;
|
|
9928
|
-
let r =
|
|
10203
|
+
let r = Rn(t, n);
|
|
9929
10204
|
this.rooms[t] = r, i.push(r);
|
|
9930
10205
|
}
|
|
9931
10206
|
let a = e.labels?.[r] ?? [], o = e.areas[r]?.userData ?? {};
|
|
9932
|
-
for (let e of a)
|
|
9933
|
-
this.areas[r] = new
|
|
10207
|
+
for (let e of a) Vn(e), Hn(e, o);
|
|
10208
|
+
this.areas[r] = new Kn(r, e.areaNames[r] ?? `Area ${r}`, i, a.map((e) => this.toRendererLabel(e, r)));
|
|
9934
10209
|
}
|
|
9935
10210
|
}
|
|
9936
10211
|
toRendererLabel(e, t) {
|
|
@@ -9987,10 +10262,10 @@ var Gn = {
|
|
|
9987
10262
|
return !1;
|
|
9988
10263
|
}
|
|
9989
10264
|
getColorValue(e) {
|
|
9990
|
-
return this.colors[e]?.rgbValue ??
|
|
10265
|
+
return this.colors[e]?.rgbValue ?? Jn.rgbValue;
|
|
9991
10266
|
}
|
|
9992
10267
|
getSymbolColor(e, t) {
|
|
9993
|
-
let n = this.colors[e] ??
|
|
10268
|
+
let n = this.colors[e] ?? Jn, r = Math.min(Math.max(t ?? 1, 0), 1), i = n.symbolColor.join(",");
|
|
9994
10269
|
return r === 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
|
|
9995
10270
|
}
|
|
9996
10271
|
moveRoom(e, t, n, r) {
|
|
@@ -10024,9 +10299,24 @@ var Gn = {
|
|
|
10024
10299
|
this.raw.rooms[e] = t;
|
|
10025
10300
|
let n = this.raw.areas[t.area];
|
|
10026
10301
|
n && !n.rooms.includes(e) && n.rooms.push(e);
|
|
10027
|
-
let r =
|
|
10302
|
+
let r = Rn(e, t);
|
|
10028
10303
|
this.rooms[e] = r, this.areas[t.area]?.addRoomLive(r);
|
|
10029
10304
|
}
|
|
10305
|
+
addRooms(e) {
|
|
10306
|
+
let t = /* @__PURE__ */ new Map();
|
|
10307
|
+
for (let { id: n, room: r } of e) {
|
|
10308
|
+
this.raw.rooms[n] = r;
|
|
10309
|
+
let e = this.raw.areas[r.area];
|
|
10310
|
+
e && !e.rooms.includes(n) && e.rooms.push(n);
|
|
10311
|
+
let i = Rn(n, r);
|
|
10312
|
+
this.rooms[n] = i;
|
|
10313
|
+
let a = t.get(r.area);
|
|
10314
|
+
a || (a = [], t.set(r.area, a)), a.push(i);
|
|
10315
|
+
}
|
|
10316
|
+
let n = new Set(t.keys());
|
|
10317
|
+
for (let [e, n] of t) this.areas[e]?.addRoomsLive(n);
|
|
10318
|
+
for (let e of this.getAreas()) n.has(e.getAreaId()) || (e.rebuildExits(), e.markDirty());
|
|
10319
|
+
}
|
|
10030
10320
|
setSpecialExit(e, t, n) {
|
|
10031
10321
|
let r = this.raw.rooms[e];
|
|
10032
10322
|
r && (r.mSpecialExits[t] = n, this.areas[r.area]?.markDirty());
|
|
@@ -10120,28 +10410,24 @@ var Gn = {
|
|
|
10120
10410
|
isZone: !1,
|
|
10121
10411
|
zoneAreaRef: -1,
|
|
10122
10412
|
userData: {}
|
|
10123
|
-
}, this.raw.areaNames[e] = t, this.areas[e] = new
|
|
10413
|
+
}, this.raw.areaNames[e] = t, this.areas[e] = new Kn(e, t, [], []);
|
|
10124
10414
|
}
|
|
10125
10415
|
removeArea(e) {
|
|
10126
10416
|
delete this.raw.areas[e], delete this.raw.areaNames[e], delete this.areas[e];
|
|
10127
10417
|
}
|
|
10128
10418
|
moveRoomsToArea(e, t, n) {
|
|
10129
|
-
let r = this.areas[t], i = this.areas[n], a = [
|
|
10130
|
-
for (let
|
|
10131
|
-
let
|
|
10132
|
-
if (!
|
|
10133
|
-
|
|
10134
|
-
let
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
let c = this.rooms[e];
|
|
10142
|
-
c && (r?.removeRoomById(e), i?.addRoomLive(c));
|
|
10143
|
-
}
|
|
10144
|
-
r?.markDirty();
|
|
10419
|
+
let r = this.areas[t], i = this.areas[n], a = new Set(e), o = [];
|
|
10420
|
+
for (let t of e) {
|
|
10421
|
+
let e = this.raw.rooms[t];
|
|
10422
|
+
if (!e) continue;
|
|
10423
|
+
e.area = n;
|
|
10424
|
+
let r = this.raw.areas[n];
|
|
10425
|
+
r && !r.rooms.includes(t) && r.rooms.push(t);
|
|
10426
|
+
let i = this.rooms[t];
|
|
10427
|
+
i && o.push(i);
|
|
10428
|
+
}
|
|
10429
|
+
let s = this.raw.areas[t];
|
|
10430
|
+
s && (s.rooms = s.rooms.filter((e) => !a.has(e))), r && r.removeRoomsById(a), i && i.addRoomsLive(o), r?.markDirty();
|
|
10145
10431
|
}
|
|
10146
10432
|
renameArea(e, t) {
|
|
10147
10433
|
this.raw.areaNames[e] = t;
|
|
@@ -10152,7 +10438,7 @@ var Gn = {
|
|
|
10152
10438
|
for (let e of n) this.colors[e.envId] = {
|
|
10153
10439
|
rgb: e.colors,
|
|
10154
10440
|
rgbValue: `rgb(${e.colors.join(",")})`,
|
|
10155
|
-
symbolColor:
|
|
10441
|
+
symbolColor: qn(e.colors) > .41 ? [
|
|
10156
10442
|
25,
|
|
10157
10443
|
25,
|
|
10158
10444
|
25
|
|
@@ -10161,13 +10447,13 @@ var Gn = {
|
|
|
10161
10447
|
255,
|
|
10162
10448
|
255
|
|
10163
10449
|
],
|
|
10164
|
-
symbolColorValue:
|
|
10450
|
+
symbolColorValue: qn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
|
|
10165
10451
|
};
|
|
10166
10452
|
t === null && delete this.colors[e];
|
|
10167
10453
|
}
|
|
10168
10454
|
getLabelSnapshot(e, t) {
|
|
10169
10455
|
let n = this.raw.labels[e]?.find((e) => e.id === t);
|
|
10170
|
-
return n ?
|
|
10456
|
+
return n ? Wn(n) : null;
|
|
10171
10457
|
}
|
|
10172
10458
|
addLabel(e, t) {
|
|
10173
10459
|
this.raw.labels[e] || (this.raw.labels[e] = []);
|
|
@@ -10189,7 +10475,7 @@ var Gn = {
|
|
|
10189
10475
|
};
|
|
10190
10476
|
this.raw.labels[e].push(r);
|
|
10191
10477
|
let i = this.raw.areas[e]?.userData;
|
|
10192
|
-
i &&
|
|
10478
|
+
i && Un(r, i), this.syncRendererLabels(e);
|
|
10193
10479
|
}
|
|
10194
10480
|
removeLabel(e, t) {
|
|
10195
10481
|
if (!this.raw.labels[e]) return;
|
|
@@ -10222,14 +10508,14 @@ var Gn = {
|
|
|
10222
10508
|
if (!r) return;
|
|
10223
10509
|
r.font = { ...n };
|
|
10224
10510
|
let i = this.raw.areas[e]?.userData;
|
|
10225
|
-
i &&
|
|
10511
|
+
i && Un(r, i), this.syncRendererLabels(e);
|
|
10226
10512
|
}
|
|
10227
10513
|
setLabelOutlineColor(e, t, n) {
|
|
10228
10514
|
let r = this.raw.labels[e]?.find((e) => e.id === t);
|
|
10229
10515
|
if (!r) return;
|
|
10230
10516
|
r.outlineColor = n ? { ...n } : void 0;
|
|
10231
10517
|
let i = this.raw.areas[e]?.userData;
|
|
10232
|
-
i &&
|
|
10518
|
+
i && Un(r, i), this.syncRendererLabels(e);
|
|
10233
10519
|
}
|
|
10234
10520
|
setLabelNoScaling(e, t, n) {
|
|
10235
10521
|
let r = this.raw.labels[e]?.find((e) => e.id === t);
|
|
@@ -10260,10 +10546,10 @@ var Gn = {
|
|
|
10260
10546
|
restoreAreaWithRooms(e, t, n, r) {
|
|
10261
10547
|
let i = [];
|
|
10262
10548
|
for (let { id: e, room: t } of n) {
|
|
10263
|
-
let n =
|
|
10549
|
+
let n = Rn(e, t);
|
|
10264
10550
|
this.rooms[e] = n, i.push(n);
|
|
10265
10551
|
}
|
|
10266
|
-
this.areas[e] = new
|
|
10552
|
+
this.areas[e] = new Kn(e, t, i, []);
|
|
10267
10553
|
for (let e of r) {
|
|
10268
10554
|
let t = this.areas[e];
|
|
10269
10555
|
t && (t.rebuildExits(), t.markDirty());
|
|
@@ -10302,7 +10588,7 @@ var Gn = {
|
|
|
10302
10588
|
}
|
|
10303
10589
|
for (let e of this.getAreas()) n.has(e.getAreaId()) || e.rebuildExits();
|
|
10304
10590
|
}
|
|
10305
|
-
},
|
|
10591
|
+
}, Xn = class {
|
|
10306
10592
|
rects = /* @__PURE__ */ new Map();
|
|
10307
10593
|
layer;
|
|
10308
10594
|
unsubscribe;
|
|
@@ -10346,7 +10632,7 @@ var Gn = {
|
|
|
10346
10632
|
}
|
|
10347
10633
|
this.layer.batchDraw();
|
|
10348
10634
|
}
|
|
10349
|
-
},
|
|
10635
|
+
}, Zn = "#ffcc00", Qn = .9, $n = .3, er = .2, tr = class {
|
|
10350
10636
|
roomRect;
|
|
10351
10637
|
linkGroup;
|
|
10352
10638
|
layer;
|
|
@@ -10357,7 +10643,7 @@ var Gn = {
|
|
|
10357
10643
|
}
|
|
10358
10644
|
attach(e) {
|
|
10359
10645
|
this.layer = e, this.roomRect = new h.Rect({
|
|
10360
|
-
stroke:
|
|
10646
|
+
stroke: Zn,
|
|
10361
10647
|
strokeWidth: .06,
|
|
10362
10648
|
listening: !1,
|
|
10363
10649
|
visible: !1,
|
|
@@ -10405,23 +10691,23 @@ var Gn = {
|
|
|
10405
10691
|
}
|
|
10406
10692
|
for (let t of e.data.lines) this.linkGroup.add(new h.Line({
|
|
10407
10693
|
points: [...t.points],
|
|
10408
|
-
stroke:
|
|
10694
|
+
stroke: Zn,
|
|
10409
10695
|
strokeWidth: r,
|
|
10410
10696
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10411
10697
|
listening: !1,
|
|
10412
10698
|
lineCap: "round",
|
|
10413
|
-
opacity:
|
|
10699
|
+
opacity: Qn
|
|
10414
10700
|
}));
|
|
10415
10701
|
for (let t of e.data.arrows) this.linkGroup.add(new h.Arrow({
|
|
10416
10702
|
points: [...t.points],
|
|
10417
|
-
stroke:
|
|
10418
|
-
fill:
|
|
10703
|
+
stroke: Zn,
|
|
10704
|
+
fill: Zn,
|
|
10419
10705
|
strokeWidth: r,
|
|
10420
10706
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10421
10707
|
pointerLength: t.pointerLength,
|
|
10422
10708
|
pointerWidth: t.pointerWidth,
|
|
10423
10709
|
listening: !1,
|
|
10424
|
-
opacity:
|
|
10710
|
+
opacity: Qn
|
|
10425
10711
|
}));
|
|
10426
10712
|
this.linkGroup.visible(!0);
|
|
10427
10713
|
} else if (t.kind === "customLine") {
|
|
@@ -10432,32 +10718,32 @@ var Gn = {
|
|
|
10432
10718
|
}
|
|
10433
10719
|
let i = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
|
|
10434
10720
|
points: [...e.points],
|
|
10435
|
-
stroke:
|
|
10436
|
-
fill:
|
|
10721
|
+
stroke: Zn,
|
|
10722
|
+
fill: Zn,
|
|
10437
10723
|
strokeWidth: r,
|
|
10438
10724
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10439
|
-
pointerLength:
|
|
10440
|
-
pointerWidth:
|
|
10725
|
+
pointerLength: $n,
|
|
10726
|
+
pointerWidth: er,
|
|
10441
10727
|
listening: !1,
|
|
10442
10728
|
lineCap: "round",
|
|
10443
10729
|
lineJoin: "round",
|
|
10444
|
-
opacity:
|
|
10730
|
+
opacity: Qn
|
|
10445
10731
|
}) : new h.Line({
|
|
10446
10732
|
points: [...e.points],
|
|
10447
|
-
stroke:
|
|
10733
|
+
stroke: Zn,
|
|
10448
10734
|
strokeWidth: r,
|
|
10449
10735
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10450
10736
|
listening: !1,
|
|
10451
10737
|
lineCap: "round",
|
|
10452
10738
|
lineJoin: "round",
|
|
10453
|
-
opacity:
|
|
10739
|
+
opacity: Qn
|
|
10454
10740
|
});
|
|
10455
10741
|
this.linkGroup.add(i), this.linkGroup.visible(!0);
|
|
10456
10742
|
}
|
|
10457
10743
|
this.layer.batchDraw();
|
|
10458
10744
|
}
|
|
10459
|
-
},
|
|
10460
|
-
function
|
|
10745
|
+
}, nr = .6;
|
|
10746
|
+
function rr(e) {
|
|
10461
10747
|
for (let [t, n, r] of at) if (r === e) return {
|
|
10462
10748
|
ox: t,
|
|
10463
10749
|
oy: n
|
|
@@ -10467,7 +10753,7 @@ function er(e) {
|
|
|
10467
10753
|
oy: 0
|
|
10468
10754
|
};
|
|
10469
10755
|
}
|
|
10470
|
-
var
|
|
10756
|
+
var ir = class {
|
|
10471
10757
|
line;
|
|
10472
10758
|
dirLabel;
|
|
10473
10759
|
layer;
|
|
@@ -10514,14 +10800,14 @@ var tr = class {
|
|
|
10514
10800
|
}
|
|
10515
10801
|
let r = n.getRenderRoom(t.sourceId);
|
|
10516
10802
|
if (!r) return;
|
|
10517
|
-
let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ??
|
|
10803
|
+
let i = t.hoverTargetId == null ? null : n.getRenderRoom(t.hoverTargetId), a = (n.settings.roomSize ?? nr) / 2, o = r.x, s = r.y;
|
|
10518
10804
|
if (t.sourceDir) {
|
|
10519
|
-
let { ox: e, oy: n } =
|
|
10805
|
+
let { ox: e, oy: n } = rr(t.sourceDir);
|
|
10520
10806
|
o = r.x + e * a, s = r.y + n * a;
|
|
10521
10807
|
}
|
|
10522
10808
|
let c, l;
|
|
10523
10809
|
if (i && t.targetDir) {
|
|
10524
|
-
let { ox: e, oy: n } =
|
|
10810
|
+
let { ox: e, oy: n } = rr(t.targetDir);
|
|
10525
10811
|
c = i.x + e * a, l = i.y + n * a;
|
|
10526
10812
|
} else i ? (c = i.x, l = i.y) : (c = t.cursorMap?.x ?? r.x, l = t.cursorMap?.y ?? r.y);
|
|
10527
10813
|
let u = !0, d = "";
|
|
@@ -10542,7 +10828,7 @@ var tr = class {
|
|
|
10542
10828
|
l
|
|
10543
10829
|
]), this.line.stroke(f), this.line.fill(f), this.line.visible(!0), d ? (this.dirLabel.text(d), this.dirLabel.fill(f), this.dirLabel.x((o + c) / 2 + .2), this.dirLabel.y((s + l) / 2 + .2), this.dirLabel.visible(!0)) : this.dirLabel.visible(!1), this.layer.batchDraw();
|
|
10544
10830
|
}
|
|
10545
|
-
},
|
|
10831
|
+
}, ar = class {
|
|
10546
10832
|
rect;
|
|
10547
10833
|
layer;
|
|
10548
10834
|
unsubscribe;
|
|
@@ -10578,7 +10864,7 @@ var tr = class {
|
|
|
10578
10864
|
}
|
|
10579
10865
|
this.rect.x(t.x), this.rect.y(t.y), this.rect.visible(!0), this.layer.batchDraw();
|
|
10580
10866
|
}
|
|
10581
|
-
},
|
|
10867
|
+
}, or = class {
|
|
10582
10868
|
source;
|
|
10583
10869
|
target;
|
|
10584
10870
|
layer;
|
|
@@ -10656,7 +10942,7 @@ var tr = class {
|
|
|
10656
10942
|
}
|
|
10657
10943
|
this.layer.batchDraw();
|
|
10658
10944
|
}
|
|
10659
|
-
},
|
|
10945
|
+
}, sr = "rgba(255, 220, 60, 0.9)", cr = .55, lr = class {
|
|
10660
10946
|
group;
|
|
10661
10947
|
layer;
|
|
10662
10948
|
unsubscribe;
|
|
@@ -10729,14 +11015,14 @@ var tr = class {
|
|
|
10729
11015
|
if (o) {
|
|
10730
11016
|
let t = this.resolveTargetRoom(e, o.roomId, o.exitName);
|
|
10731
11017
|
if (t) {
|
|
10732
|
-
let { x: e, y: n } = t, r =
|
|
11018
|
+
let { x: e, y: n } = t, r = cr, i = new h.Line({
|
|
10733
11019
|
points: [
|
|
10734
11020
|
e - r,
|
|
10735
11021
|
n,
|
|
10736
11022
|
e + r,
|
|
10737
11023
|
n
|
|
10738
11024
|
],
|
|
10739
|
-
stroke:
|
|
11025
|
+
stroke: sr,
|
|
10740
11026
|
strokeWidth: a,
|
|
10741
11027
|
listening: !1,
|
|
10742
11028
|
lineCap: "round"
|
|
@@ -10747,7 +11033,7 @@ var tr = class {
|
|
|
10747
11033
|
e,
|
|
10748
11034
|
n + r
|
|
10749
11035
|
],
|
|
10750
|
-
stroke:
|
|
11036
|
+
stroke: sr,
|
|
10751
11037
|
strokeWidth: a,
|
|
10752
11038
|
listening: !1,
|
|
10753
11039
|
lineCap: "round"
|
|
@@ -10777,11 +11063,11 @@ var tr = class {
|
|
|
10777
11063
|
y: c.y
|
|
10778
11064
|
};
|
|
10779
11065
|
}
|
|
10780
|
-
},
|
|
10781
|
-
shadowColor:
|
|
11066
|
+
}, ur = "#00e5ff", dr = {
|
|
11067
|
+
shadowColor: ur,
|
|
10782
11068
|
shadowBlur: 4,
|
|
10783
11069
|
shadowOpacity: .8
|
|
10784
|
-
},
|
|
11070
|
+
}, fr = .3, pr = .2, mr = class {
|
|
10785
11071
|
group;
|
|
10786
11072
|
layer;
|
|
10787
11073
|
unsubscribe;
|
|
@@ -10819,22 +11105,22 @@ var tr = class {
|
|
|
10819
11105
|
}
|
|
10820
11106
|
for (let t of e.data.lines) this.group.add(new h.Line({
|
|
10821
11107
|
points: [...t.points],
|
|
10822
|
-
stroke:
|
|
11108
|
+
stroke: ur,
|
|
10823
11109
|
strokeWidth: .08,
|
|
10824
11110
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10825
11111
|
listening: !1,
|
|
10826
|
-
...
|
|
11112
|
+
...dr
|
|
10827
11113
|
}));
|
|
10828
11114
|
for (let t of e.data.arrows) this.group.add(new h.Arrow({
|
|
10829
11115
|
points: [...t.points],
|
|
10830
|
-
stroke:
|
|
10831
|
-
fill:
|
|
11116
|
+
stroke: ur,
|
|
11117
|
+
fill: ur,
|
|
10832
11118
|
strokeWidth: .08,
|
|
10833
11119
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10834
11120
|
pointerLength: t.pointerLength,
|
|
10835
11121
|
pointerWidth: t.pointerWidth,
|
|
10836
11122
|
listening: !1,
|
|
10837
|
-
...
|
|
11123
|
+
...dr
|
|
10838
11124
|
}));
|
|
10839
11125
|
this.group.visible(!0), this.layer.batchDraw();
|
|
10840
11126
|
return;
|
|
@@ -10847,28 +11133,28 @@ var tr = class {
|
|
|
10847
11133
|
}
|
|
10848
11134
|
let r = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
|
|
10849
11135
|
points: [...e.points],
|
|
10850
|
-
stroke:
|
|
10851
|
-
fill:
|
|
11136
|
+
stroke: ur,
|
|
11137
|
+
fill: ur,
|
|
10852
11138
|
strokeWidth: .08,
|
|
10853
11139
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10854
|
-
pointerLength:
|
|
10855
|
-
pointerWidth:
|
|
11140
|
+
pointerLength: fr,
|
|
11141
|
+
pointerWidth: pr,
|
|
10856
11142
|
listening: !1,
|
|
10857
|
-
...
|
|
11143
|
+
...dr
|
|
10858
11144
|
}) : new h.Line({
|
|
10859
11145
|
points: [...e.points],
|
|
10860
|
-
stroke:
|
|
11146
|
+
stroke: ur,
|
|
10861
11147
|
strokeWidth: .08,
|
|
10862
11148
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10863
11149
|
listening: !1,
|
|
10864
|
-
...
|
|
11150
|
+
...dr
|
|
10865
11151
|
});
|
|
10866
11152
|
this.group.add(r), this.group.add(new h.Circle({
|
|
10867
11153
|
x: e.points[0],
|
|
10868
11154
|
y: e.points[1],
|
|
10869
11155
|
radius: .1,
|
|
10870
11156
|
fill: "#1a2030",
|
|
10871
|
-
stroke:
|
|
11157
|
+
stroke: ur,
|
|
10872
11158
|
strokeWidth: .04,
|
|
10873
11159
|
listening: !1
|
|
10874
11160
|
}));
|
|
@@ -10879,8 +11165,8 @@ var tr = class {
|
|
|
10879
11165
|
x: e.points[t],
|
|
10880
11166
|
y: e.points[t + 1],
|
|
10881
11167
|
radius: r ? .14 : .1,
|
|
10882
|
-
fill: r ? "#ffffff" :
|
|
10883
|
-
stroke: r ?
|
|
11168
|
+
fill: r ? "#ffffff" : ur,
|
|
11169
|
+
stroke: r ? ur : "#ffffff",
|
|
10884
11170
|
strokeWidth: r ? .06 : .04,
|
|
10885
11171
|
listening: !1
|
|
10886
11172
|
}));
|
|
@@ -10893,13 +11179,13 @@ var tr = class {
|
|
|
10893
11179
|
};
|
|
10894
11180
|
//#endregion
|
|
10895
11181
|
//#region src/editor/effects/GridOverlayEffect.ts
|
|
10896
|
-
function
|
|
11182
|
+
function hr(e, t) {
|
|
10897
11183
|
let n = e.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);
|
|
10898
11184
|
if (!n) return e;
|
|
10899
11185
|
let r = n[4] === void 0 ? 1 : parseFloat(n[4]);
|
|
10900
11186
|
return `rgba(${n[1]}, ${n[2]}, ${n[3]}, ${Math.min(1, r * t)})`;
|
|
10901
11187
|
}
|
|
10902
|
-
var
|
|
11188
|
+
var gr = class {
|
|
10903
11189
|
gridShape;
|
|
10904
11190
|
axisShape;
|
|
10905
11191
|
labelShape;
|
|
@@ -10931,7 +11217,7 @@ var pr = class {
|
|
|
10931
11217
|
}), this.axisShape = new h.Shape({
|
|
10932
11218
|
listening: !1,
|
|
10933
11219
|
visible: !1,
|
|
10934
|
-
stroke:
|
|
11220
|
+
stroke: hr(this.gridColor, 2),
|
|
10935
11221
|
strokeWidth: this.gridLineWidth * 2,
|
|
10936
11222
|
sceneFunc: (e, t) => {
|
|
10937
11223
|
let { minX: n, maxX: r, minY: i, maxY: a } = this.bounds;
|
|
@@ -10945,7 +11231,7 @@ var pr = class {
|
|
|
10945
11231
|
text: "(0,0)",
|
|
10946
11232
|
fontSize: this.gridSize,
|
|
10947
11233
|
fontFamily: "monospace",
|
|
10948
|
-
fill:
|
|
11234
|
+
fill: hr(this.gridColor, 2)
|
|
10949
11235
|
}), e.add(this.gridShape), e.add(this.axisShape), e.add(this.labelShape), this.unsubscribe = D.subscribe(() => this.syncVisibility());
|
|
10950
11236
|
}
|
|
10951
11237
|
updateViewport(e, t, n) {
|
|
@@ -10959,7 +11245,7 @@ var pr = class {
|
|
|
10959
11245
|
let e = this.getIsEmpty();
|
|
10960
11246
|
e && (this.bounds = this.getViewportBounds()), this.gridShape.visible() !== e && (this.gridShape.visible(e), this.axisShape.visible(e), this.labelShape.visible(e), this.layer.batchDraw());
|
|
10961
11247
|
}
|
|
10962
|
-
},
|
|
11248
|
+
}, _r = class {
|
|
10963
11249
|
rect;
|
|
10964
11250
|
layer;
|
|
10965
11251
|
unsubscribe;
|
|
@@ -10993,7 +11279,7 @@ var pr = class {
|
|
|
10993
11279
|
};
|
|
10994
11280
|
//#endregion
|
|
10995
11281
|
//#region src/editor/effects/LabelHaloEffect.ts
|
|
10996
|
-
function
|
|
11282
|
+
function vr(e, t, n, r) {
|
|
10997
11283
|
return [
|
|
10998
11284
|
{
|
|
10999
11285
|
id: "nw",
|
|
@@ -11037,7 +11323,7 @@ function hr(e, t, n, r) {
|
|
|
11037
11323
|
}
|
|
11038
11324
|
];
|
|
11039
11325
|
}
|
|
11040
|
-
var
|
|
11326
|
+
var yr = class {
|
|
11041
11327
|
selRect;
|
|
11042
11328
|
hoverRect;
|
|
11043
11329
|
previewRect;
|
|
@@ -11127,7 +11413,7 @@ var gr = class {
|
|
|
11127
11413
|
for (let e of this.handles) e.visible(!1);
|
|
11128
11414
|
return;
|
|
11129
11415
|
}
|
|
11130
|
-
let t = .05, n = e.x - t, r = e.y - t, i = e.w + t * 2, a = e.h + t * 2, o = this.handleSize, s =
|
|
11416
|
+
let t = .05, n = e.x - t, r = e.y - t, i = e.w + t * 2, a = e.h + t * 2, o = this.handleSize, s = vr(n, r, i, a);
|
|
11131
11417
|
for (let e = 0; e < this.handles.length; e++) {
|
|
11132
11418
|
let t = this.handles[e], n = s[e];
|
|
11133
11419
|
t.x(n.x - o / 2), t.y(n.y - o / 2), t.width(o), t.height(o), t.visible(!0);
|
|
@@ -11146,7 +11432,7 @@ var gr = class {
|
|
|
11146
11432
|
} else this.previewRect.visible(!1);
|
|
11147
11433
|
this.layer.batchDraw();
|
|
11148
11434
|
}
|
|
11149
|
-
},
|
|
11435
|
+
}, br = class {
|
|
11150
11436
|
hLine;
|
|
11151
11437
|
vLine;
|
|
11152
11438
|
dot;
|
|
@@ -11235,11 +11521,11 @@ var gr = class {
|
|
|
11235
11521
|
};
|
|
11236
11522
|
//#endregion
|
|
11237
11523
|
//#region src/editor/effects/GhostRoomsEffect.ts
|
|
11238
|
-
function
|
|
11524
|
+
function xr(e, t) {
|
|
11239
11525
|
let n = e.match(/\d+/g);
|
|
11240
11526
|
return !n || n.length < 3 ? `rgba(128, 128, 128, ${t})` : `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${t})`;
|
|
11241
11527
|
}
|
|
11242
|
-
var
|
|
11528
|
+
var Sr = class {
|
|
11243
11529
|
rects = /* @__PURE__ */ new Map();
|
|
11244
11530
|
layer;
|
|
11245
11531
|
unsubscribe;
|
|
@@ -11293,7 +11579,7 @@ var yr = class {
|
|
|
11293
11579
|
for (let [e, t] of this.rects) n.has(e) || (t.destroy(), this.rects.delete(e));
|
|
11294
11580
|
let r = .05, i = this.roomSize + r * 2;
|
|
11295
11581
|
for (let [e, a] of n) {
|
|
11296
|
-
let n = t?.getRenderRoom(e), o = t?.reader.getColorValue(n?.env ?? 1) ?? "rgb(128,128,128)", s =
|
|
11582
|
+
let n = t?.getRenderRoom(e), o = t?.reader.getColorValue(n?.env ?? 1) ?? "rgb(128,128,128)", s = xr(o, .2), c = xr(o, .65), l = this.rects.get(e);
|
|
11297
11583
|
l || (l = new h.Rect({
|
|
11298
11584
|
strokeWidth: this.strokeWidth,
|
|
11299
11585
|
dash: [...this.dash],
|
|
@@ -11306,7 +11592,7 @@ var yr = class {
|
|
|
11306
11592
|
};
|
|
11307
11593
|
//#endregion
|
|
11308
11594
|
//#region src/editor/pointerController.ts
|
|
11309
|
-
function
|
|
11595
|
+
function Cr(e) {
|
|
11310
11596
|
let { container: t } = e, n = null, r = null, i = D.getState().spaceHeld, a = D.subscribe((r) => {
|
|
11311
11597
|
if (!i && r.spaceHeld && n !== null) {
|
|
11312
11598
|
Ft[r.activeTool].onCancel?.(e);
|
|
@@ -11372,10 +11658,10 @@ function br(e) {
|
|
|
11372
11658
|
}
|
|
11373
11659
|
//#endregion
|
|
11374
11660
|
//#region src/editor/scene.ts
|
|
11375
|
-
function
|
|
11661
|
+
function wr(e, t) {
|
|
11376
11662
|
let n = m();
|
|
11377
11663
|
n.gridEnabled = !0, n.highlightCurrentRoom = !1, n.areaName = !1, n.labelRenderMode = "image", t.dataset.editorCursor = "true";
|
|
11378
|
-
let r = new
|
|
11664
|
+
let r = new Yn(e), i = new p(r, n, t), a = { current: null }, o = new _r(), s = new Xn(n.roomSize, a), c = new tr(n.roomSize, a), l = new ir(a), u = new ar(n.roomSize), d = new or(n.roomSize, a), f = new lr(a), h = new mr(a, n.roomSize), g = new yr(a), _ = new br(a), v = new Sr(n.roomSize, a), y = new gr(n.gridColor, n.gridLineWidth, n.gridSize, () => {
|
|
11379
11665
|
let e = D.getState();
|
|
11380
11666
|
if (e.currentAreaId == null) return !1;
|
|
11381
11667
|
let t = r.getArea(e.currentAreaId);
|
|
@@ -11405,7 +11691,7 @@ function xr(e, t) {
|
|
|
11405
11691
|
}
|
|
11406
11692
|
};
|
|
11407
11693
|
a.current = b;
|
|
11408
|
-
let x =
|
|
11694
|
+
let x = Cr({
|
|
11409
11695
|
renderer: i,
|
|
11410
11696
|
container: t,
|
|
11411
11697
|
settings: n,
|
|
@@ -11416,12 +11702,12 @@ function xr(e, t) {
|
|
|
11416
11702
|
}
|
|
11417
11703
|
//#endregion
|
|
11418
11704
|
//#region src/App.tsx
|
|
11419
|
-
var
|
|
11705
|
+
var Tr = {
|
|
11420
11706
|
top: 104,
|
|
11421
11707
|
right: 464,
|
|
11422
11708
|
bottom: 24,
|
|
11423
11709
|
left: 24
|
|
11424
|
-
},
|
|
11710
|
+
}, Er = {
|
|
11425
11711
|
1: "select",
|
|
11426
11712
|
2: "connect",
|
|
11427
11713
|
3: "unlink",
|
|
@@ -11430,7 +11716,7 @@ var Sr = {
|
|
|
11430
11716
|
6: "delete",
|
|
11431
11717
|
7: "pan",
|
|
11432
11718
|
8: "paint"
|
|
11433
|
-
},
|
|
11719
|
+
}, Dr = {
|
|
11434
11720
|
ArrowLeft: {
|
|
11435
11721
|
dx: -1,
|
|
11436
11722
|
dy: 0
|
|
@@ -11448,7 +11734,7 @@ var Sr = {
|
|
|
11448
11734
|
dy: -1
|
|
11449
11735
|
}
|
|
11450
11736
|
};
|
|
11451
|
-
function
|
|
11737
|
+
function Or({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
11452
11738
|
let s = r(null), c = r(null), l = O((e) => e.map), p = O((e) => e.swatchPaletteOpen), m = l != null, h = O((e) => e.currentAreaId), g = O((e) => e.currentZ), _ = O((e) => e.activeTool), v = O((e) => e.pending), y = O((e) => e.hover), b = O((e) => e.spaceHeld), x = O((e) => e.panelCollapsed), C = O((e) => e.dataVersion), w = O((e) => e.panRequest), [T, E] = i(!1), [k, A] = i(!1), [j, M] = i(!1), [N, P] = i(() => new URLSearchParams(window.location.search).get("map")), F = n(() => a.flatMap((e) => e.swatchSets?.() ?? []), [a]), I = n(() => a.flatMap((e) => e.sidebarTabs?.() ?? []), [a]), L = n(() => a.flatMap((e) => e.roomPanelSections?.() ?? []), [a]);
|
|
11453
11739
|
t(() => {
|
|
11454
11740
|
D.setState({ pluginSwatchSets: F });
|
|
@@ -11464,17 +11750,17 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11464
11750
|
else if (e && !l) for (let e of a) e.onMapClosed?.();
|
|
11465
11751
|
}, [l]), t(() => {
|
|
11466
11752
|
if (!l || !s.current) return;
|
|
11467
|
-
let e =
|
|
11753
|
+
let e = wr(l, s.current);
|
|
11468
11754
|
c.current = e;
|
|
11469
11755
|
let { currentAreaId: t, currentZ: n } = D.getState();
|
|
11470
|
-
return t != null && e.setArea(t, n,
|
|
11756
|
+
return t != null && e.setArea(t, n, Tr), () => {
|
|
11471
11757
|
e.destroy(), c.current = null;
|
|
11472
11758
|
};
|
|
11473
11759
|
}, [l]), t(() => {
|
|
11474
11760
|
let e = c.current;
|
|
11475
11761
|
if (!e || !m || h == null) return;
|
|
11476
11762
|
let t = D.getState().navigateTo;
|
|
11477
|
-
t ? (D.setState({ navigateTo: null }), e.setAreaAt(h, g, t.mapX, t.mapY)) : e.setArea(h, g,
|
|
11763
|
+
t ? (D.setState({ navigateTo: null }), e.setAreaAt(h, g, t.mapX, t.mapY)) : e.setArea(h, g, Tr);
|
|
11478
11764
|
}, [
|
|
11479
11765
|
h,
|
|
11480
11766
|
g,
|
|
@@ -11519,7 +11805,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11519
11805
|
let { map: e, loaded: t, undo: n, currentAreaId: r, currentZ: i, sessionId: a } = D.getState();
|
|
11520
11806
|
if (!e || !t) return;
|
|
11521
11807
|
let o = setTimeout(() => {
|
|
11522
|
-
|
|
11808
|
+
Cn(t.fileName, e, n, r, i, a ?? void 0).then((e) => {
|
|
11523
11809
|
a || D.setState({ sessionId: e });
|
|
11524
11810
|
}).catch(console.error);
|
|
11525
11811
|
}, 1500);
|
|
@@ -11573,13 +11859,13 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11573
11859
|
return;
|
|
11574
11860
|
}
|
|
11575
11861
|
if (t.key === "f" || t.key === "F") {
|
|
11576
|
-
c.current?.renderer.fitArea(
|
|
11862
|
+
c.current?.renderer.fitArea(Tr);
|
|
11577
11863
|
return;
|
|
11578
11864
|
}
|
|
11579
|
-
if (
|
|
11865
|
+
if (Er[t.key]) {
|
|
11580
11866
|
let e = D.getState();
|
|
11581
11867
|
e.pending?.kind === "customLine" && c.current && (Ot(e.pending, c.current), D.bumpData()), D.setState({
|
|
11582
|
-
activeTool:
|
|
11868
|
+
activeTool: Er[t.key],
|
|
11583
11869
|
pending: null
|
|
11584
11870
|
});
|
|
11585
11871
|
return;
|
|
@@ -11595,14 +11881,14 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11595
11881
|
} });
|
|
11596
11882
|
return;
|
|
11597
11883
|
}
|
|
11598
|
-
if (
|
|
11884
|
+
if (Dr[t.key]) {
|
|
11599
11885
|
let e = D.getState();
|
|
11600
11886
|
if (e.activeTool !== "select" || !e.selection || !e.map) return;
|
|
11601
11887
|
if (e.selection.kind === "label") {
|
|
11602
11888
|
let { id: n, areaId: r } = e.selection, i = c.current?.reader.getLabelSnapshot(r, n);
|
|
11603
11889
|
if (!i) return;
|
|
11604
11890
|
t.preventDefault();
|
|
11605
|
-
let a = (t.shiftKey ? 5 : 1) * e.gridStep, o =
|
|
11891
|
+
let a = (t.shiftKey ? 5 : 1) * e.gridStep, o = Dr[t.key], s = o.dx * a, l = o.dy * a, u = [...i.pos], d = [
|
|
11606
11892
|
i.pos[0] + s,
|
|
11607
11893
|
i.pos[1] + l,
|
|
11608
11894
|
i.pos[2]
|
|
@@ -11621,7 +11907,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11621
11907
|
}
|
|
11622
11908
|
if (e.selection.kind !== "room") return;
|
|
11623
11909
|
t.preventDefault();
|
|
11624
|
-
let n = (t.shiftKey ? 5 : 1) * e.gridStep, r =
|
|
11910
|
+
let n = (t.shiftKey ? 5 : 1) * e.gridStep, r = Dr[t.key], i = r.dx * n, a = r.dy * n, o = [];
|
|
11625
11911
|
for (let t of e.selection.ids) {
|
|
11626
11912
|
let n = e.map.rooms[t];
|
|
11627
11913
|
if (!n) continue;
|
|
@@ -11659,7 +11945,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11659
11945
|
}
|
|
11660
11946
|
};
|
|
11661
11947
|
window.addEventListener("keydown", r), window.addEventListener("keyup", t), window.addEventListener("blur", n);
|
|
11662
|
-
let i = () => c.current?.renderer.fitArea(
|
|
11948
|
+
let i = () => c.current?.renderer.fitArea(Tr);
|
|
11663
11949
|
return window.addEventListener("editor:undo", z), window.addEventListener("editor:redo", B), window.addEventListener("editor:fit", i), () => {
|
|
11664
11950
|
window.removeEventListener("keydown", r), window.removeEventListener("keyup", t), window.removeEventListener("blur", n), window.removeEventListener("editor:undo", z), window.removeEventListener("editor:redo", B), window.removeEventListener("editor:fit", i);
|
|
11665
11951
|
};
|
|
@@ -11837,7 +12123,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11837
12123
|
ref: s,
|
|
11838
12124
|
className: "map-container"
|
|
11839
12125
|
}),
|
|
11840
|
-
!m && /* @__PURE__ */ d(
|
|
12126
|
+
!m && /* @__PURE__ */ d(Mn, {}),
|
|
11841
12127
|
/* @__PURE__ */ d(ue, {
|
|
11842
12128
|
title: o,
|
|
11843
12129
|
onHelpClick: () => E(!0),
|
|
@@ -11847,15 +12133,15 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11847
12133
|
},
|
|
11848
12134
|
onSearchClick: () => M((e) => !e)
|
|
11849
12135
|
}),
|
|
11850
|
-
/* @__PURE__ */ d(
|
|
12136
|
+
/* @__PURE__ */ d(gn, {
|
|
11851
12137
|
sceneRef: c,
|
|
11852
12138
|
extraTabs: I,
|
|
11853
12139
|
pluginRoomSections: L
|
|
11854
12140
|
})
|
|
11855
12141
|
]
|
|
11856
12142
|
}),
|
|
11857
|
-
/* @__PURE__ */ d(
|
|
11858
|
-
p && /* @__PURE__ */ d(
|
|
12143
|
+
/* @__PURE__ */ d(_n, { sceneRef: c }),
|
|
12144
|
+
p && /* @__PURE__ */ d(Nn, { sceneRef: c }),
|
|
11859
12145
|
a.map((t, n) => /* @__PURE__ */ d(e, { children: t.renderOverlay?.() }, n)),
|
|
11860
12146
|
j && m && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
|
|
11861
12147
|
style: {
|
|
@@ -11864,8 +12150,8 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11864
12150
|
zIndex: 399
|
|
11865
12151
|
},
|
|
11866
12152
|
onMouseDown: () => M(!1)
|
|
11867
|
-
}), /* @__PURE__ */ d(
|
|
11868
|
-
/* @__PURE__ */ d(
|
|
12153
|
+
}), /* @__PURE__ */ d(Fn, { onClose: () => M(!1) })] }),
|
|
12154
|
+
/* @__PURE__ */ d(In, { sceneRef: c }),
|
|
11869
12155
|
T && /* @__PURE__ */ d(le, { onClose: () => E(!1) }),
|
|
11870
12156
|
(k || N) && /* @__PURE__ */ d(de, {
|
|
11871
12157
|
initialUrl: N ?? void 0,
|
|
@@ -11878,9 +12164,9 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11878
12164
|
}
|
|
11879
12165
|
//#endregion
|
|
11880
12166
|
//#region src/editor/mapBytes.ts
|
|
11881
|
-
function
|
|
12167
|
+
function kr() {
|
|
11882
12168
|
let { map: e } = D.getState();
|
|
11883
12169
|
return e ? H(e) : null;
|
|
11884
12170
|
}
|
|
11885
12171
|
//#endregion
|
|
11886
|
-
export {
|
|
12172
|
+
export { Or as App, kr as getMapBytes, G as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };
|