thêm phần paths
Some checks failed
Test / test (push) Has been cancelled

This commit is contained in:
2026-06-23 17:51:54 +07:00
parent 50a2587cef
commit 2ce8a23ce9
25 changed files with 1411 additions and 31 deletions

View File

@@ -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() {