|
|
@ -1,7 +1,7 @@
|
|
|
|
import { MathUtils, Object3D, Vector3, Matrix4, Mesh, ShapeGeometry, Box3 } from 'three';
|
|
|
|
import { MathUtils, Object3D, Vector3, Matrix4, Mesh, ShapeGeometry, Box3 } from 'three';
|
|
|
|
import { ColorMaterial } from '../../Common/ColorPalette';
|
|
|
|
import { ColorMaterial } from '../../Common/ColorPalette';
|
|
|
|
import { setRotationOnAxis } from '../../Common/Matrix4Utils';
|
|
|
|
import { setRotationOnAxis } from '../../Common/Matrix4Utils';
|
|
|
|
import { MoveMatrix } from '../../Geometry/GeUtils';
|
|
|
|
import { GetBox, MoveMatrix } from '../../Geometry/GeUtils';
|
|
|
|
import { RenderType } from '../../GraphicsSystem/RenderType';
|
|
|
|
import { RenderType } from '../../GraphicsSystem/RenderType';
|
|
|
|
import { Factory } from '../CADFactory';
|
|
|
|
import { Factory } from '../CADFactory';
|
|
|
|
import { CADFiler } from '../CADFiler';
|
|
|
|
import { CADFiler } from '../CADFiler';
|
|
|
@ -130,6 +130,7 @@ export class Text extends Entity
|
|
|
|
let alllen = (this.TextString.length + (this.TextString.match('/[\u4e00-\u9fa5]/g')?.length ?? 0)) / 2;
|
|
|
|
let alllen = (this.TextString.length + (this.TextString.match('/[\u4e00-\u9fa5]/g')?.length ?? 0)) / 2;
|
|
|
|
return alllen * this._Height;
|
|
|
|
return alllen * this._Height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get BoundingBox()
|
|
|
|
get BoundingBox()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!this.box)
|
|
|
|
if (!this.box)
|
|
|
@ -151,7 +152,6 @@ export class Text extends Entity
|
|
|
|
let mesh = obj.children[0] as Mesh;
|
|
|
|
let mesh = obj.children[0] as Mesh;
|
|
|
|
|
|
|
|
|
|
|
|
let box = mesh.geometry.boundingBox;
|
|
|
|
let box = mesh.geometry.boundingBox;
|
|
|
|
this.box = box.clone().applyMatrix4(this.OCS);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let p = new Vector3();
|
|
|
|
let p = new Vector3();
|
|
|
|
if (this._Align & TextAligen.LeftMid)
|
|
|
|
if (this._Align & TextAligen.LeftMid)
|
|
|
@ -173,9 +173,19 @@ export class Text extends Entity
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
obj.updateMatrixWorld(true);
|
|
|
|
obj.updateMatrixWorld(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.box = GetBox(obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApplyMatrix(m: Matrix4): this
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
super.ApplyMatrix(m);
|
|
|
|
|
|
|
|
this.box?.applyMatrix4(m);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected ApplyScaleMatrix(m: Matrix4): this
|
|
|
|
protected ApplyScaleMatrix(m: Matrix4): this
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
@ -184,6 +194,8 @@ export class Text extends Entity
|
|
|
|
[p1, p2].forEach(p => p.applyMatrix4(m));
|
|
|
|
[p1, p2].forEach(p => p.applyMatrix4(m));
|
|
|
|
this.Position = p1;
|
|
|
|
this.Position = p1;
|
|
|
|
this.Height = p1.distanceTo(p2);
|
|
|
|
this.Height = p1.distanceTo(p2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.box?.applyMatrix4(m);
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|