!703 使标注默认显示引线

pull/703/MERGE
肖诗雅 5 years ago committed by ChenX
parent 95eb5330d7
commit 34a4c89d53

@ -1,4 +1,4 @@
import { Box3, Matrix4, Vector3 } from "three"; import { Box3, Matrix4, Vector3, Vector2 } from "three";
import { app } from "../../ApplicationServices/Application"; import { app } from "../../ApplicationServices/Application";
import { arrayRemoveDuplicateBySort, arraySortByNumber } from "../../Common/ArrayExt"; import { arrayRemoveDuplicateBySort, arraySortByNumber } from "../../Common/ArrayExt";
import { AlignedDimension } from "../../DatabaseServices/Dimension/AlignedDimension"; import { AlignedDimension } from "../../DatabaseServices/Dimension/AlignedDimension";
@ -240,7 +240,6 @@ export class Command_AutoDimBrs implements Command
if (textRotation) if (textRotation)
alDimTotal.TextRotation = textRotation; alDimTotal.TextRotation = textRotation;
alDimTotal.LeadOutFlipped = isLeadOutFlipped; alDimTotal.LeadOutFlipped = isLeadOutFlipped;
alDimTotal.LeadOutVisible = true;
alDimTotal.ApplyMatrix(drawCS); alDimTotal.ApplyMatrix(drawCS);
als.push(alDimTotal); als.push(alDimTotal);
@ -257,20 +256,15 @@ export class Command_AutoDimBrs implements Command
new Vector3(x1, drawY, z), new Vector3(x1, drawY, z),
new Vector3(x2, drawY, z), new Vector3(x2, drawY, z),
new Vector3(x1, armY, z), new Vector3(x1, armY, z),
new Vector3(x2, armY, z) new Vector3(x2, armY, z),
); );
if (!equaln(textRotation, 0) && textRotation) if (!equaln(textRotation, 0) && textRotation)
alDim.TextRotation = textRotation; alDim.TextRotation = textRotation;
alDim.LeadOutFlipped = isLeadOutFlipped; alDim.DefaultValue = { offset: new Vector2(-30, -72), isFlipped: isLeadOutFlipped };
alDim.LeadOutVisible = true;
alDim.ApplyMatrix(drawCS); alDim.ApplyMatrix(drawCS);
if (needJig) if (needJig)
{
alDim.LeadOutVisible = false;
JigUtils.Draw(alDim); JigUtils.Draw(alDim);
}
else else
app.Database.ModelSpace.Append(alDim); app.Database.ModelSpace.Append(alDim);

@ -1,4 +1,4 @@
import { Vector3 } from 'three'; import { Vector3, Matrix4 } from 'three';
import { app } from '../../ApplicationServices/Application'; import { app } from '../../ApplicationServices/Application';
import { Circle } from '../../DatabaseServices/Entity/Circle'; import { Circle } from '../../DatabaseServices/Entity/Circle';
import { Curve } from '../../DatabaseServices/Entity/Curve'; import { Curve } from '../../DatabaseServices/Entity/Curve';
@ -11,6 +11,7 @@ import { JigUtils } from '../../Editor/JigUtils';
import { PromptStatus } from '../../Editor/PromptResult'; import { PromptStatus } from '../../Editor/PromptResult';
import { ContinueDrawDimension } from './Command_DimContinue'; import { ContinueDrawDimension } from './Command_DimContinue';
const FootersRaiseValue = 20;
export enum DimensionType export enum DimensionType
{ {
Align = 0,//对齐标注 Align = 0,//对齐标注
@ -37,10 +38,13 @@ export class DrawAlignedDimension implements Command
BasePoint: footPt1, BasePoint: footPt1,
AllowDrawRubberBand: true, AllowDrawRubberBand: true,
}); });
let footPt2 = ptRes.Point;
if (ptRes.Status !== PromptStatus.OK) if (ptRes.Status !== PromptStatus.OK)
return; return;
let footPt2 = ptRes.Point;
let ucs = app.Editor.UCSMatrix.clone().setPosition(footPt1);
let ucsInv = new Matrix4().getInverse(ucs);
footPt2.applyMatrix4(ucsInv).setZ(0).applyMatrix4(ucs);
await this.BuildDim(footPt1, footPt2); await this.BuildDim(footPt1, footPt2);
} }
@ -101,6 +105,9 @@ export class DrawAlignedDimension implements Command
if (ptRes.Status == PromptStatus.OK) if (ptRes.Status == PromptStatus.OK)
{ {
alDim.TextPosition = ptRes.Point; alDim.TextPosition = ptRes.Point;
//抬高footers
alDim.RaiseFooters(FootersRaiseValue);
app.Database.ModelSpace.Append(alDim); app.Database.ModelSpace.Append(alDim);
await ContinueDrawDimension(alDim); await ContinueDrawDimension(alDim);
} }

