1
This commit is contained in:
@ -54,10 +54,10 @@ export class AppDropZone {
|
||||
|
||||
/**
|
||||
* 生成放置区域
|
||||
* @param divisions 分割数量(必传)
|
||||
* @param divisions 可选的统一分割数量,如果不传则使用每个墙面自己的 divisions
|
||||
* @param config 配置参数(可选,如果不传则使用 setData 设置的数据)
|
||||
*/
|
||||
generateDropZones(divisions: number, config?: DropZoneConfig): PlacementZoneInfo[] {
|
||||
generateDropZones(divisions?: number, config?: DropZoneConfig): PlacementZoneInfo[] {
|
||||
const finalConfig = config || this.dropZoneConfig;
|
||||
|
||||
if (!finalConfig) {
|
||||
@ -65,12 +65,13 @@ export class AppDropZone {
|
||||
return [];
|
||||
}
|
||||
|
||||
// 为所有墙面设置分割数,同时保留其他配置属性
|
||||
// 为墙面设置分割数
|
||||
const configWithDivisions: DropZoneConfig = {
|
||||
...finalConfig, // 保留所有配置属性(color, alpha, thickness, showBorder, borderColor)
|
||||
walls: finalConfig.walls.map(wall => ({
|
||||
...wall,
|
||||
divisions: divisions
|
||||
// 如果传入了统一的 divisions,使用它;否则使用墙面自己的 divisions;都没有则默认为 1
|
||||
divisions: divisions !== undefined ? divisions : (wall.divisions || 1)
|
||||
}))
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user