|
|
|
@ -40,34 +40,50 @@ export function ForbiddenToaster(action: () => Promise<void> | void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const explosionDic: { [key: number]: any[]; } = {};
|
|
|
|
|
const explosionDic: { [key: string]: any[]; } = {};
|
|
|
|
|
export async function ExplosionView(index: number, distance: number)
|
|
|
|
|
{
|
|
|
|
|
if (!(explosionDic[index] && explosionDic[index].length > 0))
|
|
|
|
|
let key = `${index}_${ShareViewStore.GetInstance().viewUploadProps.VisualStyle}`;
|
|
|
|
|
let ents = shareViewApp.BoxCtrl.GetCabinetEntities(index);
|
|
|
|
|
if (!(explosionDic[key] && explosionDic[key].length > 0))
|
|
|
|
|
{
|
|
|
|
|
let moveObjs = [];
|
|
|
|
|
let unVisibleEnts = new Set<Entity>; //隐藏的实体
|
|
|
|
|
let objLists: Object3D[] = [];
|
|
|
|
|
for (let ent of shareViewApp.BoxCtrl.GetCabinetEntities(index))
|
|
|
|
|
for (let ent of ents)
|
|
|
|
|
{
|
|
|
|
|
//隐藏的实体参与计算
|
|
|
|
|
if (!ent.Visible)
|
|
|
|
|
{
|
|
|
|
|
ent.Visible = true;
|
|
|
|
|
unVisibleEnts.add(ent);
|
|
|
|
|
}
|
|
|
|
|
objLists.push(ent.DrawObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let box = GetBoxArr(objLists);
|
|
|
|
|
let size = box.getSize(new Vector3());
|
|
|
|
|
let cen = box.getCenter(new Vector3());
|
|
|
|
|
for (let obj of objLists)
|
|
|
|
|
{
|
|
|
|
|
if (obj.userData?.Entity)
|
|
|
|
|
let ent = obj.userData?.Entity;
|
|
|
|
|
if (ent)
|
|
|
|
|
{
|
|
|
|
|
let objCen = GetBox(obj).getCenter(new Vector3());
|
|
|
|
|
let v = objCen.clone().sub(cen);
|
|
|
|
|
v.divide(size);
|
|
|
|
|
moveObjs.push([obj, v]);
|
|
|
|
|
|
|
|
|
|
//还原隐藏的实体
|
|
|
|
|
if (unVisibleEnts.has(ent))
|
|
|
|
|
ent.Visible = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
explosionDic[index] = moveObjs;
|
|
|
|
|
explosionDic[key] = moveObjs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 移动位置
|
|
|
|
|
for (let [o, v] of explosionDic[index])
|
|
|
|
|
for (let [o, v] of explosionDic[key])
|
|
|
|
|
{
|
|
|
|
|
o.position.sub(v.clone().multiplyScalar(distance));
|
|
|
|
|
o.updateMatrix();
|
|
|
|
@ -200,7 +216,8 @@ export async function SwitchDoorOrDrawer(visible: boolean, isDoor: boolean = tru
|
|
|
|
|
|
|
|
|
|
for (const i of ShareViewStore.GetInstance().CurSelectCabinetIndexs)
|
|
|
|
|
{
|
|
|
|
|
for (const item of shareViewApp.BoxCtrl.GetCabinetEntities(i))
|
|
|
|
|
let ent = shareViewApp.BoxCtrl.GetCabinetEntities(i);
|
|
|
|
|
for (const item of ent)
|
|
|
|
|
{
|
|
|
|
|
totalEntitys.push(item);
|
|
|
|
|
}
|
|
|
|
|