feat(editor): 优化编辑器UI和改进核心功能 (#234)

* feat(editor): 优化编辑器UI和改进核心功能

* feat(editor): 优化编辑器UI和改进核心功能
This commit is contained in:
YHH
2025-11-23 21:45:10 +08:00
committed by GitHub
parent 4d95a7f044
commit 32460ac133
38 changed files with 2201 additions and 485 deletions

View File

@@ -253,6 +253,27 @@ export class EntityList {
}
}
/**
* 重新排序实体
* @param entityId 要移动的实体ID
* @param newIndex 新的索引位置
*/
public reorderEntity(entityId: number, newIndex: number): void {
const entity = this._idToEntity.get(entityId);
if (!entity) return;
const currentIndex = this.buffer.indexOf(entity);
if (currentIndex === -1 || currentIndex === newIndex) return;
// 限制索引范围
const clampedIndex = Math.max(0, Math.min(newIndex, this.buffer.length - 1));
// 从当前位置移除
this.buffer.splice(currentIndex, 1);
// 插入到新位置
this.buffer.splice(clampedIndex, 0, entity);
}
/**
* 获取实体列表的统计信息
* @returns 统计信息