@ -10,21 +10,4 @@ export class DrawLinearDimension extends DrawAlignedDimension
super(); super();
this.DimType = DimensionType.Linear; this.DimType = DimensionType.Linear;
} }
protected async SelectPointDim(footPt1: Vector3)
{
let ptRes = await app.Editor.GetPoint({
Msg: "请输入第二条尺寸线原点:",
BasePoint: footPt1,
AllowDrawRubberBand: true,
});
if (ptRes.Status !== PromptStatus.OK)
return;
let footPt2 = ptRes.Point;
let ucs = app.Editor.UCSMatrix.clone().setPosition(footPt1);
let ucsInv = new Matrix4().getInverse(ucs);
footPt2.applyMatrix4(ucsInv).setZ(0).applyMatrix4(ucs);
await this.BuildDim(footPt1, footPt2);
}
} }

@ -1,9 +1,9 @@
import { BufferGeometry, Line as TLine, Matrix3, Mesh, Object3D, Vector3, Vector2, Material } from "three"; import { BufferGeometry, Line as TLine, Matrix3, Mesh, Object3D, Vector3, Vector2, Material, Matrix4 } from "three";
import { ColorMaterial } from "../../Common/ColorPalette"; import { ColorMaterial } from "../../Common/ColorPalette";
import { FixedNotZero } from "../../Common/Utils"; import { FixedNotZero } from "../../Common/Utils";
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode"; import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
import { BufferGeometryUtils } from "../../Geometry/BufferGeometryUtils"; import { BufferGeometryUtils } from "../../Geometry/BufferGeometryUtils";
import { angle, angleAndX, midPoint, ZeroVec } from "../../Geometry/GeUtils"; import { angle, angleAndX, midPoint, ZeroVec, ZAxis, equaln, equalv3 } 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";
@ -20,6 +20,11 @@ interface LeadOutLinePts
dragPt: Vector3; dragPt: Vector3;
endPt: Vector3; endPt: Vector3;
} }
interface DefaultValue
{
offset: Vector2;
isFlipped: boolean;
}
/** /**
* *
* (线 LinearDimension) * (线 LinearDimension)
@ -34,12 +39,11 @@ export class AlignedDimension extends Entity
private _LeadOutLine = new TLine(); private _LeadOutLine = new TLine();
private _LeadOutOffsetY = 72; private _LeadOutOffsetY = 72;
private _LeadOutOffsetX = 30; private _LeadOutOffsetX = 30;
//引线是否反向(往左伸/往右伸) private _DefaultVal: DefaultValue = { offset: new Vector2(30, 72), isFlipped: false };
private _LeadOutIsFlipped: boolean = false;
//引线的拖拽点和终点 //引线的拖拽点和终点
private _LeadOutPts: LeadOutLinePts = { dragPt: midPoint(this.m_ArmP1, this.m_ArmP2), endPt: new Vector3() }; private _LeadOutPts: LeadOutLinePts = { dragPt: midPoint(this.m_ArmP1, this.m_ArmP2), endPt: new Vector3() };
//文字是否比footer间距更宽 //引线是否反向(往左伸/往右伸)
private needLeadOut: boolean = true; private _LeadOutIsFlipped: boolean = false;
//是否由拖拽更新_LeadOutPts.dragPt. 关系到引线的update //是否由拖拽更新_LeadOutPts.dragPt. 关系到引线的update
private isDragLeadOutPt: boolean = false; private isDragLeadOutPt: boolean = false;
constructor( constructor(
@ -50,8 +54,8 @@ export class AlignedDimension extends Entity
protected m_ArmP1: Vector3 = new Vector3(), protected m_ArmP1: Vector3 = new Vector3(),
protected m_ArmP2: Vector3 = new Vector3(), protected m_ArmP2: Vector3 = new Vector3(),
protected m_TextRotation: number = undefined, protected m_TextRotation: number = undefined,
//是否默认显示引线 //是否显示引线
protected m_LeadOutVisible: boolean = false, protected m_LeadOutVisible: boolean = true,
) )
{ {
super(); super();
@ -112,6 +116,39 @@ export class AlignedDimension extends Entity
this.Update(); this.Update();
} }
//创建以arm1,arm2为x轴 position在foot1的坐标系 用于定位引线
get DalUcs()
{
let dalUcs = new Matrix4();
if (!equaln(this.m_ArmP1.distanceTo(this.m_ArmP2), 0))
{
let vx = this.m_ArmP2.clone().sub(this.m_ArmP1);
if (this.m_ArmP1.x < this.m_ArmP2.x)
vx.negate();
let vy = vx.clone().cross(ZAxis);
dalUcs = new Matrix4().makeBasis(vx.normalize(), vy.normalize(), ZAxis.clone().normalize());
dalUcs.setPosition(this.m_FootP1);
}
return dalUcs;
}
RaiseFooters(num: number)
{
let dalucs = this.DalUcs;
let dalUcsInv = new Matrix4().getInverse(dalucs);
let p = new Vector3(0, num, 0);
let f1 = this.m_FootP1.clone().applyMatrix4(dalucs);
let f2 = this.m_FootP2.clone().applyMatrix4(dalucs);
let a1 = this.m_ArmP1.clone().applyMatrix4(dalucs);
if (a1.y < f1.y)
p.negate();
this.m_FootP1 = f1.add(p).applyMatrix4(dalUcsInv);
this.m_FootP2 = f2.add(p).applyMatrix4(dalUcsInv);
this.Update();
}
set TextRotation(angle: number) set TextRotation(angle: number)
{ {
this.m_TextRotation = angle; this.m_TextRotation = angle;
@ -145,28 +182,27 @@ export class AlignedDimension extends Entity
set LeadOutVisible(visible: boolean) set LeadOutVisible(visible: boolean)
{ {
this.WriteAllObjectRecord();
this.m_LeadOutVisible = visible; this.m_LeadOutVisible = visible;
this.Update(); this.Update();
} }
//引线朝右视为未翻转
set LeadOutFlipped(isFlipped: boolean) set LeadOutFlipped(isFlipped: boolean)
{ {
this.WriteAllObjectRecord();
this._LeadOutIsFlipped = isFlipped; this._LeadOutIsFlipped = isFlipped;
this.Update(); this.Update();
} }
toggleLeadOutVisible() toggleLeadOutVisible()
{ {
this.WriteAllObjectRecord(); this.LeadOutVisible = !this.m_LeadOutVisible;
this.m_LeadOutVisible = !this.m_LeadOutVisible;
this.Update();
} }
toggleLeadOutFlipped() toggleLeadOutFlipped()
{ {
this.WriteAllObjectRecord(); this.LeadOutFlipped = !this._LeadOutIsFlipped;
this._LeadOutIsFlipped = !this._LeadOutIsFlipped;
this.Update();
} }
set LeadOutOffsetY(size: number) set LeadOutOffsetY(size: number)
@ -181,11 +217,23 @@ export class AlignedDimension extends Entity
this.Update(); this.Update();
} }
set DefaultValue(val: DefaultValue)
{
this._DefaultVal = val;
this._LeadOutOffsetX = val.offset.x;
this._LeadOutOffsetY = val.offset.y;
this.LeadOutFlipped = val.isFlipped;
}
get DefaultValue()
{
return this._DefaultVal;
}
set TextSize(size: number) set TextSize(size: number)
{ {
this.WriteAllObjectRecord(); this.WriteAllObjectRecord();
this._Text.Height = size; this._Text.Height = size;
this.UpdateNeedLeadOut(size);
this.Update(); this.Update();
} }
@ -193,26 +241,23 @@ export class AlignedDimension extends Entity
{ {
return this._Text.Height; return this._Text.Height;
} }
UpdateNeedLeadOut(eachTextSize?: number)
{
let eachTextWidth = eachTextSize ? ~~(Math.abs(eachTextSize) / 2) : ~~(Math.abs(this.TextSize) / 2);
let distanceStr = FixedNotZero(this.m_ArmP1.distanceTo(this.m_ArmP2), 2);
let textWidth = new Vector3(distanceStr.length * (eachTextWidth));
this.needLeadOut = safeEval(distanceStr) < distanceStr.length * (eachTextWidth);
return textWidth;
}
Explode() Explode()
{ {
this.UpdateText(); this.UpdateText(this._Text.Position);
return [ let res =
[
new Line(this.m_FootP1.clone(), this.m_ArmP1.clone()), new Line(this.m_FootP1.clone(), this.m_ArmP1.clone()),
new Line(this.m_ArmP2.clone(), this.m_ArmP1.clone()), new Line(this.m_ArmP2.clone(), this.m_ArmP1.clone()),
new Line(this.m_ArmP2.clone(), this.m_FootP2.clone()), new Line(this.m_ArmP2.clone(), this.m_FootP2.clone()),
new Line(midPoint(this.m_ArmP1, this.m_ArmP2), this._LeadOutPts.dragPt.clone()),
new Line(this._LeadOutPts.dragPt.clone(), this._LeadOutPts.endPt.clone()),
this._Text.Clone() this._Text.Clone()
].map(en => en.ApplyMatrix(this.OCS)); ];
if (!equalv3(this._LeadOutPts.dragPt, midPoint(this.m_ArmP1, this.m_ArmP2)))
res.push(
new Line(midPoint(this.m_ArmP1, this.m_ArmP2), this._LeadOutPts.dragPt.clone()),
new Line(this._LeadOutPts.dragPt.clone(), this._LeadOutPts.endPt.clone())
);
return res.map(en => en.ApplyMatrix(this.OCS));
} }
Clone(): this Clone(): this
@ -307,69 +352,55 @@ export class AlignedDimension extends Entity
this.isDragLeadOutPt = false; this.isDragLeadOutPt = false;
} }
/**
* 线textPosition
* @returns textPosition(Vector3)
* @memberof AlignedDimension
*/
UpdateLeadOutLine(): Vector3 UpdateLeadOutLine(): Vector3
{ {
let textPosition: Vector3 = midPoint(this.m_ArmP1, this.m_ArmP2); let textPosition: Vector3 = midPoint(this.m_ArmP1, this.m_ArmP2);
if (this.m_LeadOutVisible) //引线可见
{
let textWidth = this.UpdateNeedLeadOut();
if (this.needLeadOut) //需要引线 let distance = this.m_ArmP1.distanceTo(this.m_ArmP2);
{ let distanceStr = FixedNotZero(distance, 2);
//确定引线方向(确定引线所有点的位置) let strWidth = distanceStr.length * (~~(Math.abs(this.TextSize) / 2));//文字总宽度
if (this._LeadOutIsFlipped) //引线已翻转(朝左) let needLeadOut = (safeEval(distanceStr) < strWidth + 1e-6) && !(equaln(distance, 0));//文字宽度是否比托盘更宽 是 则需要引线
if (this.m_LeadOutVisible && needLeadOut) //引线可见且需要引线
{ {
if (this.isDragLeadOutPt) //是否由拖拽更新dragPt let dalUcs = this.DalUcs;
if (this._LeadOutPts.dragPt.x < textPosition.x)//已经拖过中线 改变endPt 改变朝向值 let dalUcsInv = new Matrix4().getInverse(dalUcs);
let textWidthVec = new Vector3(strWidth);
let isLeft = (v) => { return v.x < midPoint(this.m_ArmP1, this.m_ArmP2).applyMatrix4(dalUcs).x; };
//确定引线的点的位置
if (this.isDragLeadOutPt)//是否拖拽了dragPt(拖拽dragPt需要更新endPt)
{ {
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidth); let dragPtInDalUcs = this._LeadOutPts.dragPt.clone().applyMatrix4(dalUcs);
this._LeadOutIsFlipped = false; let isleft = isLeft(dragPtInDalUcs.clone());
} if (isleft)//已经拖过中线 更新endPt 改变IsFlipped
this._LeadOutPts.endPt = dragPtInDalUcs.clone().sub(textWidthVec);
else else
{ this._LeadOutPts.endPt = dragPtInDalUcs.clone().add(textWidthVec);
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidth); this._LeadOutIsFlipped = !isleft;
this._LeadOutIsFlipped = true;
}
else //非拖拽
{
this._LeadOutPts.dragPt = textPosition.clone().add(new Vector3(this._LeadOutOffsetX, -this._LeadOutOffsetY));
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidth);
}
} }
else //引线未翻转(朝右) else //没有拖拽
{ {
if (this.isDragLeadOutPt)//是否由拖拽更新dragPt this._LeadOutPts.dragPt = textPosition.clone().applyMatrix4(dalUcs).add(new Vector3(this._LeadOutIsFlipped ? this._LeadOutOffsetX : -this._LeadOutOffsetX, this._LeadOutOffsetY));
if (this._LeadOutPts.dragPt.x > textPosition.x)//已经拖过中线 改变endPt 改变朝向值 if (isLeft(this._LeadOutPts.dragPt))
{ this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidthVec);
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidth);
this._LeadOutIsFlipped = true;
}
else else
{ this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidthVec);
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidth); this._LeadOutPts.dragPt.applyMatrix4(dalUcsInv);
this._LeadOutIsFlipped = false;
}
else //非拖拽
{
this._LeadOutPts.dragPt = textPosition.clone().sub(new Vector3(this._LeadOutOffsetX, this._LeadOutOffsetY));
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidth);
}
} }
this._LeadOutPts.endPt.applyMatrix4(dalUcsInv);
this._LeadOutLine.geometry = BufferGeometryUtils.CreateFromPts([textPosition, this._LeadOutPts.dragPt, this._LeadOutPts.endPt]); this._LeadOutLine.geometry = BufferGeometryUtils.CreateFromPts([textPosition, this._LeadOutPts.dragPt, this._LeadOutPts.endPt]);
this._LeadOutLine.material = ColorMaterial.GetLineMaterial(this.ColorIndex); this._LeadOutLine.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
this._LeadOutLine.visible = true; this._LeadOutLine.visible = true;
textPosition = midPoint(this._LeadOutPts.dragPt, this._LeadOutPts.endPt); textPosition = midPoint(this._LeadOutPts.dragPt, this._LeadOutPts.endPt);
} }
else //不需要引线 else //引线不可见或不需要引线
{
//使引线不可见 并将dragPt隐藏于托盘中点
this._LeadOutPts.dragPt = midPoint(this.m_ArmP1, this.m_ArmP2);
this._LeadOutLine.geometry = BufferGeometryUtils.CreateFromPts([]);
this._LeadOutLine.visible = false;
}
}
else //引线不可见
{ {
//使引线不可见 并将dragPt隐藏于托盘中点 //使引线不可见 并将dragPt隐藏于托盘中点
this._LeadOutPts.dragPt = midPoint(this.m_ArmP1, this.m_ArmP2); this._LeadOutPts.dragPt = midPoint(this.m_ArmP1, this.m_ArmP2);
@ -432,12 +463,13 @@ export class AlignedDimension extends Entity
{ {
if (i === 5) if (i === 5)
{ {
//开始拖拽引线夹点(_LeadOutPts.dragPt) let dalucs = this.DalUcs;
//开始拖拽引线dragPt
this.isDragLeadOutPt = true; this.isDragLeadOutPt = true;
vec = vec.clone().applyMatrix4(this.OCSInv.clone().setPosition(ZeroVec)); vec = vec.clone().applyMatrix4(this.OCSInv.clone().setPosition(ZeroVec));
this._LeadOutPts.dragPt.add(vec); this._LeadOutPts.dragPt.add(vec);
let calcV = this._LeadOutPts.dragPt.clone().sub(midPoint(this.m_ArmP1, this.m_ArmP2)); let calcV = this._LeadOutPts.dragPt.clone().applyMatrix4(dalucs).sub(midPoint(this.m_ArmP1, this.m_ArmP2).applyMatrix4(dalucs));
this._LeadOutOffsetY = calcV.y * -1; this._LeadOutOffsetY = calcV.y;
this._LeadOutOffsetX = Math.abs(calcV.x); this._LeadOutOffsetX = Math.abs(calcV.x);
} }
else if (i >= 2) else if (i >= 2)
@ -519,12 +551,14 @@ export class AlignedDimension extends Entity
this._LeadOutOffsetY = file.Read(); this._LeadOutOffsetY = file.Read();
this._LeadOutOffsetX = file.Read(); this._LeadOutOffsetX = file.Read();
} }
if (ver > 4)
this.TextSize = file.Read();
} }
//对象将自身数据写入到文件. //对象将自身数据写入到文件.
WriteFile(file: CADFiler) WriteFile(file: CADFiler)
{ {
super.WriteFile(file); super.WriteFile(file);
file.Write(4); file.Write(5);
file.Write(this.m_ArmP1.toArray()); file.Write(this.m_ArmP1.toArray());
file.Write(this.m_ArmP2.toArray()); file.Write(this.m_ArmP2.toArray());
file.Write(this.m_FootP1.toArray()); file.Write(this.m_FootP1.toArray());
@ -537,6 +571,8 @@ export class AlignedDimension extends Entity
file.Write(this._LeadOutPts.dragPt.toArray()); file.Write(this._LeadOutPts.dragPt.toArray());
file.Write(this._LeadOutOffsetY); file.Write(this._LeadOutOffsetY);
file.Write(this._LeadOutOffsetX); file.Write(this._LeadOutOffsetX);
file.Write(this.TextSize);
} }
//#endregion //#endregion
} }

