feat: 添加锁定图标更新功能,优化存储位置服务以同步锁定状态
This commit is contained in:
parent
b55dae256f
commit
8ab88e9818
2
public/icons/lock.svg
Normal file
2
public/icons/lock.svg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 17a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2 2 2 0 0 0 2 2m6-9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2h1V6a5 5 0 0 1 10 0v2h1m-6-4a3 3 0 0 0-3 3v2h6V6a3 3 0 0 0-3-3Z"/></svg>
|
||||||
|
EOF < /dev/null
|
After Width: | Height: | Size: 308 B |
@ -632,6 +632,39 @@ export class EditorService extends Meta2d {
|
|||||||
this.updatePen(pointId, { statusStyle: color }, false);
|
this.updatePen(pointId, { statusStyle: color }, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updatePointLockIcon(pointId: string, show: boolean): void {
|
||||||
|
const pointPen = this.getPenById(pointId);
|
||||||
|
if (!pointPen || pointPen.name !== 'point') return;
|
||||||
|
|
||||||
|
const lockIconId = `lock-icon-${pointId}`;
|
||||||
|
const existingIcon = this.getPenById(lockIconId);
|
||||||
|
|
||||||
|
if (show) {
|
||||||
|
if (existingIcon) {
|
||||||
|
this.setValue({ id: lockIconId, visible: true }, { render: true, history: false, doEvent: false });
|
||||||
|
} else {
|
||||||
|
const { x = 0, y = 0, width = 0 } = this.getPenRect(pointPen);
|
||||||
|
const iconPen: MapPen = {
|
||||||
|
id: lockIconId,
|
||||||
|
name: 'image',
|
||||||
|
tags: ['lock-icon'],
|
||||||
|
x: x - width / 2 - 20, // 在点左侧显示
|
||||||
|
y: y - 10,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
image: '/icons/lock.svg',
|
||||||
|
locked: LockState.Disable,
|
||||||
|
visible: true,
|
||||||
|
};
|
||||||
|
this.addPen(iconPen, false, false, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (existingIcon) {
|
||||||
|
this.setValue({ id: lockIconId, visible: false }, { render: true, history: false, doEvent: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//#region 实时机器人
|
//#region 实时机器人
|
||||||
public async initRobots(): Promise<void> {
|
public async initRobots(): Promise<void> {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -90,10 +90,15 @@ export class StorageLocationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allOccupied = locations.every((loc) => loc.is_occupied);
|
const allOccupied = locations.every((loc) => loc.is_occupied);
|
||||||
const color = allOccupied ? '#ff4d4f' : '#52c41a'; // 全部占用红色,否则绿色
|
const allLocked = locations.every((loc) => loc.is_locked);
|
||||||
|
|
||||||
// 通知编辑器更新点的边框颜色
|
const color = allOccupied ? '#ff4d4f' : '#52c41a'; // 占用红色,否则绿色
|
||||||
|
|
||||||
|
// 更新边框颜色
|
||||||
this.editor?.updatePointBorderColor(pointId, color);
|
this.editor?.updatePointBorderColor(pointId, color);
|
||||||
|
|
||||||
|
// 更新锁定图标状态
|
||||||
|
this.editor?.updatePointLockIcon(pointId, allLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user