修改move实现,对于entity 你必须实现applyMatrix方法.

pull/610546/MERGE
ChenX 7 years ago
parent 4c02fba5a3
commit 2bfd24fe0f

@ -1,6 +1,7 @@
import * as THREE from 'three'; import * as THREE from 'three';
import { app } from '../ApplicationServices/Application'; import { app } from '../ApplicationServices/Application';
import { Entity } from '../DatabaseServices/Entity';
import { Command } from '../Editor/CommandMachine'; import { Command } from '../Editor/CommandMachine';
import { PromptStatus } from '../Editor/PromptResult'; import { PromptStatus } from '../Editor/PromptResult';
import { SelectSet } from '../Editor/SelectSet'; import { SelectSet } from '../Editor/SelectSet';
@ -32,6 +33,9 @@ export class Command_Move implements Command
selectList.forEach(o => selectList.forEach(o =>
{ {
if (o.userData && o.userData instanceof Entity)
o.userData.ApplyMatrix(moveMat)
else
o.applyMatrix(moveMat); o.applyMatrix(moveMat);
}) })

@ -1,4 +1,4 @@
import { EllipseCurve, Geometry, Vector3 } from 'three'; import { EllipseCurve, Geometry, Matrix4, Vector3 } from 'three';
import * as THREE from 'three'; import * as THREE from 'three';
import { ColorMaterial } from '../Common/ColorPalette'; import { ColorMaterial } from '../Common/ColorPalette';
@ -80,6 +80,14 @@ export class Circle extends Entity
geo.computeBoundingSphere(); geo.computeBoundingSphere();
} }
} }
ApplyMatrix(m: Matrix4)
{
super.ApplyMatrix(m);
this.m_Center.applyMatrix4(m);
this.Update();
}
GetSnapPoints(): Array<THREE.Vector3> GetSnapPoints(): Array<THREE.Vector3>
{ {
return this.GetStretchPoints(); return this.GetStretchPoints();

@ -1,5 +1,6 @@
//所有图元的基类 //所有图元的基类
import * as THREE from 'three'; import * as THREE from 'three';
import { Matrix4 } from 'three';
import { RenderType } from '../GraphicsSystem/Enum'; import { RenderType } from '../GraphicsSystem/Enum';
import { Factory } from './CADFactory'; import { Factory } from './CADFactory';
@ -67,6 +68,11 @@ export class Entity extends CADObject
this.updateVisible(); this.updateVisible();
} }
ApplyMatrix(m: Matrix4)
{
}
GetSnapPoints(): Array<THREE.Vector3> GetSnapPoints(): Array<THREE.Vector3>
{ {
return []; return [];

Loading…
Cancel
Save