1
This commit is contained in:
62
index.html
62
index.html
@ -509,13 +509,14 @@
|
||||
if (result.code === 200) {
|
||||
console.log(result.data);
|
||||
sku = currentText;
|
||||
const { enable_placement_zone,wall_divisions } = result.data;
|
||||
await initPlacementZoneConfig();
|
||||
const { enable_placement_zone, wall_divisions } = result.data;
|
||||
// const {position_x, position_y, position_z} = data;
|
||||
if (enable_placement_zone && wall_divisions != undefined) {
|
||||
// await initPlacementZoneConfig(placement_zone);
|
||||
|
||||
console.log(wall_divisions);
|
||||
|
||||
await placementWall(wall_divisions);
|
||||
// await placementWall(wall_divisions);
|
||||
}
|
||||
}
|
||||
|
||||
@ -798,8 +799,8 @@
|
||||
});
|
||||
|
||||
// 初始化放置区域配置数据(只需设置一次)
|
||||
const initPlacementZoneConfig = (placement_zone) => {
|
||||
const { alpha, border_color, color, show_border, thickness, walls } = placement_zone
|
||||
const initPlacementZoneConfig = (divisions=1) => {
|
||||
|
||||
// 只清除旧的放置区域网格,不清除模型
|
||||
kernel.dropZone.clearZones();
|
||||
// 调整 baseY 来控制整体高度(正数向上,负数向下)
|
||||
@ -807,19 +808,52 @@
|
||||
const height = 2.27;
|
||||
// 调整 offset 来控制每个面向外或向内的偏移
|
||||
// 正数 = 向外移动,负数 = 向内移动
|
||||
const wallOffset = -0.07; // 修改这个值来调整墙面偏移
|
||||
const wallOffset = 0; // 修改这个值来调整墙面偏移
|
||||
|
||||
kernel.dropZone.setData({
|
||||
|
||||
color: color,
|
||||
alpha: +alpha,
|
||||
thickness: thickness,
|
||||
showBorder: !show_border,
|
||||
borderColor: border_color,
|
||||
walls: walls
|
||||
color: "#21c7ff",
|
||||
alpha: 0.3,
|
||||
thickness: 2,
|
||||
showBorder: true,
|
||||
borderColor: "#ffffff",
|
||||
walls: [
|
||||
{
|
||||
name: 'front',
|
||||
startPoint: [-1.85, baseY, -1.45],
|
||||
endPoint: [1.85, baseY, -1.45],
|
||||
height: height,
|
||||
divisions: divisions,
|
||||
offset: wallOffset // 向外或向内偏移
|
||||
},
|
||||
{
|
||||
name: 'back',
|
||||
startPoint: [1.85, baseY, 1.45],
|
||||
endPoint: [-1.85, baseY, 1.45],
|
||||
height: height,
|
||||
divisions: divisions,
|
||||
offset: wallOffset
|
||||
},
|
||||
{
|
||||
name: 'left',
|
||||
startPoint: [-2.9, baseY, 1.45],
|
||||
endPoint: [-2.9, baseY, -1.45],
|
||||
height: height,
|
||||
divisions: divisions,
|
||||
offset: wallOffset
|
||||
},
|
||||
{
|
||||
name: 'right',
|
||||
startPoint: [2.9, baseY, -1.45],
|
||||
endPoint: [2.9, baseY, 1.45],
|
||||
height: height,
|
||||
divisions: divisions,
|
||||
offset: wallOffset
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
kernel.dropZone.generateDropZones();
|
||||
kernel.dropZone.generateDropZones(divisions);
|
||||
// 显示放置区域
|
||||
kernel.dropZone.show();
|
||||
dropZoneVisible = true;
|
||||
@ -834,7 +868,7 @@
|
||||
divisions: wall.divisions
|
||||
}))
|
||||
console.log(divisions);
|
||||
|
||||
|
||||
kernel.dropZone.updateDivisions(divisions);
|
||||
// 显示放置区域
|
||||
kernel.dropZone.show();
|
||||
|
||||
Reference in New Issue
Block a user