!2297 看图王修复爆炸图错位

pull/2300/head
j787701730 1 year ago committed by ChenX
parent 33987d22fa
commit 335a35b8b7

@ -16,11 +16,13 @@ import { PromptStatus } from "../../Editor/PromptResult";
import { userConfig } from "../../Editor/UserConfig";
import { Box3Ext } from "../../Geometry/Box";
import { XAxis, ZAxis } from "../../Geometry/GeUtils";
import { RenderType } from "../../GraphicsSystem/RenderType";
import { AppToaster } from "../../UI/Components/Toaster";
import { BoardOpenDir } from "../../UI/Store/BoardInterface";
import { IsDoor, IsDrawer, IsHandle, IsHinge, IsLattice } from "../HideSelect/HideSelectUtils";
const MOVECOUNT = 150;
const UNOPENRENDERTYPE = [RenderType.Edge, RenderType.PlaceFace]; //不支持开门动作的视图类型
export class Command_OpenCabinet implements Command
{
@ -32,7 +34,7 @@ export class Command_OpenCabinet implements Command
async exec()
{
if (this._Timer) return;
if (userConfig.RenderType > 6 || app.Viewer.isLayout)
if (UNOPENRENDERTYPE.includes(userConfig.RenderType) || app.Viewer.isLayout)
{
AppToaster.show({
message: "该视图类型下无法使用!",

@ -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);
}

@ -116,6 +116,12 @@ function ShareViewUI()
async function doorOpenOrClose()
{
if (loading) return;
// 排版面/封边 不支持开门功能
if ([RenderType.PlaceFace, RenderType.Edge].includes(shareViewStore.viewUploadProps.VisualStyle))
{
SPToaster.show({ message: "该视图样式下无法展示开门功能" });
return;
}
setLoading(true);
await showDoor();
await showDrawer();
@ -133,7 +139,7 @@ function ShareViewUI()
} else
{
// 自定义编号样式下无法开门, 还原之前的样式
await resetCustomNumberToBeforeStyle();
// await resetCustomNumberToBeforeStyle();
shareViewStore.SelectedBoard = null;
commandMachine.ExecCommand(CommandNames.SelectAll).then(() =>
{

Loading…
Cancel
Save