去掉console

This commit is contained in:
2026-06-05 20:59:35 +08:00
parent a0d79cbfe3
commit b1f619083b
3 changed files with 38 additions and 76 deletions

View File

@ -35,6 +35,11 @@ export class AppDropZone {
// 存储原始墙面配置(用于 updateDivisions 时恢复完整墙面列表)
private originalWalls: WallConfig[] = [];
// 存储所有墙面的区域数据(持久化,不会被覆盖)
private allWallZonesData: Map<string, PlacementZoneInfo[]> = new Map();
// 当前激活显示的墙面名称集合(用于控制显示)
private activeWallNames: Set<string> = new Set();
constructor(scene: Scene) {
this.scene = scene;
this.placementWall = new AppPlacementWall(scene);
@ -93,24 +98,7 @@ export class AppDropZone {
return this.placementWall.generatePlacementAreas(configWithDivisions);
}
/**
* 更新墙面分割数并重新生成放置区域
* @param divisions 分割数数组,每个元素包含 name墙面名称或方向标识和 divisions分割数
* @example
* // 方式1精确匹配墙面名称推荐
* updateDivisions([
* { name: "前1", divisions: 1 },
* { name: "前2", divisions: 2 },
* { name: "左", divisions: 3 },
* { name: "右", divisions: 4 }
* ])
*
* // 方式2模糊匹配方向兼容旧版
* updateDivisions([
* { name: "前", divisions: 4 },
* { name: "后", divisions: 1 }
* ])
*/
updateDivisions(divisions: Array<{ name: string; divisions: number }>): PlacementZoneInfo[] {
if (!this.dropZoneConfig) {
console.error('未设置放置区域配置数据,请先调用 setData');
@ -201,10 +189,6 @@ export class AppDropZone {
}
});
keysToDelete.forEach(key => this.zoneModelMap.delete(key));
if (modelsToUnload.length > 0) {
console.log(`已卸载墙面 ${wallName}${modelsToUnload.length} 个模型`);
}
}
/**
@ -218,7 +202,6 @@ export class AppDropZone {
// 检查分割数是否改变
if (modelDivisions !== undefined && currentDivisions !== undefined && modelDivisions !== currentDivisions) {
// 分割数改变了,清空该墙面的所有旧模型
console.log(`墙面 ${wallName} 分割数从 ${modelDivisions} 改为 ${currentDivisions},清空旧模型`);
this.unloadWallModels(wallName);
// 更新该墙面模型对应的分割数
this.wallModelDivisionsMap.set(wallName, currentDivisions);
@ -226,7 +209,6 @@ export class AppDropZone {
// 分割数没变,检查该区域是否已有模型(替换逻辑)
const existingModelId = this.zoneModelMap.get(zoneKey);
if (existingModelId && this.appModel) {
console.log(`区域 ${zoneKey} 已有模型 ${existingModelId},将替换为 ${modelId}`);
this.appModel.removeByName(existingModelId);
}
}
@ -238,7 +220,7 @@ export class AppDropZone {
// 记录新模型
this.zoneModelMap.set(zoneKey, modelId);
console.log(`已记录模型 ${modelId} 到区域 ${zoneKey}`);
// 检查该墙面是否已满,如果满了则自动排列
this.checkAndAutoArrange(wallName);
@ -249,7 +231,7 @@ export class AppDropZone {
* @param modelId 被删除的模型ID
*/
notifyModelRemoved(modelId: string): void {
console.log(`[模型删除通知] 模型 ${modelId} 被删除`);
// 找到该模型所在的墙面和索引
let removedWallName: string | null = null;
@ -298,11 +280,12 @@ export class AppDropZone {
// 如果墙面不满,重新启用所有模型的拖拽
if (placedCount < currentDivisions) {
console.log(`[拖拽检查] 墙面 ${wallName} 未满,重新启用拖拽`);
placedModelIds.forEach(modelId => {
if (this.mainApp && this.mainApp.appModelDrag && typeof this.mainApp.appModelDrag.setDragEnabled === 'function') {
this.mainApp.appModelDrag.setDragEnabled(modelId, true);
console.log(`[拖拽检查] ✓ 已启用模型 ${modelId} 的拖拽功能`);
}
});
}
@ -354,8 +337,6 @@ export class AppDropZone {
// 如果该墙面已满(放置数量等于分割数),执行自动排列
if (placedCount === currentDivisions) {
this.autoArrangeWall(wallName);
} else {
console.log(`[自动排列检查] 墙面 ${wallName} 未满,不执行自动排列`);
}
}
@ -369,7 +350,7 @@ export class AppDropZone {
const wallZones = this.getZonesByWall(wallName);
if (!wallZones.length) {
console.log(`[自动排列] 墙面 ${wallName} 没有放置区域,退出`);
return;
}
@ -383,7 +364,7 @@ export class AppDropZone {
modelId: modelId,
currentIndex: currentIndex
});
console.log(`[自动排列] 找到模型: ${modelId}, 当前索引: ${currentIndex}`);
}
});
@ -480,9 +461,9 @@ export class AppDropZone {
* 显示所有放置区域
*/
show(): void {
this.placementWall.show();
// 禁用所有已放置模型的拾取
this.setModelsPickable(false);
// this.placementWall.show();
// // 禁用所有已放置模型的拾取
// this.setModelsPickable(false);
}
/**