mudlet-map-editor 0.6.2 → 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/components/MultiRoomPanel.d.ts +14 -0
- package/dist-lib/index.js +430 -174
- package/dist-lib/styles.css +1 -1
- package/package.json +1 -1
package/dist-lib/index.js
CHANGED
|
@@ -7860,8 +7860,266 @@ function dn({ selection: n, room: a, map: o, sceneRef: s, pluginSections: c = []
|
|
|
7860
7860
|
});
|
|
7861
7861
|
}
|
|
7862
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
|
|
7863
8121
|
//#region src/components/SidePanel.tsx
|
|
7864
|
-
var
|
|
8122
|
+
var hn = [
|
|
7865
8123
|
{
|
|
7866
8124
|
id: "selection",
|
|
7867
8125
|
label: "Sel"
|
|
@@ -7883,7 +8141,7 @@ var fn = [
|
|
|
7883
8141
|
label: "Map"
|
|
7884
8142
|
}
|
|
7885
8143
|
];
|
|
7886
|
-
function
|
|
8144
|
+
function gn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
7887
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);
|
|
7888
8146
|
O((e) => e.dataVersion);
|
|
7889
8147
|
let u = i ? Object.keys(i.mCustomEnvColors).length : 0, p = i ? Object.keys(i.areaNames).length : 0;
|
|
@@ -7901,7 +8159,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
|
7901
8159
|
children: "◀"
|
|
7902
8160
|
}), /* @__PURE__ */ d("div", {
|
|
7903
8161
|
className: "side-panel-tabs side-panel-tabs--vert",
|
|
7904
|
-
children: [...
|
|
8162
|
+
children: [...hn, ...t].map((e) => /* @__PURE__ */ d("button", {
|
|
7905
8163
|
type: "button",
|
|
7906
8164
|
className: `side-panel-tab${s === e.id ? " active" : ""}`,
|
|
7907
8165
|
onClick: () => D.setState({
|
|
@@ -8022,14 +8280,12 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
|
8022
8280
|
})
|
|
8023
8281
|
})]
|
|
8024
8282
|
});
|
|
8025
|
-
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", {
|
|
8026
8284
|
className: "side-panel",
|
|
8027
|
-
children: [m, /* @__PURE__ */
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
children: "Drag to move all. Delete to remove all. Shift+click/drag to add more. Ctrl+click/drag to toggle. Ctrl+A selects all."
|
|
8032
|
-
})]
|
|
8285
|
+
children: [m, /* @__PURE__ */ d(mn, {
|
|
8286
|
+
selection: r,
|
|
8287
|
+
map: i,
|
|
8288
|
+
sceneRef: e
|
|
8033
8289
|
})]
|
|
8034
8290
|
});
|
|
8035
8291
|
let g = r?.kind === "room" && i ? i.rooms[r.ids[0]] : null;
|
|
@@ -8059,7 +8315,7 @@ function pn({ sceneRef: e, extraTabs: t = [], pluginRoomSections: n = [] }) {
|
|
|
8059
8315
|
}
|
|
8060
8316
|
//#endregion
|
|
8061
8317
|
//#region src/components/ContextMenu.tsx
|
|
8062
|
-
function
|
|
8318
|
+
function _n({ sceneRef: e }) {
|
|
8063
8319
|
let n = O((e) => e.contextMenu), a = r(null), [o, s] = i(null), [c, l] = i(null);
|
|
8064
8320
|
if (t(() => {
|
|
8065
8321
|
if (!n) {
|
|
@@ -8576,46 +8832,46 @@ function mn({ sceneRef: e }) {
|
|
|
8576
8832
|
}
|
|
8577
8833
|
//#endregion
|
|
8578
8834
|
//#region src/editor/session.ts
|
|
8579
|
-
var
|
|
8580
|
-
function
|
|
8835
|
+
var vn = "mudlet-map-editor", yn = "sessions", bn = 2;
|
|
8836
|
+
function xn() {
|
|
8581
8837
|
return new Promise((e, t) => {
|
|
8582
|
-
let n = indexedDB.open(
|
|
8838
|
+
let n = indexedDB.open(vn, bn);
|
|
8583
8839
|
n.onupgradeneeded = (e) => {
|
|
8584
8840
|
let t = n.result;
|
|
8585
|
-
e.oldVersion < 2 && t.objectStoreNames.contains(
|
|
8841
|
+
e.oldVersion < 2 && t.objectStoreNames.contains(yn) && t.deleteObjectStore(yn), t.createObjectStore(yn, { keyPath: "id" });
|
|
8586
8842
|
}, n.onsuccess = () => e(n.result), n.onerror = () => t(n.error);
|
|
8587
8843
|
});
|
|
8588
8844
|
}
|
|
8589
|
-
function
|
|
8845
|
+
function Sn(e) {
|
|
8590
8846
|
let t = {};
|
|
8591
8847
|
for (let n of Object.values(e.labels)) for (let e of n) e.imageSrc && (t[String(e.id)] = e.imageSrc);
|
|
8592
8848
|
return t;
|
|
8593
8849
|
}
|
|
8594
|
-
async function
|
|
8850
|
+
async function Cn(e, t, n, r, i, a) {
|
|
8595
8851
|
let o = H(t), s = o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength), c = a ?? crypto.randomUUID(), l = {
|
|
8596
8852
|
id: c,
|
|
8597
8853
|
fileName: e,
|
|
8598
8854
|
mapBytes: s,
|
|
8599
|
-
imageSrcs:
|
|
8855
|
+
imageSrcs: Sn(t),
|
|
8600
8856
|
undoStack: n,
|
|
8601
8857
|
currentAreaId: r,
|
|
8602
8858
|
currentZ: i,
|
|
8603
8859
|
savedAt: Date.now(),
|
|
8604
8860
|
roomCount: Object.keys(t.rooms).length
|
|
8605
|
-
}, u = await
|
|
8861
|
+
}, u = await xn();
|
|
8606
8862
|
return new Promise((e, t) => {
|
|
8607
|
-
let n = u.transaction(
|
|
8608
|
-
n.objectStore(
|
|
8863
|
+
let n = u.transaction(yn, "readwrite");
|
|
8864
|
+
n.objectStore(yn).put(l), n.oncomplete = () => {
|
|
8609
8865
|
u.close(), e(c);
|
|
8610
8866
|
}, n.onerror = () => {
|
|
8611
8867
|
u.close(), t(n.error);
|
|
8612
8868
|
};
|
|
8613
8869
|
});
|
|
8614
8870
|
}
|
|
8615
|
-
async function
|
|
8616
|
-
let e = await
|
|
8871
|
+
async function wn() {
|
|
8872
|
+
let e = await xn();
|
|
8617
8873
|
return new Promise((t, n) => {
|
|
8618
|
-
let r = e.transaction(
|
|
8874
|
+
let r = e.transaction(yn, "readonly").objectStore(yn).getAll();
|
|
8619
8875
|
r.onsuccess = () => {
|
|
8620
8876
|
e.close(), t(r.result.sort((e, t) => t.savedAt - e.savedAt));
|
|
8621
8877
|
}, r.onerror = () => {
|
|
@@ -8623,29 +8879,29 @@ async function xn() {
|
|
|
8623
8879
|
};
|
|
8624
8880
|
});
|
|
8625
8881
|
}
|
|
8626
|
-
async function
|
|
8627
|
-
let e = await
|
|
8882
|
+
async function Tn() {
|
|
8883
|
+
let e = await xn();
|
|
8628
8884
|
return new Promise((t, n) => {
|
|
8629
|
-
let r = e.transaction(
|
|
8630
|
-
r.objectStore(
|
|
8885
|
+
let r = e.transaction(yn, "readwrite");
|
|
8886
|
+
r.objectStore(yn).clear(), r.oncomplete = () => {
|
|
8631
8887
|
e.close(), t();
|
|
8632
8888
|
}, r.onerror = () => {
|
|
8633
8889
|
e.close(), n(r.error);
|
|
8634
8890
|
};
|
|
8635
8891
|
});
|
|
8636
8892
|
}
|
|
8637
|
-
async function
|
|
8638
|
-
let t = await
|
|
8893
|
+
async function En(e) {
|
|
8894
|
+
let t = await xn();
|
|
8639
8895
|
return new Promise((n, r) => {
|
|
8640
|
-
let i = t.transaction(
|
|
8641
|
-
i.objectStore(
|
|
8896
|
+
let i = t.transaction(yn, "readwrite");
|
|
8897
|
+
i.objectStore(yn).delete(e), i.oncomplete = () => {
|
|
8642
8898
|
t.close(), n();
|
|
8643
8899
|
}, i.onerror = () => {
|
|
8644
8900
|
t.close(), r(i.error);
|
|
8645
8901
|
};
|
|
8646
8902
|
});
|
|
8647
8903
|
}
|
|
8648
|
-
function
|
|
8904
|
+
function Dn(e) {
|
|
8649
8905
|
let t = ie(e.mapBytes);
|
|
8650
8906
|
if (Object.keys(e.imageSrcs).length > 0) for (let n of Object.values(t.labels)) for (let t of n) {
|
|
8651
8907
|
let n = e.imageSrcs[String(t.id)];
|
|
@@ -8655,10 +8911,10 @@ function wn(e) {
|
|
|
8655
8911
|
}
|
|
8656
8912
|
//#endregion
|
|
8657
8913
|
//#region src/components/SessionsPanel.tsx
|
|
8658
|
-
var
|
|
8659
|
-
function
|
|
8914
|
+
var On = "mudlet-session-autodelete";
|
|
8915
|
+
function kn() {
|
|
8660
8916
|
try {
|
|
8661
|
-
let e = localStorage.getItem(
|
|
8917
|
+
let e = localStorage.getItem(On);
|
|
8662
8918
|
if (e) return JSON.parse(e);
|
|
8663
8919
|
} catch {}
|
|
8664
8920
|
return {
|
|
@@ -8666,24 +8922,24 @@ function En() {
|
|
|
8666
8922
|
days: 30
|
|
8667
8923
|
};
|
|
8668
8924
|
}
|
|
8669
|
-
function
|
|
8670
|
-
localStorage.setItem(
|
|
8925
|
+
function An(e) {
|
|
8926
|
+
localStorage.setItem(On, JSON.stringify(e));
|
|
8671
8927
|
}
|
|
8672
|
-
function
|
|
8928
|
+
function jn(e, t) {
|
|
8673
8929
|
let n = Date.now() - t * 24 * 60 * 60 * 1e3, r = [];
|
|
8674
|
-
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);
|
|
8675
8931
|
return r;
|
|
8676
8932
|
}
|
|
8677
|
-
function
|
|
8678
|
-
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);
|
|
8679
8935
|
t(() => {
|
|
8680
|
-
let e =
|
|
8681
|
-
|
|
8682
|
-
n(e.enabled ?
|
|
8936
|
+
let e = kn();
|
|
8937
|
+
wn().then((t) => {
|
|
8938
|
+
n(e.enabled ? jn(t, e.days) : t), a(!0);
|
|
8683
8939
|
}).catch(() => a(!0));
|
|
8684
8940
|
}, []);
|
|
8685
8941
|
let c = (e) => {
|
|
8686
|
-
let t =
|
|
8942
|
+
let t = Dn(e);
|
|
8687
8943
|
D.setState({
|
|
8688
8944
|
map: t,
|
|
8689
8945
|
loaded: { fileName: e.fileName },
|
|
@@ -8699,21 +8955,21 @@ function kn() {
|
|
|
8699
8955
|
sessionId: e.id
|
|
8700
8956
|
}), D.bumpStructure();
|
|
8701
8957
|
}, l = (e) => {
|
|
8702
|
-
|
|
8958
|
+
En(e.id).catch(console.error), n((t) => t.filter((t) => t.id !== e.id));
|
|
8703
8959
|
}, u = () => {
|
|
8704
|
-
|
|
8960
|
+
Tn().catch(console.error), n([]);
|
|
8705
8961
|
}, p = (e) => {
|
|
8706
8962
|
let t = {
|
|
8707
8963
|
...o,
|
|
8708
8964
|
enabled: e
|
|
8709
8965
|
};
|
|
8710
|
-
s(t),
|
|
8966
|
+
s(t), An(t), e && n((e) => jn(e, t.days));
|
|
8711
8967
|
}, m = (e) => {
|
|
8712
8968
|
let t = {
|
|
8713
8969
|
...o,
|
|
8714
8970
|
days: e
|
|
8715
8971
|
};
|
|
8716
|
-
s(t),
|
|
8972
|
+
s(t), An(t), t.enabled && n((t) => jn(t, e));
|
|
8717
8973
|
};
|
|
8718
8974
|
return r ? e.length === 0 ? /* @__PURE__ */ f("div", {
|
|
8719
8975
|
className: "empty-state",
|
|
@@ -8810,7 +9066,7 @@ function kn() {
|
|
|
8810
9066
|
}
|
|
8811
9067
|
//#endregion
|
|
8812
9068
|
//#region src/components/SwatchPalette.tsx
|
|
8813
|
-
function
|
|
9069
|
+
function Nn({ sceneRef: e }) {
|
|
8814
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({
|
|
8815
9071
|
x: 12,
|
|
8816
9072
|
y: 120
|
|
@@ -9150,10 +9406,10 @@ function An({ sceneRef: e }) {
|
|
|
9150
9406
|
}
|
|
9151
9407
|
//#endregion
|
|
9152
9408
|
//#region src/components/SearchPanel.tsx
|
|
9153
|
-
function
|
|
9409
|
+
function Pn(e, t = 40) {
|
|
9154
9410
|
return e.length > t ? e.slice(0, t) + "…" : e;
|
|
9155
9411
|
}
|
|
9156
|
-
function
|
|
9412
|
+
function Fn({ onClose: e }) {
|
|
9157
9413
|
let a = O((e) => e.map), [o, s] = i(""), [c, l] = i("rooms"), [p, m] = i(0), h = r(null), g = r(null);
|
|
9158
9414
|
t(() => {
|
|
9159
9415
|
h.current?.focus();
|
|
@@ -9170,7 +9426,7 @@ function Mn({ onClose: e }) {
|
|
|
9170
9426
|
else if (n.includes(e)) o = "id";
|
|
9171
9427
|
else if (r.userData) {
|
|
9172
9428
|
for (let [t, n] of Object.entries(r.userData)) if (t.toLowerCase().includes(e) || String(n).toLowerCase().includes(e)) {
|
|
9173
|
-
o = `${t}: ${
|
|
9429
|
+
o = `${t}: ${Pn(String(n))}`;
|
|
9174
9430
|
break;
|
|
9175
9431
|
}
|
|
9176
9432
|
}
|
|
@@ -9392,7 +9648,7 @@ function Mn({ onClose: e }) {
|
|
|
9392
9648
|
}
|
|
9393
9649
|
//#endregion
|
|
9394
9650
|
//#region src/components/SpreadShrinkPopup.tsx
|
|
9395
|
-
function
|
|
9651
|
+
function In({ sceneRef: e }) {
|
|
9396
9652
|
let n = O((e) => e.spreadShrink), i = O((e) => e.selection), a = r(null);
|
|
9397
9653
|
if (t(() => {
|
|
9398
9654
|
if (!n) return;
|
|
@@ -9550,14 +9806,14 @@ function Nn({ sceneRef: e }) {
|
|
|
9550
9806
|
}
|
|
9551
9807
|
//#endregion
|
|
9552
9808
|
//#region src/editor/reader/EditorMapReader.ts
|
|
9553
|
-
var
|
|
9809
|
+
var Ln = {
|
|
9554
9810
|
1: "solid line",
|
|
9555
9811
|
2: "dash line",
|
|
9556
9812
|
3: "dot line",
|
|
9557
9813
|
4: "dash dot line",
|
|
9558
9814
|
5: "dash dot dot line"
|
|
9559
9815
|
};
|
|
9560
|
-
function
|
|
9816
|
+
function Rn(e, t) {
|
|
9561
9817
|
let n = {
|
|
9562
9818
|
id: e,
|
|
9563
9819
|
__raw: t
|
|
@@ -9646,7 +9902,7 @@ function Fn(e, t) {
|
|
|
9646
9902
|
g: 255,
|
|
9647
9903
|
b: 255
|
|
9648
9904
|
},
|
|
9649
|
-
style:
|
|
9905
|
+
style: Ln[t.customLinesStyle?.[r]] ?? "solid line",
|
|
9650
9906
|
arrow: t.customLinesArrow?.[r] ?? !1
|
|
9651
9907
|
}
|
|
9652
9908
|
};
|
|
@@ -9657,7 +9913,7 @@ function Fn(e, t) {
|
|
|
9657
9913
|
configurable: !0
|
|
9658
9914
|
}), n;
|
|
9659
9915
|
}
|
|
9660
|
-
function
|
|
9916
|
+
function zn(e) {
|
|
9661
9917
|
let t = {
|
|
9662
9918
|
north: "south",
|
|
9663
9919
|
south: "north",
|
|
@@ -9723,7 +9979,7 @@ function In(e) {
|
|
|
9723
9979
|
}
|
|
9724
9980
|
return r;
|
|
9725
9981
|
}
|
|
9726
|
-
function
|
|
9982
|
+
function Bn(e) {
|
|
9727
9983
|
if (!e || e.length === 0) return "";
|
|
9728
9984
|
if (typeof e == "string") return e.includes(",") ? e.split(",")[1] : e;
|
|
9729
9985
|
try {
|
|
@@ -9732,10 +9988,10 @@ function Ln(e) {
|
|
|
9732
9988
|
return "";
|
|
9733
9989
|
}
|
|
9734
9990
|
}
|
|
9735
|
-
function
|
|
9736
|
-
e.pixMapBase64 === void 0 && (e.pixMapBase64 =
|
|
9991
|
+
function Vn(e) {
|
|
9992
|
+
e.pixMapBase64 === void 0 && (e.pixMapBase64 = Bn(e.pixMap));
|
|
9737
9993
|
}
|
|
9738
|
-
function
|
|
9994
|
+
function Hn(e, t) {
|
|
9739
9995
|
let n = e.id;
|
|
9740
9996
|
if (!e.font) {
|
|
9741
9997
|
let r = t[`system.labelFont_${n}`];
|
|
@@ -9765,7 +10021,7 @@ function zn(e, t) {
|
|
|
9765
10021
|
});
|
|
9766
10022
|
}
|
|
9767
10023
|
}
|
|
9768
|
-
function
|
|
10024
|
+
function Un(e, t) {
|
|
9769
10025
|
let n = e.id, r = e.font;
|
|
9770
10026
|
if (r?.family) {
|
|
9771
10027
|
let e = r.bold ? 75 : 50;
|
|
@@ -9776,7 +10032,7 @@ function Bn(e, t) {
|
|
|
9776
10032
|
t[`system.labelOutlineColor_${n}`] = `${r}|${i}|${a}|${o}`;
|
|
9777
10033
|
} else t[`system.labelOutlineColor_${n}`] = "0|0|0|0";
|
|
9778
10034
|
}
|
|
9779
|
-
function
|
|
10035
|
+
function Wn(e) {
|
|
9780
10036
|
return {
|
|
9781
10037
|
id: e.id,
|
|
9782
10038
|
pos: [...e.pos],
|
|
@@ -9792,7 +10048,7 @@ function Vn(e) {
|
|
|
9792
10048
|
imageSrc: e.imageSrc
|
|
9793
10049
|
};
|
|
9794
10050
|
}
|
|
9795
|
-
var
|
|
10051
|
+
var Gn = class {
|
|
9796
10052
|
constructor(e, t) {
|
|
9797
10053
|
this.rooms = e, this.labels = t;
|
|
9798
10054
|
}
|
|
@@ -9822,7 +10078,7 @@ var Hn = class {
|
|
|
9822
10078
|
setLabels(e) {
|
|
9823
10079
|
this.labels = e;
|
|
9824
10080
|
}
|
|
9825
|
-
},
|
|
10081
|
+
}, Kn = class {
|
|
9826
10082
|
planes = {};
|
|
9827
10083
|
exits = /* @__PURE__ */ new Map();
|
|
9828
10084
|
version = 0;
|
|
@@ -9893,19 +10149,19 @@ var Hn = class {
|
|
|
9893
10149
|
let t = {};
|
|
9894
10150
|
for (let [n, r] of Object.entries(e)) {
|
|
9895
10151
|
let e = Number(n);
|
|
9896
|
-
t[e] = new
|
|
10152
|
+
t[e] = new Gn(r, this.labels.filter((t) => t.Z === e));
|
|
9897
10153
|
}
|
|
9898
10154
|
this.planes = t;
|
|
9899
10155
|
}
|
|
9900
10156
|
rebuildExits() {
|
|
9901
|
-
this.exits =
|
|
10157
|
+
this.exits = zn(this.rooms);
|
|
9902
10158
|
}
|
|
9903
10159
|
};
|
|
9904
|
-
function
|
|
10160
|
+
function qn(e) {
|
|
9905
10161
|
let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
|
|
9906
10162
|
return (Math.max(t, n, r) + Math.min(t, n, r)) / 2;
|
|
9907
10163
|
}
|
|
9908
|
-
var
|
|
10164
|
+
var Jn = {
|
|
9909
10165
|
rgb: [
|
|
9910
10166
|
114,
|
|
9911
10167
|
1,
|
|
@@ -9918,7 +10174,7 @@ var Gn = {
|
|
|
9918
10174
|
225
|
|
9919
10175
|
],
|
|
9920
10176
|
symbolColorValue: "rgb(225,225,225)"
|
|
9921
|
-
},
|
|
10177
|
+
}, Yn = class {
|
|
9922
10178
|
rooms = {};
|
|
9923
10179
|
areas = {};
|
|
9924
10180
|
colors = {};
|
|
@@ -9928,7 +10184,7 @@ var Gn = {
|
|
|
9928
10184
|
for (let e of t) this.colors[e.envId] = {
|
|
9929
10185
|
rgb: e.colors,
|
|
9930
10186
|
rgbValue: `rgb(${e.colors.join(",")})`,
|
|
9931
|
-
symbolColor:
|
|
10187
|
+
symbolColor: qn(e.colors) > .41 ? [
|
|
9932
10188
|
25,
|
|
9933
10189
|
25,
|
|
9934
10190
|
25
|
|
@@ -9937,19 +10193,19 @@ var Gn = {
|
|
|
9937
10193
|
255,
|
|
9938
10194
|
255
|
|
9939
10195
|
],
|
|
9940
|
-
symbolColorValue:
|
|
10196
|
+
symbolColorValue: qn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
|
|
9941
10197
|
};
|
|
9942
10198
|
for (let [t, n] of Object.entries(e.areas)) {
|
|
9943
10199
|
let r = Number(t), i = [];
|
|
9944
10200
|
for (let t of n.rooms) {
|
|
9945
10201
|
let n = e.rooms[t];
|
|
9946
10202
|
if (!n) continue;
|
|
9947
|
-
let r =
|
|
10203
|
+
let r = Rn(t, n);
|
|
9948
10204
|
this.rooms[t] = r, i.push(r);
|
|
9949
10205
|
}
|
|
9950
10206
|
let a = e.labels?.[r] ?? [], o = e.areas[r]?.userData ?? {};
|
|
9951
|
-
for (let e of a)
|
|
9952
|
-
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)));
|
|
9953
10209
|
}
|
|
9954
10210
|
}
|
|
9955
10211
|
toRendererLabel(e, t) {
|
|
@@ -10006,10 +10262,10 @@ var Gn = {
|
|
|
10006
10262
|
return !1;
|
|
10007
10263
|
}
|
|
10008
10264
|
getColorValue(e) {
|
|
10009
|
-
return this.colors[e]?.rgbValue ??
|
|
10265
|
+
return this.colors[e]?.rgbValue ?? Jn.rgbValue;
|
|
10010
10266
|
}
|
|
10011
10267
|
getSymbolColor(e, t) {
|
|
10012
|
-
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(",");
|
|
10013
10269
|
return r === 1 ? `rgba(${i})` : `rgba(${i}, ${r})`;
|
|
10014
10270
|
}
|
|
10015
10271
|
moveRoom(e, t, n, r) {
|
|
@@ -10043,7 +10299,7 @@ var Gn = {
|
|
|
10043
10299
|
this.raw.rooms[e] = t;
|
|
10044
10300
|
let n = this.raw.areas[t.area];
|
|
10045
10301
|
n && !n.rooms.includes(e) && n.rooms.push(e);
|
|
10046
|
-
let r =
|
|
10302
|
+
let r = Rn(e, t);
|
|
10047
10303
|
this.rooms[e] = r, this.areas[t.area]?.addRoomLive(r);
|
|
10048
10304
|
}
|
|
10049
10305
|
addRooms(e) {
|
|
@@ -10052,7 +10308,7 @@ var Gn = {
|
|
|
10052
10308
|
this.raw.rooms[n] = r;
|
|
10053
10309
|
let e = this.raw.areas[r.area];
|
|
10054
10310
|
e && !e.rooms.includes(n) && e.rooms.push(n);
|
|
10055
|
-
let i =
|
|
10311
|
+
let i = Rn(n, r);
|
|
10056
10312
|
this.rooms[n] = i;
|
|
10057
10313
|
let a = t.get(r.area);
|
|
10058
10314
|
a || (a = [], t.set(r.area, a)), a.push(i);
|
|
@@ -10154,7 +10410,7 @@ var Gn = {
|
|
|
10154
10410
|
isZone: !1,
|
|
10155
10411
|
zoneAreaRef: -1,
|
|
10156
10412
|
userData: {}
|
|
10157
|
-
}, this.raw.areaNames[e] = t, this.areas[e] = new
|
|
10413
|
+
}, this.raw.areaNames[e] = t, this.areas[e] = new Kn(e, t, [], []);
|
|
10158
10414
|
}
|
|
10159
10415
|
removeArea(e) {
|
|
10160
10416
|
delete this.raw.areas[e], delete this.raw.areaNames[e], delete this.areas[e];
|
|
@@ -10182,7 +10438,7 @@ var Gn = {
|
|
|
10182
10438
|
for (let e of n) this.colors[e.envId] = {
|
|
10183
10439
|
rgb: e.colors,
|
|
10184
10440
|
rgbValue: `rgb(${e.colors.join(",")})`,
|
|
10185
|
-
symbolColor:
|
|
10441
|
+
symbolColor: qn(e.colors) > .41 ? [
|
|
10186
10442
|
25,
|
|
10187
10443
|
25,
|
|
10188
10444
|
25
|
|
@@ -10191,13 +10447,13 @@ var Gn = {
|
|
|
10191
10447
|
255,
|
|
10192
10448
|
255
|
|
10193
10449
|
],
|
|
10194
|
-
symbolColorValue:
|
|
10450
|
+
symbolColorValue: qn(e.colors) > .41 ? "rgb(25,25,25)" : "rgb(225,255,255)"
|
|
10195
10451
|
};
|
|
10196
10452
|
t === null && delete this.colors[e];
|
|
10197
10453
|
}
|
|
10198
10454
|
getLabelSnapshot(e, t) {
|
|
10199
10455
|
let n = this.raw.labels[e]?.find((e) => e.id === t);
|
|
10200
|
-
return n ?
|
|
10456
|
+
return n ? Wn(n) : null;
|
|
10201
10457
|
}
|
|
10202
10458
|
addLabel(e, t) {
|
|
10203
10459
|
this.raw.labels[e] || (this.raw.labels[e] = []);
|
|
@@ -10219,7 +10475,7 @@ var Gn = {
|
|
|
10219
10475
|
};
|
|
10220
10476
|
this.raw.labels[e].push(r);
|
|
10221
10477
|
let i = this.raw.areas[e]?.userData;
|
|
10222
|
-
i &&
|
|
10478
|
+
i && Un(r, i), this.syncRendererLabels(e);
|
|
10223
10479
|
}
|
|
10224
10480
|
removeLabel(e, t) {
|
|
10225
10481
|
if (!this.raw.labels[e]) return;
|
|
@@ -10252,14 +10508,14 @@ var Gn = {
|
|
|
10252
10508
|
if (!r) return;
|
|
10253
10509
|
r.font = { ...n };
|
|
10254
10510
|
let i = this.raw.areas[e]?.userData;
|
|
10255
|
-
i &&
|
|
10511
|
+
i && Un(r, i), this.syncRendererLabels(e);
|
|
10256
10512
|
}
|
|
10257
10513
|
setLabelOutlineColor(e, t, n) {
|
|
10258
10514
|
let r = this.raw.labels[e]?.find((e) => e.id === t);
|
|
10259
10515
|
if (!r) return;
|
|
10260
10516
|
r.outlineColor = n ? { ...n } : void 0;
|
|
10261
10517
|
let i = this.raw.areas[e]?.userData;
|
|
10262
|
-
i &&
|
|
10518
|
+
i && Un(r, i), this.syncRendererLabels(e);
|
|
10263
10519
|
}
|
|
10264
10520
|
setLabelNoScaling(e, t, n) {
|
|
10265
10521
|
let r = this.raw.labels[e]?.find((e) => e.id === t);
|
|
@@ -10290,10 +10546,10 @@ var Gn = {
|
|
|
10290
10546
|
restoreAreaWithRooms(e, t, n, r) {
|
|
10291
10547
|
let i = [];
|
|
10292
10548
|
for (let { id: e, room: t } of n) {
|
|
10293
|
-
let n =
|
|
10549
|
+
let n = Rn(e, t);
|
|
10294
10550
|
this.rooms[e] = n, i.push(n);
|
|
10295
10551
|
}
|
|
10296
|
-
this.areas[e] = new
|
|
10552
|
+
this.areas[e] = new Kn(e, t, i, []);
|
|
10297
10553
|
for (let e of r) {
|
|
10298
10554
|
let t = this.areas[e];
|
|
10299
10555
|
t && (t.rebuildExits(), t.markDirty());
|
|
@@ -10332,7 +10588,7 @@ var Gn = {
|
|
|
10332
10588
|
}
|
|
10333
10589
|
for (let e of this.getAreas()) n.has(e.getAreaId()) || e.rebuildExits();
|
|
10334
10590
|
}
|
|
10335
|
-
},
|
|
10591
|
+
}, Xn = class {
|
|
10336
10592
|
rects = /* @__PURE__ */ new Map();
|
|
10337
10593
|
layer;
|
|
10338
10594
|
unsubscribe;
|
|
@@ -10376,7 +10632,7 @@ var Gn = {
|
|
|
10376
10632
|
}
|
|
10377
10633
|
this.layer.batchDraw();
|
|
10378
10634
|
}
|
|
10379
|
-
},
|
|
10635
|
+
}, Zn = "#ffcc00", Qn = .9, $n = .3, er = .2, tr = class {
|
|
10380
10636
|
roomRect;
|
|
10381
10637
|
linkGroup;
|
|
10382
10638
|
layer;
|
|
@@ -10387,7 +10643,7 @@ var Gn = {
|
|
|
10387
10643
|
}
|
|
10388
10644
|
attach(e) {
|
|
10389
10645
|
this.layer = e, this.roomRect = new h.Rect({
|
|
10390
|
-
stroke:
|
|
10646
|
+
stroke: Zn,
|
|
10391
10647
|
strokeWidth: .06,
|
|
10392
10648
|
listening: !1,
|
|
10393
10649
|
visible: !1,
|
|
@@ -10435,23 +10691,23 @@ var Gn = {
|
|
|
10435
10691
|
}
|
|
10436
10692
|
for (let t of e.data.lines) this.linkGroup.add(new h.Line({
|
|
10437
10693
|
points: [...t.points],
|
|
10438
|
-
stroke:
|
|
10694
|
+
stroke: Zn,
|
|
10439
10695
|
strokeWidth: r,
|
|
10440
10696
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10441
10697
|
listening: !1,
|
|
10442
10698
|
lineCap: "round",
|
|
10443
|
-
opacity:
|
|
10699
|
+
opacity: Qn
|
|
10444
10700
|
}));
|
|
10445
10701
|
for (let t of e.data.arrows) this.linkGroup.add(new h.Arrow({
|
|
10446
10702
|
points: [...t.points],
|
|
10447
|
-
stroke:
|
|
10448
|
-
fill:
|
|
10703
|
+
stroke: Zn,
|
|
10704
|
+
fill: Zn,
|
|
10449
10705
|
strokeWidth: r,
|
|
10450
10706
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10451
10707
|
pointerLength: t.pointerLength,
|
|
10452
10708
|
pointerWidth: t.pointerWidth,
|
|
10453
10709
|
listening: !1,
|
|
10454
|
-
opacity:
|
|
10710
|
+
opacity: Qn
|
|
10455
10711
|
}));
|
|
10456
10712
|
this.linkGroup.visible(!0);
|
|
10457
10713
|
} else if (t.kind === "customLine") {
|
|
@@ -10462,32 +10718,32 @@ var Gn = {
|
|
|
10462
10718
|
}
|
|
10463
10719
|
let i = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
|
|
10464
10720
|
points: [...e.points],
|
|
10465
|
-
stroke:
|
|
10466
|
-
fill:
|
|
10721
|
+
stroke: Zn,
|
|
10722
|
+
fill: Zn,
|
|
10467
10723
|
strokeWidth: r,
|
|
10468
10724
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10469
|
-
pointerLength:
|
|
10470
|
-
pointerWidth:
|
|
10725
|
+
pointerLength: $n,
|
|
10726
|
+
pointerWidth: er,
|
|
10471
10727
|
listening: !1,
|
|
10472
10728
|
lineCap: "round",
|
|
10473
10729
|
lineJoin: "round",
|
|
10474
|
-
opacity:
|
|
10730
|
+
opacity: Qn
|
|
10475
10731
|
}) : new h.Line({
|
|
10476
10732
|
points: [...e.points],
|
|
10477
|
-
stroke:
|
|
10733
|
+
stroke: Zn,
|
|
10478
10734
|
strokeWidth: r,
|
|
10479
10735
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10480
10736
|
listening: !1,
|
|
10481
10737
|
lineCap: "round",
|
|
10482
10738
|
lineJoin: "round",
|
|
10483
|
-
opacity:
|
|
10739
|
+
opacity: Qn
|
|
10484
10740
|
});
|
|
10485
10741
|
this.linkGroup.add(i), this.linkGroup.visible(!0);
|
|
10486
10742
|
}
|
|
10487
10743
|
this.layer.batchDraw();
|
|
10488
10744
|
}
|
|
10489
|
-
},
|
|
10490
|
-
function
|
|
10745
|
+
}, nr = .6;
|
|
10746
|
+
function rr(e) {
|
|
10491
10747
|
for (let [t, n, r] of at) if (r === e) return {
|
|
10492
10748
|
ox: t,
|
|
10493
10749
|
oy: n
|
|
@@ -10497,7 +10753,7 @@ function er(e) {
|
|
|
10497
10753
|
oy: 0
|
|
10498
10754
|
};
|
|
10499
10755
|
}
|
|
10500
|
-
var
|
|
10756
|
+
var ir = class {
|
|
10501
10757
|
line;
|
|
10502
10758
|
dirLabel;
|
|
10503
10759
|
layer;
|
|
@@ -10544,14 +10800,14 @@ var tr = class {
|
|
|
10544
10800
|
}
|
|
10545
10801
|
let r = n.getRenderRoom(t.sourceId);
|
|
10546
10802
|
if (!r) return;
|
|
10547
|
-
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;
|
|
10548
10804
|
if (t.sourceDir) {
|
|
10549
|
-
let { ox: e, oy: n } =
|
|
10805
|
+
let { ox: e, oy: n } = rr(t.sourceDir);
|
|
10550
10806
|
o = r.x + e * a, s = r.y + n * a;
|
|
10551
10807
|
}
|
|
10552
10808
|
let c, l;
|
|
10553
10809
|
if (i && t.targetDir) {
|
|
10554
|
-
let { ox: e, oy: n } =
|
|
10810
|
+
let { ox: e, oy: n } = rr(t.targetDir);
|
|
10555
10811
|
c = i.x + e * a, l = i.y + n * a;
|
|
10556
10812
|
} else i ? (c = i.x, l = i.y) : (c = t.cursorMap?.x ?? r.x, l = t.cursorMap?.y ?? r.y);
|
|
10557
10813
|
let u = !0, d = "";
|
|
@@ -10572,7 +10828,7 @@ var tr = class {
|
|
|
10572
10828
|
l
|
|
10573
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();
|
|
10574
10830
|
}
|
|
10575
|
-
},
|
|
10831
|
+
}, ar = class {
|
|
10576
10832
|
rect;
|
|
10577
10833
|
layer;
|
|
10578
10834
|
unsubscribe;
|
|
@@ -10608,7 +10864,7 @@ var tr = class {
|
|
|
10608
10864
|
}
|
|
10609
10865
|
this.rect.x(t.x), this.rect.y(t.y), this.rect.visible(!0), this.layer.batchDraw();
|
|
10610
10866
|
}
|
|
10611
|
-
},
|
|
10867
|
+
}, or = class {
|
|
10612
10868
|
source;
|
|
10613
10869
|
target;
|
|
10614
10870
|
layer;
|
|
@@ -10686,7 +10942,7 @@ var tr = class {
|
|
|
10686
10942
|
}
|
|
10687
10943
|
this.layer.batchDraw();
|
|
10688
10944
|
}
|
|
10689
|
-
},
|
|
10945
|
+
}, sr = "rgba(255, 220, 60, 0.9)", cr = .55, lr = class {
|
|
10690
10946
|
group;
|
|
10691
10947
|
layer;
|
|
10692
10948
|
unsubscribe;
|
|
@@ -10759,14 +11015,14 @@ var tr = class {
|
|
|
10759
11015
|
if (o) {
|
|
10760
11016
|
let t = this.resolveTargetRoom(e, o.roomId, o.exitName);
|
|
10761
11017
|
if (t) {
|
|
10762
|
-
let { x: e, y: n } = t, r =
|
|
11018
|
+
let { x: e, y: n } = t, r = cr, i = new h.Line({
|
|
10763
11019
|
points: [
|
|
10764
11020
|
e - r,
|
|
10765
11021
|
n,
|
|
10766
11022
|
e + r,
|
|
10767
11023
|
n
|
|
10768
11024
|
],
|
|
10769
|
-
stroke:
|
|
11025
|
+
stroke: sr,
|
|
10770
11026
|
strokeWidth: a,
|
|
10771
11027
|
listening: !1,
|
|
10772
11028
|
lineCap: "round"
|
|
@@ -10777,7 +11033,7 @@ var tr = class {
|
|
|
10777
11033
|
e,
|
|
10778
11034
|
n + r
|
|
10779
11035
|
],
|
|
10780
|
-
stroke:
|
|
11036
|
+
stroke: sr,
|
|
10781
11037
|
strokeWidth: a,
|
|
10782
11038
|
listening: !1,
|
|
10783
11039
|
lineCap: "round"
|
|
@@ -10807,11 +11063,11 @@ var tr = class {
|
|
|
10807
11063
|
y: c.y
|
|
10808
11064
|
};
|
|
10809
11065
|
}
|
|
10810
|
-
},
|
|
10811
|
-
shadowColor:
|
|
11066
|
+
}, ur = "#00e5ff", dr = {
|
|
11067
|
+
shadowColor: ur,
|
|
10812
11068
|
shadowBlur: 4,
|
|
10813
11069
|
shadowOpacity: .8
|
|
10814
|
-
},
|
|
11070
|
+
}, fr = .3, pr = .2, mr = class {
|
|
10815
11071
|
group;
|
|
10816
11072
|
layer;
|
|
10817
11073
|
unsubscribe;
|
|
@@ -10849,22 +11105,22 @@ var tr = class {
|
|
|
10849
11105
|
}
|
|
10850
11106
|
for (let t of e.data.lines) this.group.add(new h.Line({
|
|
10851
11107
|
points: [...t.points],
|
|
10852
|
-
stroke:
|
|
11108
|
+
stroke: ur,
|
|
10853
11109
|
strokeWidth: .08,
|
|
10854
11110
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10855
11111
|
listening: !1,
|
|
10856
|
-
...
|
|
11112
|
+
...dr
|
|
10857
11113
|
}));
|
|
10858
11114
|
for (let t of e.data.arrows) this.group.add(new h.Arrow({
|
|
10859
11115
|
points: [...t.points],
|
|
10860
|
-
stroke:
|
|
10861
|
-
fill:
|
|
11116
|
+
stroke: ur,
|
|
11117
|
+
fill: ur,
|
|
10862
11118
|
strokeWidth: .08,
|
|
10863
11119
|
dash: t.dash ? [...t.dash] : void 0,
|
|
10864
11120
|
pointerLength: t.pointerLength,
|
|
10865
11121
|
pointerWidth: t.pointerWidth,
|
|
10866
11122
|
listening: !1,
|
|
10867
|
-
...
|
|
11123
|
+
...dr
|
|
10868
11124
|
}));
|
|
10869
11125
|
this.group.visible(!0), this.layer.batchDraw();
|
|
10870
11126
|
return;
|
|
@@ -10877,28 +11133,28 @@ var tr = class {
|
|
|
10877
11133
|
}
|
|
10878
11134
|
let r = e.hasArrow && e.points.length >= 4 ? new h.Arrow({
|
|
10879
11135
|
points: [...e.points],
|
|
10880
|
-
stroke:
|
|
10881
|
-
fill:
|
|
11136
|
+
stroke: ur,
|
|
11137
|
+
fill: ur,
|
|
10882
11138
|
strokeWidth: .08,
|
|
10883
11139
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10884
|
-
pointerLength:
|
|
10885
|
-
pointerWidth:
|
|
11140
|
+
pointerLength: fr,
|
|
11141
|
+
pointerWidth: pr,
|
|
10886
11142
|
listening: !1,
|
|
10887
|
-
...
|
|
11143
|
+
...dr
|
|
10888
11144
|
}) : new h.Line({
|
|
10889
11145
|
points: [...e.points],
|
|
10890
|
-
stroke:
|
|
11146
|
+
stroke: ur,
|
|
10891
11147
|
strokeWidth: .08,
|
|
10892
11148
|
dash: e.dash ? [...e.dash] : void 0,
|
|
10893
11149
|
listening: !1,
|
|
10894
|
-
...
|
|
11150
|
+
...dr
|
|
10895
11151
|
});
|
|
10896
11152
|
this.group.add(r), this.group.add(new h.Circle({
|
|
10897
11153
|
x: e.points[0],
|
|
10898
11154
|
y: e.points[1],
|
|
10899
11155
|
radius: .1,
|
|
10900
11156
|
fill: "#1a2030",
|
|
10901
|
-
stroke:
|
|
11157
|
+
stroke: ur,
|
|
10902
11158
|
strokeWidth: .04,
|
|
10903
11159
|
listening: !1
|
|
10904
11160
|
}));
|
|
@@ -10909,8 +11165,8 @@ var tr = class {
|
|
|
10909
11165
|
x: e.points[t],
|
|
10910
11166
|
y: e.points[t + 1],
|
|
10911
11167
|
radius: r ? .14 : .1,
|
|
10912
|
-
fill: r ? "#ffffff" :
|
|
10913
|
-
stroke: r ?
|
|
11168
|
+
fill: r ? "#ffffff" : ur,
|
|
11169
|
+
stroke: r ? ur : "#ffffff",
|
|
10914
11170
|
strokeWidth: r ? .06 : .04,
|
|
10915
11171
|
listening: !1
|
|
10916
11172
|
}));
|
|
@@ -10923,13 +11179,13 @@ var tr = class {
|
|
|
10923
11179
|
};
|
|
10924
11180
|
//#endregion
|
|
10925
11181
|
//#region src/editor/effects/GridOverlayEffect.ts
|
|
10926
|
-
function
|
|
11182
|
+
function hr(e, t) {
|
|
10927
11183
|
let n = e.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);
|
|
10928
11184
|
if (!n) return e;
|
|
10929
11185
|
let r = n[4] === void 0 ? 1 : parseFloat(n[4]);
|
|
10930
11186
|
return `rgba(${n[1]}, ${n[2]}, ${n[3]}, ${Math.min(1, r * t)})`;
|
|
10931
11187
|
}
|
|
10932
|
-
var
|
|
11188
|
+
var gr = class {
|
|
10933
11189
|
gridShape;
|
|
10934
11190
|
axisShape;
|
|
10935
11191
|
labelShape;
|
|
@@ -10961,7 +11217,7 @@ var pr = class {
|
|
|
10961
11217
|
}), this.axisShape = new h.Shape({
|
|
10962
11218
|
listening: !1,
|
|
10963
11219
|
visible: !1,
|
|
10964
|
-
stroke:
|
|
11220
|
+
stroke: hr(this.gridColor, 2),
|
|
10965
11221
|
strokeWidth: this.gridLineWidth * 2,
|
|
10966
11222
|
sceneFunc: (e, t) => {
|
|
10967
11223
|
let { minX: n, maxX: r, minY: i, maxY: a } = this.bounds;
|
|
@@ -10975,7 +11231,7 @@ var pr = class {
|
|
|
10975
11231
|
text: "(0,0)",
|
|
10976
11232
|
fontSize: this.gridSize,
|
|
10977
11233
|
fontFamily: "monospace",
|
|
10978
|
-
fill:
|
|
11234
|
+
fill: hr(this.gridColor, 2)
|
|
10979
11235
|
}), e.add(this.gridShape), e.add(this.axisShape), e.add(this.labelShape), this.unsubscribe = D.subscribe(() => this.syncVisibility());
|
|
10980
11236
|
}
|
|
10981
11237
|
updateViewport(e, t, n) {
|
|
@@ -10989,7 +11245,7 @@ var pr = class {
|
|
|
10989
11245
|
let e = this.getIsEmpty();
|
|
10990
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());
|
|
10991
11247
|
}
|
|
10992
|
-
},
|
|
11248
|
+
}, _r = class {
|
|
10993
11249
|
rect;
|
|
10994
11250
|
layer;
|
|
10995
11251
|
unsubscribe;
|
|
@@ -11023,7 +11279,7 @@ var pr = class {
|
|
|
11023
11279
|
};
|
|
11024
11280
|
//#endregion
|
|
11025
11281
|
//#region src/editor/effects/LabelHaloEffect.ts
|
|
11026
|
-
function
|
|
11282
|
+
function vr(e, t, n, r) {
|
|
11027
11283
|
return [
|
|
11028
11284
|
{
|
|
11029
11285
|
id: "nw",
|
|
@@ -11067,7 +11323,7 @@ function hr(e, t, n, r) {
|
|
|
11067
11323
|
}
|
|
11068
11324
|
];
|
|
11069
11325
|
}
|
|
11070
|
-
var
|
|
11326
|
+
var yr = class {
|
|
11071
11327
|
selRect;
|
|
11072
11328
|
hoverRect;
|
|
11073
11329
|
previewRect;
|
|
@@ -11157,7 +11413,7 @@ var gr = class {
|
|
|
11157
11413
|
for (let e of this.handles) e.visible(!1);
|
|
11158
11414
|
return;
|
|
11159
11415
|
}
|
|
11160
|
-
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);
|
|
11161
11417
|
for (let e = 0; e < this.handles.length; e++) {
|
|
11162
11418
|
let t = this.handles[e], n = s[e];
|
|
11163
11419
|
t.x(n.x - o / 2), t.y(n.y - o / 2), t.width(o), t.height(o), t.visible(!0);
|
|
@@ -11176,7 +11432,7 @@ var gr = class {
|
|
|
11176
11432
|
} else this.previewRect.visible(!1);
|
|
11177
11433
|
this.layer.batchDraw();
|
|
11178
11434
|
}
|
|
11179
|
-
},
|
|
11435
|
+
}, br = class {
|
|
11180
11436
|
hLine;
|
|
11181
11437
|
vLine;
|
|
11182
11438
|
dot;
|
|
@@ -11265,11 +11521,11 @@ var gr = class {
|
|
|
11265
11521
|
};
|
|
11266
11522
|
//#endregion
|
|
11267
11523
|
//#region src/editor/effects/GhostRoomsEffect.ts
|
|
11268
|
-
function
|
|
11524
|
+
function xr(e, t) {
|
|
11269
11525
|
let n = e.match(/\d+/g);
|
|
11270
11526
|
return !n || n.length < 3 ? `rgba(128, 128, 128, ${t})` : `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${t})`;
|
|
11271
11527
|
}
|
|
11272
|
-
var
|
|
11528
|
+
var Sr = class {
|
|
11273
11529
|
rects = /* @__PURE__ */ new Map();
|
|
11274
11530
|
layer;
|
|
11275
11531
|
unsubscribe;
|
|
@@ -11323,7 +11579,7 @@ var yr = class {
|
|
|
11323
11579
|
for (let [e, t] of this.rects) n.has(e) || (t.destroy(), this.rects.delete(e));
|
|
11324
11580
|
let r = .05, i = this.roomSize + r * 2;
|
|
11325
11581
|
for (let [e, a] of n) {
|
|
11326
|
-
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);
|
|
11327
11583
|
l || (l = new h.Rect({
|
|
11328
11584
|
strokeWidth: this.strokeWidth,
|
|
11329
11585
|
dash: [...this.dash],
|
|
@@ -11336,7 +11592,7 @@ var yr = class {
|
|
|
11336
11592
|
};
|
|
11337
11593
|
//#endregion
|
|
11338
11594
|
//#region src/editor/pointerController.ts
|
|
11339
|
-
function
|
|
11595
|
+
function Cr(e) {
|
|
11340
11596
|
let { container: t } = e, n = null, r = null, i = D.getState().spaceHeld, a = D.subscribe((r) => {
|
|
11341
11597
|
if (!i && r.spaceHeld && n !== null) {
|
|
11342
11598
|
Ft[r.activeTool].onCancel?.(e);
|
|
@@ -11402,10 +11658,10 @@ function br(e) {
|
|
|
11402
11658
|
}
|
|
11403
11659
|
//#endregion
|
|
11404
11660
|
//#region src/editor/scene.ts
|
|
11405
|
-
function
|
|
11661
|
+
function wr(e, t) {
|
|
11406
11662
|
let n = m();
|
|
11407
11663
|
n.gridEnabled = !0, n.highlightCurrentRoom = !1, n.areaName = !1, n.labelRenderMode = "image", t.dataset.editorCursor = "true";
|
|
11408
|
-
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, () => {
|
|
11409
11665
|
let e = D.getState();
|
|
11410
11666
|
if (e.currentAreaId == null) return !1;
|
|
11411
11667
|
let t = r.getArea(e.currentAreaId);
|
|
@@ -11435,7 +11691,7 @@ function xr(e, t) {
|
|
|
11435
11691
|
}
|
|
11436
11692
|
};
|
|
11437
11693
|
a.current = b;
|
|
11438
|
-
let x =
|
|
11694
|
+
let x = Cr({
|
|
11439
11695
|
renderer: i,
|
|
11440
11696
|
container: t,
|
|
11441
11697
|
settings: n,
|
|
@@ -11446,12 +11702,12 @@ function xr(e, t) {
|
|
|
11446
11702
|
}
|
|
11447
11703
|
//#endregion
|
|
11448
11704
|
//#region src/App.tsx
|
|
11449
|
-
var
|
|
11705
|
+
var Tr = {
|
|
11450
11706
|
top: 104,
|
|
11451
11707
|
right: 464,
|
|
11452
11708
|
bottom: 24,
|
|
11453
11709
|
left: 24
|
|
11454
|
-
},
|
|
11710
|
+
}, Er = {
|
|
11455
11711
|
1: "select",
|
|
11456
11712
|
2: "connect",
|
|
11457
11713
|
3: "unlink",
|
|
@@ -11460,7 +11716,7 @@ var Sr = {
|
|
|
11460
11716
|
6: "delete",
|
|
11461
11717
|
7: "pan",
|
|
11462
11718
|
8: "paint"
|
|
11463
|
-
},
|
|
11719
|
+
}, Dr = {
|
|
11464
11720
|
ArrowLeft: {
|
|
11465
11721
|
dx: -1,
|
|
11466
11722
|
dy: 0
|
|
@@ -11478,7 +11734,7 @@ var Sr = {
|
|
|
11478
11734
|
dy: -1
|
|
11479
11735
|
}
|
|
11480
11736
|
};
|
|
11481
|
-
function
|
|
11737
|
+
function Or({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
11482
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]);
|
|
11483
11739
|
t(() => {
|
|
11484
11740
|
D.setState({ pluginSwatchSets: F });
|
|
@@ -11494,17 +11750,17 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11494
11750
|
else if (e && !l) for (let e of a) e.onMapClosed?.();
|
|
11495
11751
|
}, [l]), t(() => {
|
|
11496
11752
|
if (!l || !s.current) return;
|
|
11497
|
-
let e =
|
|
11753
|
+
let e = wr(l, s.current);
|
|
11498
11754
|
c.current = e;
|
|
11499
11755
|
let { currentAreaId: t, currentZ: n } = D.getState();
|
|
11500
|
-
return t != null && e.setArea(t, n,
|
|
11756
|
+
return t != null && e.setArea(t, n, Tr), () => {
|
|
11501
11757
|
e.destroy(), c.current = null;
|
|
11502
11758
|
};
|
|
11503
11759
|
}, [l]), t(() => {
|
|
11504
11760
|
let e = c.current;
|
|
11505
11761
|
if (!e || !m || h == null) return;
|
|
11506
11762
|
let t = D.getState().navigateTo;
|
|
11507
|
-
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);
|
|
11508
11764
|
}, [
|
|
11509
11765
|
h,
|
|
11510
11766
|
g,
|
|
@@ -11549,7 +11805,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11549
11805
|
let { map: e, loaded: t, undo: n, currentAreaId: r, currentZ: i, sessionId: a } = D.getState();
|
|
11550
11806
|
if (!e || !t) return;
|
|
11551
11807
|
let o = setTimeout(() => {
|
|
11552
|
-
|
|
11808
|
+
Cn(t.fileName, e, n, r, i, a ?? void 0).then((e) => {
|
|
11553
11809
|
a || D.setState({ sessionId: e });
|
|
11554
11810
|
}).catch(console.error);
|
|
11555
11811
|
}, 1500);
|
|
@@ -11603,13 +11859,13 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11603
11859
|
return;
|
|
11604
11860
|
}
|
|
11605
11861
|
if (t.key === "f" || t.key === "F") {
|
|
11606
|
-
c.current?.renderer.fitArea(
|
|
11862
|
+
c.current?.renderer.fitArea(Tr);
|
|
11607
11863
|
return;
|
|
11608
11864
|
}
|
|
11609
|
-
if (
|
|
11865
|
+
if (Er[t.key]) {
|
|
11610
11866
|
let e = D.getState();
|
|
11611
11867
|
e.pending?.kind === "customLine" && c.current && (Ot(e.pending, c.current), D.bumpData()), D.setState({
|
|
11612
|
-
activeTool:
|
|
11868
|
+
activeTool: Er[t.key],
|
|
11613
11869
|
pending: null
|
|
11614
11870
|
});
|
|
11615
11871
|
return;
|
|
@@ -11625,14 +11881,14 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11625
11881
|
} });
|
|
11626
11882
|
return;
|
|
11627
11883
|
}
|
|
11628
|
-
if (
|
|
11884
|
+
if (Dr[t.key]) {
|
|
11629
11885
|
let e = D.getState();
|
|
11630
11886
|
if (e.activeTool !== "select" || !e.selection || !e.map) return;
|
|
11631
11887
|
if (e.selection.kind === "label") {
|
|
11632
11888
|
let { id: n, areaId: r } = e.selection, i = c.current?.reader.getLabelSnapshot(r, n);
|
|
11633
11889
|
if (!i) return;
|
|
11634
11890
|
t.preventDefault();
|
|
11635
|
-
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 = [
|
|
11636
11892
|
i.pos[0] + s,
|
|
11637
11893
|
i.pos[1] + l,
|
|
11638
11894
|
i.pos[2]
|
|
@@ -11651,7 +11907,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11651
11907
|
}
|
|
11652
11908
|
if (e.selection.kind !== "room") return;
|
|
11653
11909
|
t.preventDefault();
|
|
11654
|
-
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 = [];
|
|
11655
11911
|
for (let t of e.selection.ids) {
|
|
11656
11912
|
let n = e.map.rooms[t];
|
|
11657
11913
|
if (!n) continue;
|
|
@@ -11689,7 +11945,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11689
11945
|
}
|
|
11690
11946
|
};
|
|
11691
11947
|
window.addEventListener("keydown", r), window.addEventListener("keyup", t), window.addEventListener("blur", n);
|
|
11692
|
-
let i = () => c.current?.renderer.fitArea(
|
|
11948
|
+
let i = () => c.current?.renderer.fitArea(Tr);
|
|
11693
11949
|
return window.addEventListener("editor:undo", z), window.addEventListener("editor:redo", B), window.addEventListener("editor:fit", i), () => {
|
|
11694
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);
|
|
11695
11951
|
};
|
|
@@ -11867,7 +12123,7 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11867
12123
|
ref: s,
|
|
11868
12124
|
className: "map-container"
|
|
11869
12125
|
}),
|
|
11870
|
-
!m && /* @__PURE__ */ d(
|
|
12126
|
+
!m && /* @__PURE__ */ d(Mn, {}),
|
|
11871
12127
|
/* @__PURE__ */ d(ue, {
|
|
11872
12128
|
title: o,
|
|
11873
12129
|
onHelpClick: () => E(!0),
|
|
@@ -11877,15 +12133,15 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11877
12133
|
},
|
|
11878
12134
|
onSearchClick: () => M((e) => !e)
|
|
11879
12135
|
}),
|
|
11880
|
-
/* @__PURE__ */ d(
|
|
12136
|
+
/* @__PURE__ */ d(gn, {
|
|
11881
12137
|
sceneRef: c,
|
|
11882
12138
|
extraTabs: I,
|
|
11883
12139
|
pluginRoomSections: L
|
|
11884
12140
|
})
|
|
11885
12141
|
]
|
|
11886
12142
|
}),
|
|
11887
|
-
/* @__PURE__ */ d(
|
|
11888
|
-
p && /* @__PURE__ */ d(
|
|
12143
|
+
/* @__PURE__ */ d(_n, { sceneRef: c }),
|
|
12144
|
+
p && /* @__PURE__ */ d(Nn, { sceneRef: c }),
|
|
11889
12145
|
a.map((t, n) => /* @__PURE__ */ d(e, { children: t.renderOverlay?.() }, n)),
|
|
11890
12146
|
j && m && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
|
|
11891
12147
|
style: {
|
|
@@ -11894,8 +12150,8 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11894
12150
|
zIndex: 399
|
|
11895
12151
|
},
|
|
11896
12152
|
onMouseDown: () => M(!1)
|
|
11897
|
-
}), /* @__PURE__ */ d(
|
|
11898
|
-
/* @__PURE__ */ d(
|
|
12153
|
+
}), /* @__PURE__ */ d(Fn, { onClose: () => M(!1) })] }),
|
|
12154
|
+
/* @__PURE__ */ d(In, { sceneRef: c }),
|
|
11899
12155
|
T && /* @__PURE__ */ d(le, { onClose: () => E(!1) }),
|
|
11900
12156
|
(k || N) && /* @__PURE__ */ d(de, {
|
|
11901
12157
|
initialUrl: N ?? void 0,
|
|
@@ -11908,9 +12164,9 @@ function Tr({ plugins: a = [], title: o = "Mudlet Map Editor" }) {
|
|
|
11908
12164
|
}
|
|
11909
12165
|
//#endregion
|
|
11910
12166
|
//#region src/editor/mapBytes.ts
|
|
11911
|
-
function
|
|
12167
|
+
function kr() {
|
|
11912
12168
|
let { map: e } = D.getState();
|
|
11913
12169
|
return e ? H(e) : null;
|
|
11914
12170
|
}
|
|
11915
12171
|
//#endregion
|
|
11916
|
-
export {
|
|
12172
|
+
export { Or as App, kr as getMapBytes, G as loadUrlIntoStore, Y as pushCommand, D as store, O as useEditorState };
|