This commit is contained in:
xudan 2025-06-08 19:01:20 +08:00
commit f4136aaee6
4 changed files with 11 additions and 26 deletions

View File

@ -8,7 +8,7 @@ const enum API {
= '/robot/register',
= '/robot/seizeByIds',
= 'robot/syncByGroupId',
= '/robot/syncByGroupId',
}
export async function getAllRobots(): Promise<Array<RobotInfo>> {

View File

@ -52,24 +52,6 @@ onMounted(async () => {
await readScene();
await editor.value?.initRobots();
await monitorScene();
// const id = 'mock-robot-1';
// let x = 800;
// let y = 500;
// const active = true;
// const angle = -90;
// const path = <[number, number][]>[
// [600, 500],
// [100, 400],
// ];
// editor.value?.refreshRobot(id, { x, y, active, angle, path });
// const test = () =>
// requestAnimationFrame(() => {
// x -= 0.1;
// editor.value?.refreshRobot(id, { x, y });
// test();
// });
// test();
});
onUnmounted(() => {
client.value?.close();

View File

@ -230,6 +230,9 @@ export class EditorService extends Meta2d {
const robot = this.getRobotById(id);
if (isNil(robot)) return;
this.#robotMap.set(id, { ...robot, ...value });
if (value.label) {
this.setValue({ id, text: value.label }, { render: true, history: false, doEvent: false });
}
(<SceneData>this.store.data).robots = [...this.#robotMap.values()];
}
@ -401,7 +404,7 @@ export class EditorService extends Meta2d {
): Required<Pick<MapPen, 'image' | 'iconWidth' | 'iconHeight' | 'iconTop'>> {
const theme = this.data().theme;
const image =
import.meta.env.BASE_URL + active ? `/robot/${type}-active-${theme}.png` : `/robot/${type}-${theme}.png`;
import.meta.env.BASE_URL + (active ? `/robot/${type}-active-${theme}.png` : `/robot/${type}-${theme}.png`);
return { image, iconWidth: 34, iconHeight: 54, iconTop: -5 };
}
//#endregion

View File

@ -48,12 +48,12 @@ export default ({ mode }: Record<string, unknown>) =>
rewrite: (path) => path.replace(/^\/api/, ''),
changeOrigin: true,
},
// '/ws/': {
// target: 'ws://82.157.33.186:26981/jeecg-boot',
// rewrite: (path) => path.replace(/^\/ws/, ''),
// changeOrigin: true,
// ws: true,
// },
'/ws/': {
target: 'ws://82.156.39.91:18080/jeecg-boot',
rewrite: (path) => path.replace(/^\/ws/, ''),
changeOrigin: true,
ws: true,
},
},
},
});