使所有的实体可以在模块内

pull/680/MERGE
ChenX 5 years ago
parent 96d71f3912
commit df376ef84d

@ -1,5 +1,5 @@
import { app } from "../../ApplicationServices/Application";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Entity } from "../../DatabaseServices/Entity/Entity";
import { InitTemplate } from "../../DatabaseServices/Template/TempateUtils";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
@ -11,15 +11,15 @@ export class ShowTemplateDesign implements Command
async exec()
{
let enRes = await app.Editor.GetSelection({
Msg: "请选择构建模块的板件",
Filter: { filterTypes: [Board] }
Msg: "请选择构建模块的实体",
// Filter: { filterTypes: [Board] }
});
if (enRes.Status !== PromptStatus.OK)
return;
let brs = enRes.SelectSet.SelectEntityList as Board[];
let ents = enRes.SelectSet.SelectEntityList as Entity[];
let template = await InitTemplate(brs);
let template = await InitTemplate(ents);
if (!template) return;
let store = TempalteEditorStore.GetInstance() as TempalteEditorStore;

@ -29,8 +29,8 @@ export function matrixAlignCoordSys(matrixFrom: Matrix4, matrixTo: Matrix4): Mat
/**
* 2
* @param {Matrix4} matrixFrom
* @param {Matrix4} matrixTo
* @param {Matrix4} matrixFrom
* @param {Matrix4} matrixTo
* @returns {boolean} 2
*/
export function matrixIsCoplane(matrixFrom: Matrix4, matrixTo: Matrix4, fuzz = 1e-5): boolean

@ -4,6 +4,7 @@ import { ColorMaterial } from "../../Common/ColorPalette";
import { DisposeThreeObj } from "../../Common/Dispose";
import { Vector2ApplyMatrix4 } from "../../Common/Matrix4Utils";
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
import { Box3Ext } from "../../Geometry/Box";
import { FastWireframe2 } from "../../Geometry/CreateWireframe";
import { EdgesGeometry } from "../../Geometry/EdgeGeometry";
import { equaln, equalv2, equalv3, ZeroVec } from "../../Geometry/GeUtils";
@ -122,7 +123,7 @@ export class ExtrudeHole extends Hole
}
get BoundingBoxInOCS()
{
let box = this.ContourCurve.BoundingBox;
let box = new Box3Ext().copy(this.ContourCurve.BoundingBox);
box.max.add(new Vector3(0, 0, this.Height));
return box;
}
@ -168,7 +169,7 @@ export class ExtrudeHole extends Hole
let pts = isGrip ? this.ContourCurve.GetGripPoints() : this.ContourCurve.GetStretchPoints();
let v = new Vector3(0, 0, this.Height);
pts.push(...pts.map(p => p.clone().add(v)));
pts.forEach(p => { p.applyMatrix4(this.OCS) });
pts.forEach(p => { p.applyMatrix4(this.OCS); });
return pts;
}
@ -286,7 +287,7 @@ export class ExtrudeHole extends Hole
}
MoveGripPoints(indexList: number[], vec: Vector3)
{
this.MoveGripOrStretchPoints(indexList, vec, DragPointType.Grip)
this.MoveGripOrStretchPoints(indexList, vec, DragPointType.Grip);
}
MoveStretchPoints(indexList: Array<number>, vec: Vector3)
{
@ -296,7 +297,7 @@ export class ExtrudeHole extends Hole
{
if (renderType === RenderType.Wireframe)
{
return new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex))
return new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(this.ColorIndex));
}
else if (renderType === RenderType.Conceptual || renderType === RenderType.Physical)
{

@ -61,7 +61,6 @@ export class Board extends ExtrudeSolid
};
private _BoardType: BoardType;
private _Name = "";
private _SpecOCS: Matrix4 = new Matrix4(); //板件的标系
private _BoardProcessOption: BoardProcessOption;
//板件排钻表,与之碰撞板件为key
private _DrillList: Map<ObjectId, ObjectId[][]> = new Map();
@ -174,7 +173,7 @@ export class Board extends ExtrudeSolid
let board = new Board();
board.InitBoard(length, width, thickness, boardType);
board.ApplyMatrix(board.RotateMat);
board._SpecOCS.identity();
board._SpaceOCS.identity();
return board;
}
get DrillList()
@ -428,15 +427,15 @@ export class Board extends ExtrudeSolid
this.WriteAllObjectRecord();
if (type !== this._BoardType)
{
let spceOcs = this._SpecOCS.clone();
let spaceCS = this._SpaceOCS.clone();
this._BoardType = type;
this.ApplyMatrix(this.OCSInv);
this.ApplyMatrix(this.RotateMat);
this._SpecOCS.identity();
this._SpaceOCS.identity();
this.ApplyMatrix(spceOcs);
this.ApplyMatrix(spaceCS);
this.Update();
}
@ -467,19 +466,6 @@ export class Board extends ExtrudeSolid
pt.applyMatrix4(this.OCS);
return pt;
}
get SpaceOCS()
{
return this._SpecOCS.clone();
}
get SpaceOCSInv()
{
return new Matrix4().getInverse(this._SpecOCS);
}
set SpaceOCS(m: Matrix4)
{
this.WriteAllObjectRecord();
this._SpecOCS.copy(m);
}
get IsRect()
{
@ -530,16 +516,6 @@ export class Board extends ExtrudeSolid
super.ContourCurve = cu;
}
GetBoardBoxInMtx(mtx: Matrix4): Box3Ext
{
return this.BoundingBoxInOCS.applyMatrix4(this.OCS.premultiply(mtx));
}
get BoundingBoxInSpaceCS(): Box3Ext
{
return this.GetBoardBoxInMtx(this.SpaceOCSInv);
}
Explode()
{
return Board2Regions(this);
@ -565,7 +541,7 @@ export class Board extends ExtrudeSolid
.ApplyMatrix(roMatZ)
.ApplyMatrix(spcocs);
this._SpecOCS.copy(spcocs);
this._SpaceOCS.copy(spcocs);
this.Update();
}
get Rotation()
@ -573,30 +549,11 @@ export class Board extends ExtrudeSolid
return this._Rotation;
}
get Position()
{
return super.Position;
}
set Position(p: Vector3)
{
let op = this.Position;
let moveX = p.x - op.x;
let moveY = p.y - op.y;
let moveZ = p.z - op.z;
super.Position = p;
this._SpecOCS.elements[12] += moveX;
this._SpecOCS.elements[13] += moveY;
this._SpecOCS.elements[14] += moveZ;
}
ApplyMatrix(m: Matrix4): this
{
super.ApplyMatrix(m);
if (equaln(m.getMaxScaleOnAxis(), 1))
this._SpecOCS.multiplyMatrices(m, this._SpecOCS);
this._SpaceOCS.multiplyMatrices(m, this._SpaceOCS);
return this;
}
protected ApplyScaleMatrix(m: Matrix4): this
@ -651,7 +608,8 @@ export class Board extends ExtrudeSolid
{
super._ReadFile(file);
let ver = file.Read();
this._SpecOCS.fromArray(file.Read());
if (ver < 6)
this._SpaceOCS.fromArray(file.Read());
this._BoardType = file.Read();
this._Name = file.Read();
//兼容旧版本
@ -719,8 +677,8 @@ export class Board extends ExtrudeSolid
WriteFile(file: CADFiler)
{
super.WriteFile(file);
file.Write(5);
file.Write(this._SpecOCS.toArray());
file.Write(6);
// file.Write(this._SpaceOCS.toArray()); ver < 6
file.Write(this._BoardType);
file.Write(this._Name);
serializeBoardData(file, this._BoardProcessOption);

@ -29,7 +29,6 @@ export enum ExtendType
Both = 3,
}
/**
* 线,.
*/
@ -75,9 +74,9 @@ export abstract class Curve extends Entity
/**
* 线(wcs)
*
* @param {(number | Vector3)} param
* @returns {Vector3}
*
* @param {(number | Vector3)} param
* @returns {Vector3}
* @memberof Curve
*/
GetFistDeriv(param: number | Vector3): Vector3 { return; }
@ -89,9 +88,9 @@ export abstract class Curve extends Entity
/**
* 线.,线.
*
* @param {(number[] | number)} param
* @returns {Array<Curve>}
*
* @param {(number[] | number)} param
* @returns {Array<Curve>}
* @memberof Curve
*/
GetSplitCurves(param: number[] | number): Array<Curve> { return; }
@ -155,9 +154,9 @@ export abstract class Curve extends Entity
/**
* 线
*
* @param {Curve} curve
* @returns {Vector3[]}
*
* @param {Curve} curve
* @returns {Vector3[]}
* @memberof Curve
*/
IntersectWith(curve: Curve, intType: IntersectOption, tolerance = 1e-6): Vector3[] { return []; }

@ -6,7 +6,8 @@ import { matrixIsCoplane, MatrixPlanarizere } from '../../Common/Matrix4Utils';
import { UpdateDraw } from '../../Common/Status';
import { ObjectSnapMode } from '../../Editor/ObjectSnapMode';
import { userConfig } from '../../Editor/UserConfig';
import { equaln, equalv3, UpdateBoundingSphere } from '../../Geometry/GeUtils';
import { Box3Ext } from '../../Geometry/Box';
import { equaln, equalv3, UpdateBoundingSphere, IdentityMtx4 } from '../../Geometry/GeUtils';
import { IntersectOption } from '../../GraphicsSystem/IntersectWith';
import { RenderType } from '../../GraphicsSystem/RenderType';
import { AutoRecord } from '../AutoRecord';
@ -34,6 +35,23 @@ export class Entity extends CADObject
//自身坐标系
protected _Matrix = new Matrix4();
//模块空间的标系
protected _SpaceOCS: Matrix4 = new Matrix4();
get SpaceOCS()
{
return this._SpaceOCS.clone();
}
get SpaceOCSInv()
{
return new Matrix4().getInverse(this._SpaceOCS);
}
set SpaceOCS(m: Matrix4)
{
this.WriteAllObjectRecord();
this._SpaceOCS.copy(m);
}
protected _Visible = true;
@AutoRecord GourpId: ObjectId;
@ -87,7 +105,24 @@ export class Entity extends CADObject
/**
* Box
*/
get BoundingBoxInOCS(): Box3 { return; }
get BoundingBoxInOCS(): Box3Ext
{
let mtxBak = this._Matrix;
this._Matrix = IdentityMtx4;
let box = this.BoundingBox;
this._Matrix = mtxBak;
return new Box3Ext().copy(box);
}
GetBoundingBoxInMtx(mtx: Matrix4): Box3Ext
{
return this.BoundingBoxInOCS.applyMatrix4(this.OCS.premultiply(mtx));
}
get BoundingBoxInSpaceCS(): Box3Ext
{
return this.GetBoundingBoxInMtx(this.SpaceOCSInv);
}
get OCS(): Matrix4
{
@ -108,10 +143,16 @@ export class Entity extends CADObject
return new Vector3().setFromMatrixPosition(this._Matrix);
}
set Position(v: Vector3)
set Position(pt: Vector3)
{
this.WriteAllObjectRecord();
this._Matrix.setPosition(v);
let moveX = pt.x - this._Matrix.elements[12];
let moveY = pt.y - this._Matrix.elements[13];
let moveZ = pt.z - this._Matrix.elements[14];
this._Matrix.setPosition(pt);
this._SpaceOCS.elements[12] += moveX;
this._SpaceOCS.elements[13] += moveY;
this._SpaceOCS.elements[14] += moveZ;
this.Update(UpdateDraw.Matrix);
}
@ -546,11 +587,13 @@ export class Entity extends CADObject
if (ver > 5)
this._Visible = file.Read();
if (ver > 6)
this._SpaceOCS.fromArray(file.Read());
}
//对象将自身数据写入到文件.
WriteFile(file: CADFiler)
{
file.Write(6);
file.Write(7);
super.WriteFile(file);
file.Write(this._Color);
file.WriteHardObjectId(this.materialId);
@ -558,6 +601,7 @@ export class Entity extends CADObject
file.WriteObjectId(this.Template);
file.WriteHardObjectId(this.GourpId);
file.Write(this._Visible);
file.Write(this._SpaceOCS.toArray());
}
//局部撤销
ApplyPartialUndo(undoData: CADObject)

