删除console.log
This commit is contained in:
@ -132,11 +132,9 @@ export class AppDropZone {
|
||||
|
||||
// 精确匹配提取出的简短名称
|
||||
if (divisionsMap[wallShortName] !== undefined) {
|
||||
console.log(`墙面 "${wallName}" 通过简短名称 "${wallShortName}" 精确匹配到分割数: ${divisionsMap[wallShortName]}`);
|
||||
return divisionsMap[wallShortName];
|
||||
}
|
||||
|
||||
console.log(`墙面 "${wallName}" 未匹配到任何分割数配置`);
|
||||
return null;
|
||||
};
|
||||
|
||||
@ -150,7 +148,6 @@ export class AppDropZone {
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log(`墙面 "${wall.name}" 匹配到分割数: ${newDivisions}`);
|
||||
|
||||
return {
|
||||
...wall,
|
||||
@ -272,7 +269,6 @@ export class AppDropZone {
|
||||
if (removedZoneKey) {
|
||||
// 从映射中删除
|
||||
this.zoneModelMap.delete(removedZoneKey);
|
||||
console.log(`[模型删除通知] 已从映射中删除: ${removedZoneKey}`);
|
||||
}
|
||||
|
||||
if (removedWallName) {
|
||||
@ -299,7 +295,6 @@ export class AppDropZone {
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`[拖拽检查] 墙面 ${wallName} 当前模型数: ${placedCount}/${currentDivisions}`);
|
||||
|
||||
// 如果墙面不满,重新启用所有模型的拖拽
|
||||
if (placedCount < currentDivisions) {
|
||||
@ -339,10 +334,8 @@ export class AppDropZone {
|
||||
*/
|
||||
private checkAndAutoArrange(wallName: string): void {
|
||||
const currentDivisions = this.wallDivisionsMap.get(wallName);
|
||||
console.log(`[自动排列检查] 墙面: ${wallName}, 分割数: ${currentDivisions}`);
|
||||
|
||||
if (!currentDivisions) {
|
||||
console.log(`[自动排列检查] 墙面 ${wallName} 没有分割数配置,跳过`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -356,12 +349,10 @@ export class AppDropZone {
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`[自动排列检查] 墙面 ${wallName} 已放置模型数: ${placedCount}/${currentDivisions}`);
|
||||
console.log(`[自动排列检查] 已放置的模型:`, placedModels);
|
||||
|
||||
|
||||
// 如果该墙面已满(放置数量等于分割数),执行自动排列
|
||||
if (placedCount === currentDivisions) {
|
||||
console.log(`[自动排列] 墙面 ${wallName} 已满(${placedCount}/${currentDivisions}),开始执行自动排列`);
|
||||
this.autoArrangeWall(wallName);
|
||||
} else {
|
||||
console.log(`[自动排列检查] 墙面 ${wallName} 未满,不执行自动排列`);
|
||||
@ -373,11 +364,9 @@ export class AppDropZone {
|
||||
* @param wallName 墙面名称
|
||||
*/
|
||||
private autoArrangeWall(wallName: string): void {
|
||||
console.log(`[自动排列] 开始排列墙面: ${wallName}`);
|
||||
|
||||
// 获取该墙面的所有放置区域
|
||||
const wallZones = this.getZonesByWall(wallName);
|
||||
console.log(`[自动排列] 墙面 ${wallName} 的放置区域数量: ${wallZones.length}`);
|
||||
|
||||
if (!wallZones.length) {
|
||||
console.log(`[自动排列] 墙面 ${wallName} 没有放置区域,退出`);
|
||||
@ -398,15 +387,12 @@ export class AppDropZone {
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`[自动排列] 收集到 ${placedModels.length} 个模型`);
|
||||
|
||||
// 按当前索引排序
|
||||
placedModels.sort((a, b) => a.currentIndex - b.currentIndex);
|
||||
console.log(`[自动排列] 排序后的模型顺序:`, placedModels.map(m => `${m.modelId}(索引${m.currentIndex})`));
|
||||
|
||||
// 重新排列:将模型按顺序放置到 0, 1, 2... 的位置
|
||||
placedModels.forEach((model, newIndex) => {
|
||||
console.log(`[自动排列] 处理模型 ${model.modelId}: 当前索引=${model.currentIndex}, 目标索引=${newIndex}`);
|
||||
|
||||
// 获取目标放置区域
|
||||
const targetZone = wallZones[newIndex];
|
||||
@ -424,12 +410,6 @@ export class AppDropZone {
|
||||
const targetDirection = targetZone.normal.scale(-1);
|
||||
const angle = Math.atan2(targetDirection.x, targetDirection.z);
|
||||
|
||||
console.log(`[自动排列] 目标区域 ${newIndex} 的位置:`, {
|
||||
center: targetZone.center,
|
||||
normal: targetZone.normal,
|
||||
targetPosition: targetPosition,
|
||||
rotation: angle * 180 / Math.PI
|
||||
});
|
||||
|
||||
// 移动模型到新位置
|
||||
const meshes = this.appModel.getCachedMeshes(model.modelId);
|
||||
@ -442,7 +422,6 @@ export class AppDropZone {
|
||||
// 更新旋转
|
||||
rootMesh.rotation.y = angle;
|
||||
|
||||
console.log(`[自动排列] ✓ 模型 ${model.modelId} 已移动到索引 ${newIndex} 的位置`);
|
||||
} else {
|
||||
console.warn(`[自动排列] ✗ 找不到模型 ${model.modelId} 的网格`);
|
||||
}
|
||||
@ -453,24 +432,20 @@ export class AppDropZone {
|
||||
const newKey = `${wallName}[${newIndex}]`;
|
||||
this.zoneModelMap.delete(oldKey);
|
||||
this.zoneModelMap.set(newKey, model.modelId);
|
||||
console.log(`[自动排列] 更新映射: ${oldKey} -> ${newKey}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 禁用该墙面所有模型的拖拽功能
|
||||
console.log(`[自动排列] 开始禁用拖拽功能`);
|
||||
placedModels.forEach(model => {
|
||||
// 安全检查:确保 mainApp 和 appModelDrag 都存在
|
||||
if (this.mainApp && this.mainApp.appModelDrag && typeof this.mainApp.appModelDrag.setDragEnabled === 'function') {
|
||||
this.mainApp.appModelDrag.setDragEnabled(model.modelId, false);
|
||||
console.log(`[自动排列] ✓ 已禁用模型 ${model.modelId} 的拖拽功能`);
|
||||
} else {
|
||||
console.warn(`[自动排列] ✗ 无法禁用模型 ${model.modelId} 的拖拽功能:appModelDrag 未初始化`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`[自动排列] 墙面 ${wallName} 自动排列完成`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user