This commit is contained in:
24
www/maps.js
24
www/maps.js
@@ -301,6 +301,7 @@
|
||||
}
|
||||
window.MapEditorApp?.open?.(mapId, {
|
||||
readOnly: opts.readOnly,
|
||||
pathPreview: opts.pathPreview || null,
|
||||
onMapUpdated: (updated) => {
|
||||
const idx = store.maps.findIndex((m) => m.id === updated.id);
|
||||
if (idx >= 0) store.maps[idx] = updated;
|
||||
@@ -326,6 +327,18 @@
|
||||
});
|
||||
}
|
||||
|
||||
function openEditorWithPath(path) {
|
||||
if (!path?.map_id) return;
|
||||
openEditor(path.map_id, {
|
||||
readOnly: !canWrite(),
|
||||
pathPreview: {
|
||||
points: Array.isArray(path.points) ? path.points : [],
|
||||
fromPositionId: path.from_position_id,
|
||||
toPositionId: path.to_position_id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function confirmDeleteMap(map) {
|
||||
return new Promise((resolve) => {
|
||||
deleteDialogResolve = resolve;
|
||||
@@ -554,8 +567,16 @@
|
||||
Array.isArray(result.maps) ? result.maps.length : 0,
|
||||
Array.isArray(result.io_modules) ? result.io_modules.length : 0,
|
||||
Array.isArray(result.transitions) ? result.transitions.length : 0,
|
||||
Array.isArray(result.paths) ? result.paths.length : 0,
|
||||
];
|
||||
alert(t("maps.importSuccess", { maps: counts[0], io: counts[1], transitions: counts[2] }));
|
||||
alert(
|
||||
t("maps.importSuccess", {
|
||||
maps: counts[0],
|
||||
io: counts[1],
|
||||
transitions: counts[2],
|
||||
paths: counts[3],
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
alert(e.message);
|
||||
}
|
||||
@@ -659,6 +680,7 @@
|
||||
getMaps: () => [...store.maps],
|
||||
getMapById: findMap,
|
||||
activateMap,
|
||||
openEditorWithPath,
|
||||
};
|
||||
|
||||
function boot() {
|
||||
|
||||
Reference in New Issue
Block a user