@ -5,19 +5,26 @@ import { arrayRemoveOnce } from "../../Common/ArrayExt";
import { DisposeThreeObj } from "../../Common/Dispose";
import { TemplateUrls } from "../../Common/HostUrl";
import { PostJson, RequestStatus, uploadLogo } from "../../Common/Request";
import { deflate, GetCurrentViewPreViewImage, TemplateOut, TemplateParamsOut, inflate, TemplateIn } from "../../Common/SerializeMaterial";
import { deflate, GetCurrentViewPreViewImage, inflate, TemplateIn, TemplateOut, TemplateParamsOut } from "../../Common/SerializeMaterial";
import { DuplicateRecordCloning } from "../../Common/Status";
import { StretchParse } from "../../Common/StretchParse";
import { FixedNotZero, log } from "../../Common/Utils";
import { CommandWrap } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { SelectBox } from "../../Editor/SelectBox";
import { SelectPick } from "../../Editor/SelectPick";
import { AxisSnapMode } from "../../Editor/SnapServices";
import { TempEditor } from "../../Editor/TempEditor";
import { userConfig } from "../../Editor/UserConfig";
import { Box3Ext } from "../../Geometry/Box";
import { AsVector3, equaln, isParallelTo, isPerpendicularityTo, ZAxis, ZeroVec } from "../../Geometry/GeUtils";
import { RenderType } from "../../GraphicsSystem/RenderType";
import { AAType } from "../../GraphicsSystem/Viewer";
import { ModalPosition } from "../../UI/Components/Modal/ModalsManage";
import { INeedUpdateParams } from "../../UI/Components/Template/TemplateComponent";
import { TemplateEditor } from "../../UI/Components/Template/TemplateEditor";
import { AppToaster } from "../../UI/Components/Toaster";
import { TempalteEditorStore } from "../../UI/Store/TemplateEditorStore";
import { CADFiler } from "../CADFiler";
import { Database } from "../Database";
import { Board } from "../Entity/Board";
@ -32,18 +39,11 @@ import { TemplateStretchGripAction } from "./Action/TemplateStretchGripAction";
import { TemplateStretchScaleBoxAction } from "./Action/TemplateStretchScaleBoxAction";
import { TemplateParam } from "./Param/TemplateParam";
import { TemplateRecord } from "./TemplateRecord";
import { INeedUpdateParams } from "../../UI/Components/Template/TemplateComponent";
import { TempEditor } from "../../Editor/TempEditor";
import { CommandWrap } from "../../Editor/CommandMachine";
import { DuplicateRecordCloning } from "../../Common/Status";
import { TempalteEditorStore } from "../../UI/Store/TemplateEditorStore";
import { TemplateEditor } from "../../UI/Components/Template/TemplateEditor";
import { ModalPosition } from "../../UI/Components/Modal/ModalsManage";
/**
*
*/
export function GetDeepestTemplate(brs: Board[]): TemplateRecord | undefined
export function GetDeepestTemplate(brs: Entity[]): TemplateRecord | undefined
{
let maxDepth = -Infinity;
let deepestTemplate: TemplateRecord;
@ -77,12 +77,24 @@ export function GetTempateBoards(template: TemplateRecord): Board[]
for (let id of template.Objects)
{
if (!id.IsErase)
brs.push(id.Object as Board);
if (!id.IsErase && id.Object instanceof Board)
brs.push(id.Object);
}
return brs;
}
export function GetTempateEntitys(template: TemplateRecord): Entity[]
{
let ents: Entity[] = [];
for (let id of template.Objects)
{
if (!id.IsErase && id.Object instanceof Entity)
ents.push(id.Object);
}
return ents;
}
/**
*
*
@ -90,13 +102,13 @@ export function GetTempateBoards(template: TemplateRecord): Board[]
* ,.
* ,.
*
* @param brs
* @param ents
* @returns
*/
export async function InitTemplate(brs: Board[]): Promise<TemplateRecord | undefined>
export async function InitTemplate(ents: Entity[]): Promise<TemplateRecord | undefined>
{
let templates: Set<TemplateRecord> = new Set();
for (let br of brs)
for (let br of ents)
{
if (!br.Template)
templates.add(undefined);
@ -144,11 +156,11 @@ export async function InitTemplate(brs: Board[]): Promise<TemplateRecord | undef
}
}
let templateSCSInv = brs[0].SpaceOCSInv;
let templateSCS = brs[0].SpaceOCS;
let templateSCSInv = ents[0].SpaceOCSInv;
let templateSCS = ents[0].SpaceOCS;
let box = new Box3();
for (let br of brs)
box.union(br.GetBoardBoxInMtx(templateSCSInv));
for (let br of ents)
box.union(br.GetBoundingBoxInMtx(templateSCSInv));
templateSize = box.getSize(new Vector3());
templateSCS.setPosition(box.min.applyMatrix4(templateSCS));
@ -174,7 +186,7 @@ export async function InitTemplate(brs: Board[]): Promise<TemplateRecord | undef
}
app.Database.TemplateTable.Append(template);
for (let br of brs)
for (let br of ents)
{
template.Objects.push(br.Id);
br.SpaceOCS = templateSCS;
@ -199,7 +211,7 @@ export function UpdateTemplateSizeOffBoards(template: TemplateRecord)
if (!spaceCSInv)
spaceCSInv = br.SpaceOCSInv;
let brbox = br.GetBoardBoxInMtx(spaceCSInv);
let brbox = br.GetBoundingBoxInMtx(spaceCSInv);
box.union(brbox);
}
@ -332,7 +344,7 @@ export function InitTempateSizeActions(template: TemplateRecord, useScaleBox = t
let topBox = new Box3Ext(new Vector3(-1, -1, size.z / 2), max);
//板件列表
let brs = GetTempateBoards(template);
let ents = GetTempateEntitys(template);
//动作列表
let ActionType = useScaleBox ? TemplateStretchScaleBoxAction : TemplateStretchGripAction;
@ -340,9 +352,9 @@ export function InitTempateSizeActions(template: TemplateRecord, useScaleBox = t
let wAction = new ActionType(new Vector3(0, 1, 0));
let hAction = new ActionType(new Vector3(0, 0, 1));
for (let br of brs)
for (let ent of ents)
{
let sps = br.GetStretchPoints();
let sps = ent.GetStretchPoints();
let boxContainsIndexMap = [
{ box: rightBox, indexs: [], action: lAction },
@ -363,30 +375,34 @@ export function InitTempateSizeActions(template: TemplateRecord, useScaleBox = t
let spaceToLocalMtx: Matrix4;
if (useScaleBox)
spaceToLocalMtx = br.OCSInv.multiply(scs);
spaceToLocalMtx = ent.OCSInv.multiply(scs);
for (let d of boxContainsIndexMap)
{
if (d.indexs.length === 0)
continue;
if (d.indexs.length === sps.length || br.IsStretchThickness(d.indexs))
d.action.MoveEntitys.push(br.Id);
if (d.indexs.length === sps.length || (ent instanceof Board && ent.IsStretchThickness(d.indexs)))
d.action.MoveEntitys.push(ent.Id);
else
{
if (useScaleBox)
{
let scaleBox = d.box.clone().applyMatrix4(spaceToLocalMtx);
let size = new Vector3(br.Width, br.Height, br.Thickness);
let size: Vector3;
if (ent instanceof Board)
size = new Vector3(ent.Width, ent.Height, ent.Thickness);
else
size = ent.BoundingBoxInOCS.getSize(new Vector3);
scaleBox.min.divide(size);
scaleBox.max.divide(size);
let action = d.action as TemplateStretchScaleBoxAction;
action.EntityStretchData.push({ entity: br.Id, scaleBox });
action.EntityStretchData.push({ entity: ent.Id, scaleBox });
}
else
{
let action = d.action as TemplateStretchGripAction;
action.EntityStretchPointMap.push({ entity: br.Id, indexs: d.indexs });
action.EntityStretchPointMap.push({ entity: ent.Id, indexs: d.indexs });
}
}
}

@ -255,7 +255,7 @@ export class TemplateRecord extends SymbolTableRecord
protected async Update()
{
this._CacheParamVars = this.GetParameterDefinition(false);
let brs = this.Objects.filter(id => !id.IsErase).map(id => id.Object as Board);
let ens = this.Objects.filter(id => !id.IsErase).map(id => id.Object as Entity);
let evaled = new Set<TemplateParam>();
this._CacheSpaceCS = this.GetTemplateSpaceCS(false);
@ -264,10 +264,11 @@ export class TemplateRecord extends SymbolTableRecord
for (let param of this.Params)
paramMap.set(param.name, param);
for (let br of brs)
for (let en of ens)
{
br.ApplyMatrix(br.SpaceOCSInv);
br.IsLazyGrooveCheck = true;
en.ApplyMatrix(en.SpaceOCSInv);
if (en instanceof Board)
en.IsLazyGrooveCheck = true;
}
//#region 1.定位(坐标系和大小)
@ -349,10 +350,11 @@ export class TemplateRecord extends SymbolTableRecord
}
//变换到新的模版空间
for (let br of brs)
for (let en of ens)
{
br.ApplyMatrix(this._CacheSpaceCS);
br.LazyGrooveCheckAll();
en.ApplyMatrix(this._CacheSpaceCS);
if (en instanceof Board)
en.LazyGrooveCheckAll();
}
//更新顶层变量值
@ -368,7 +370,7 @@ export class TemplateRecord extends SymbolTableRecord
}
//保持SpaceCS
for (let ent of brs)
for (let ent of ens)
{
ent.SpaceOCS = this._CacheSpaceCS;
}
@ -595,7 +597,7 @@ export class TemplateRecord extends SymbolTableRecord
{
if (brId.Object && !brId.IsErase)
{
let br = brId.Object as Board;
let br = brId.Object as Entity;
return br.SpaceOCS;
}
}
@ -609,8 +611,8 @@ export class TemplateRecord extends SymbolTableRecord
if (this._Positioning && this._Positioning instanceof PositioningClampSpace)
{
for (let id of this._Positioning.Objects)
if (!id.IsErase)
brs.push(id.Object as Board);
if (!id.IsErase && id.Object instanceof Board)
brs.push(id.Object);
}
if (brs.length === 0)
brs.push(new Board());

@ -1,8 +1,8 @@
import { Board } from "../../DatabaseServices/Entity/Board";
import { BoardGetFace } from "./BoardGetFace";
import { Face } from "./Face";
import { DrillType } from "../../UI/Store/BoardInterface";
import { Box3Ext } from "../Box";
import { BoardGetFace } from "./BoardGetFace";
import { Face } from "./Face";
export class CollisionDetection
{
@ -22,7 +22,7 @@ export class CollisionDetection
if (b.BoardProcessOption.drillType !== DrillType.None)
{
this.BoardGeList.push(new BoardGetFace(b));
boxCache.set(b, b.GetBoardBoxInMtx(ocsInv));
boxCache.set(b, b.GetBoundingBoxInMtx(ocsInv));
}
}

@ -111,12 +111,12 @@ export class ISpaceParse
}
/**
* ,(,)
* @param boardCol
* @param splitType
* @param boardCol
* @param splitType
*/
protected ParseBoardBox(boardCol: Board[], splitType: SplitType): Box3Ext[]
{
let boxCol = boardCol.map(b => b.GetBoardBoxInMtx(this.SpaceOCSInv));
let boxCol = boardCol.map(b => b.GetBoundingBoxInMtx(this.SpaceOCSInv));
//查找最左的板和最右的板
if (splitType === SplitType.X)

@ -1,14 +1,14 @@
import { Vector3, Matrix4, Box3 } from "three";
import { Box3, Matrix4, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { arrayLast } from "../../Common/ArrayExt";
import { getRectFrom4Pts } from "../../Common/CurveUtils";
import { Board } from "../../DatabaseServices/Entity/Board";
import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { Region } from "../../DatabaseServices/Entity/Region";
import { BoolOpeartionType } from "../../GraphicsSystem/BoolOperateUtils";
import { equaln, isParallelTo, isPerpendicularityTo } from "../GeUtils";
import { ISpaceParse } from "./ISpaceParse";
import { Board } from "../../DatabaseServices/Entity/Board";
import { getRectFrom4Pts } from "../../Common/CurveUtils";
import { arrayLast } from "../../Common/ArrayExt";
/**
*
@ -98,7 +98,7 @@ export class SurroundOutlineParse extends ISpaceParse
let boxes: Box3[] = [];
for (let br of this.Boards)
{
let box = br.GetBoardBoxInMtx(this.SpaceOCSInv);
let box = br.GetBoundingBoxInMtx(this.SpaceOCSInv);
boxes.push(box);
boxMap.set(box, br);
}

@ -1,5 +1,5 @@
import { ISpaceParse } from "./ISpaceParse";
import { Box3Ext } from "../Box";
import { ISpaceParse } from "./ISpaceParse";
/**
*
@ -13,7 +13,7 @@ export class TotalSpaceParse extends ISpaceParse
this.SpaceBox = new Box3Ext();
for (let br of this.Boards)
this.SpaceBox.union(br.GetBoardBoxInMtx(this.SpaceOCSInv));
this.SpaceBox.union(br.GetBoundingBoxInMtx(this.SpaceOCSInv));
this.ParseOK = true;
}

@ -114,8 +114,11 @@ export default class TempalteActionList extends React.Component<ITempalteActionL
}
private InitAction = () =>
{
InitTempateSizeActions(this.props.store.Template);
this.parseUpdateNodes();
CommandWrap(() =>
{
InitTempateSizeActions(this.props.store.Template);
this.parseUpdateNodes();
}, "初始化动作");
};
private handleCancelSelect = (el: MouseEvent) =>
{

@ -40,15 +40,14 @@ export class RightPanelStore implements IConfigStore
let selectCtrl = app.Editor.SelectCtrl;
begin(selectCtrl, selectCtrl.AddSelect, (ss: SelectSetBase) =>
{
let br = ss.SelectEntityList[0];
if (br && br instanceof Board)
{
this.currentBoard = br;
if (this.currentBoard.Template)
this.currentTemplateIndex = this.currentBoard.Template.Index;
else
this.currentTemplateIndex = undefined;
}
let ent = ss.SelectEntityList[0];
if (!ent) return;
if (ent instanceof Board)
this.currentBoard = ent;
if (ent.Template)
this.currentTemplateIndex = ent.Template.Index;
else
this.currentTemplateIndex = undefined;
});
}

Loading…
Cancel
Save