1
This commit is contained in:
17
index.js
17
index.js
@ -44,7 +44,8 @@ export const init = async (customConfig = {}) => {
|
||||
container: document.querySelector('#renderDom'),
|
||||
modelUrlList: [],
|
||||
env: { envPath: 'https://cdn.files.zguiy.com/zt/environment.env', intensity: 1.2, rotationY: 0.3, background: false },
|
||||
gizmo: {
|
||||
gcamera:{},
|
||||
izmo: {
|
||||
position: false,
|
||||
rotation: false,
|
||||
scale: false
|
||||
@ -62,7 +63,7 @@ export const init = async (customConfig = {}) => {
|
||||
const config = { ...defaultConfig, ...customConfig };
|
||||
kernel.init(config);
|
||||
}
|
||||
|
||||
//
|
||||
//初始化加载模型
|
||||
export const getAutoLoadModelList = async () => {
|
||||
const kernel = getKernel();
|
||||
@ -201,6 +202,7 @@ export const executeEvent = async (dropzone_data, result, sku) => {
|
||||
// 第一次循环:处理 change_model
|
||||
for (const event of result.data.events) {
|
||||
if (event.event_type === 'change_model') {
|
||||
|
||||
const { name, file_url, model_control_type, category } = event.target_data;
|
||||
|
||||
// 生成唯一的模型ID
|
||||
@ -208,8 +210,7 @@ export const executeEvent = async (dropzone_data, result, sku) => {
|
||||
modelName = name;
|
||||
kernel.dropZone.recordModelPlacement(wallName, index, name + '_' + modelId);
|
||||
|
||||
// 记录模型ID到SKU的映射
|
||||
setSkuMapping(modelId, sku);
|
||||
|
||||
|
||||
await kernel.model.add({
|
||||
modelName: name,
|
||||
@ -220,10 +221,10 @@ export const executeEvent = async (dropzone_data, result, sku) => {
|
||||
enable: true,
|
||||
axis: rotation.y === 0 || rotation.y === 180 ? 'x' : 'z',
|
||||
step: 0.1,
|
||||
// snapToZone: true, // 开关1:拖拽吸附到最近的分割区域
|
||||
// returnWhenOutOfBounds: false, // 开关2:拖拽到区域外时返回原位置
|
||||
// handleOccupiedZone: true, // 开关3:处理已占用区域(false=允许重叠)
|
||||
// occupiedZoneAction: 'return' // 当开关3=true时的行为:'return'=返回原位置,'replace'=替换
|
||||
snapToZone: true, // 拖拽吸附到最近的分割区域
|
||||
returnWhenOutOfBounds: true, // 拖拽到区域外时返回原位置
|
||||
handleOccupiedZone: true, // 处理已占用区域(false=允许重叠)
|
||||
occupiedZoneAction: 'replace' // 当开关3=true时的行为:'return'=返回原位置,'replace'=替换
|
||||
},
|
||||
transform: {
|
||||
position: position,
|
||||
|
||||
Reference in New Issue
Block a user