@ -42,7 +42,7 @@ export class TextArea extends Singleton
this.m_CurrentValue = str; this.m_CurrentValue = str;
this.CreateEditorArea(); this.CreateEditorArea();
} }
StartEditorText(textObj) StartEditorText(textObj, editorPosition?: Vector3)
{ {
let text = GetEntity(textObj) as Text; let text = GetEntity(textObj) as Text;
if (text) if (text)
@ -58,7 +58,7 @@ export class TextArea extends Singleton
this.m_TextHeight = text.Height; this.m_TextHeight = text.Height;
this.m_TextRotation = text.TextRotation; this.m_TextRotation = text.TextRotation;
this.m_CurrentValue = text.TextString; this.m_CurrentValue = text.TextString;
this.CreateEditorArea(); this.CreateEditorArea(editorPosition);
} }
} }
WorldToScreenHeight(h: number) WorldToScreenHeight(h: number)
@ -67,7 +67,7 @@ export class TextArea extends Singleton
let radio = h / heightWCS; let radio = h / heightWCS;
return app.Viewer.Height * radio; return app.Viewer.Height * radio;
} }
CreateEditorArea() CreateEditorArea(position?: Vector3)
{ {
let height = this.TextareaHeight; let height = this.TextareaHeight;
let pos = this.ScreenPostion; let pos = this.ScreenPostion;
@ -91,8 +91,8 @@ export class TextArea extends Singleton
min-width:100px; min-width:100px;
font-size:${height}px; font-size:${height}px;
min-height:${height}px; min-height:${height}px;
left:${pos.x + rect.left}px; left:${position?.x ?? pos.x + rect.left}px;
top:${pos.y - height + rect.top}px; top:${position?.y ?? pos.y - height + rect.top}px;
`; `;
this.m_AreaContiner.appendChild(textarea); this.m_AreaContiner.appendChild(textarea);
textarea.focus(); textarea.focus();

@ -216,6 +216,7 @@ export class BoardMoveTool
{ {
let dim = new AlignedDimension(); let dim = new AlignedDimension();
dim.Text.Height = 20; dim.Text.Height = 20;
dim.LeadOutVisible = false;
this._DrawDims.push(dim); this._DrawDims.push(dim);
app.Viewer.PreViewer.Scene.add(dim.DrawObject); app.Viewer.PreViewer.Scene.add(dim.DrawObject);
} }

@ -83,7 +83,7 @@ export class DbClickManager extends Singleton
{ {
let o = new Object3D(); let o = new Object3D();
o.userData.Entity = pickEnt.Text; o.userData.Entity = pickEnt.Text;
textarea.StartEditorText(o); textarea.StartEditorText(o, app.Editor.MouseCtrl.m_CurMousePointClient);
await textarea.Wait(); await textarea.Wait();
pickEnt.TextString = o.userData.Entity.TextString; pickEnt.TextString = o.userData.Entity.TextString;
delete o.userData.Entity; delete o.userData.Entity;

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { Card, Classes, Button, Slider, NumericInput, Position, Intent, Tooltip } from "@blueprintjs/core"; import { Card, Classes, Button, Slider, NumericInput, Position, Intent, Tooltip } from "@blueprintjs/core";
import { app } from "../../../ApplicationServices/Application"; import { app } from "../../../ApplicationServices/Application";
import { KeyBoard } from "../../../Common/KeyEnum"; import { KeyBoard, KeyCode } from "../../../Common/KeyEnum";
import { safeEval } from "../../../Common/eval"; import { safeEval } from "../../../Common/eval";
import { AlignedDimension } from "../../../DatabaseServices/Dimension/AlignedDimension"; import { AlignedDimension } from "../../../DatabaseServices/Dimension/AlignedDimension";
import { observable } from "mobx"; import { observable } from "mobx";
@ -47,6 +47,16 @@ export class Properties_DimPanel extends React.Component<Properties_DimPanelProp
app.Viewer.GripScene.Update(al.DrawObject); app.Viewer.GripScene.Update(al.DrawObject);
} }
}), }),
end(app.Editor.KeyCtrl, app.Editor.KeyCtrl.OnKeyUp, (e: KeyboardEvent) =>
{
if (app.Editor.KeyCtrl.KeyIsDown(KeyCode.ControlLeft))
if (e.code === KeyCode.KeyZ || e.code === KeyCode.KeyY)
{
let numval = this.props.ents[0].TextSize;
this.dim_TextSize = numval;
this.numericInputVal = numval.toString();
}
})
); );
} }
componentWillUnmount() componentWillUnmount()
@ -64,10 +74,10 @@ export class Properties_DimPanel extends React.Component<Properties_DimPanelProp
for (let al of als) for (let al of als)
{ {
al.TextSize = 60; al.TextSize = 60;
al.LeadOutOffsetY = 72; al.LeadOutOffsetY = al.DefaultValue.offset.y;
al.LeadOutOffsetX = 30; al.LeadOutOffsetX = al.DefaultValue.offset.x;
al.LeadOutFlipped = al.DefaultValue.isFlipped;
al.LeadOutVisible = true; al.LeadOutVisible = true;
al.LeadOutFlipped = false;
al.ColorIndex = 7; al.ColorIndex = 7;
propsStore.colorIndex = 7;//todo 撤销的时候UI颜色没有同步更改 propsStore.colorIndex = 7;//todo 撤销的时候UI颜色没有同步更改
this.numericInputVal = "60"; this.numericInputVal = "60";

Loading…
Cancel
Save