修复:捕捉尺寸配置可用

pull/968/head
ChenX 4 years ago
parent 18cb7abfb0
commit dcb050d56f

@ -1,4 +1,4 @@
import { Object3D, Points, Vector3 } from 'three'; import { BufferGeometry, Line as TLine, Points, Vector3 } from 'three';
import { end } from 'xaop'; import { end } from 'xaop';
import { app } from '../ApplicationServices/Application'; import { app } from '../ApplicationServices/Application';
import { ColorMaterial } from '../Common/ColorPalette'; import { ColorMaterial } from '../Common/ColorPalette';
@ -7,7 +7,9 @@ import { MouseKey } from '../Common/KeyEnum';
import { GetEntity } from '../Common/Utils'; import { GetEntity } from '../Common/Utils';
import { Entity } from '../DatabaseServices/Entity/Entity'; import { Entity } from '../DatabaseServices/Entity/Entity';
import { Line } from '../DatabaseServices/Entity/Line'; import { Line } from '../DatabaseServices/Entity/Line';
import { BufferGeometryUtils } from '../Geometry/BufferGeometryUtils';
import { isParallelTo, isPerpendicularityTo, SnapPoint } from '../Geometry/GeUtils'; import { isParallelTo, isPerpendicularityTo, SnapPoint } from '../Geometry/GeUtils';
import { PointShapeUtils } from '../Geometry/PointShapeUtils';
import { DrawMode } from '../GraphicsSystem/PreViewer'; import { DrawMode } from '../GraphicsSystem/PreViewer';
import { CommandWrap } from './CommandMachine'; import { CommandWrap } from './CommandMachine';
import { Editor, EditorService } from './Editor'; import { Editor, EditorService } from './Editor';
@ -23,7 +25,7 @@ export class GripDragServices implements EditorService
//最后捕捉的点的位置(在WCS中) //最后捕捉的点的位置(在WCS中)
lastSnapPoint: Vector3; lastSnapPoint: Vector3;
private mouseCtrl: MouseControls; private mouseCtrl: MouseControls;
SnapSize = 15; private _SnapSize = 15;
constructor(private ed: Editor) constructor(private ed: Editor)
{ {
this.mouseCtrl = ed.MouseCtrl; this.mouseCtrl = ed.MouseCtrl;
@ -35,6 +37,20 @@ export class GripDragServices implements EditorService
}); });
} }
get SnapSize() { return this._SnapSize; }
set SnapSize(size: number)
{
if (size !== this._SnapSize)
{
this._SnapSize = size;
if (this.previewCrossLine)
{
let geo = this.previewCrossLine.geometry as BufferGeometry;
BufferGeometryUtils.UpdatePts(geo, PointShapeUtils.CrossLinePts(this._SnapSize));
}
}
}
get IsReady() get IsReady()
{ {
return this.lastSnapPoint && this.ed.InputState === InputState.None; return this.lastSnapPoint && this.ed.InputState === InputState.None;
@ -222,7 +238,7 @@ export class GripDragServices implements EditorService
/** /**
* *
*/ */
previewCrossLine: Object3D = undefined; previewCrossLine: TLine = undefined;
/** /**
* *

@ -49,7 +49,7 @@ export class UserConfig implements IConfigStore
@observable SystemConfig: ISystemConfig = { @observable SystemConfig: ISystemConfig = {
maxHightightCount: 1000, maxHightightCount: 1000,
snapSize: 15, snapSize: 15,
aaType: AAType.FXAA aaType: AAType.SMAA
}; };
constructor() constructor()
{ {

@ -3,7 +3,7 @@ import { Vector3 } from "three";
export class PointShapeUtils export class PointShapeUtils
{ {
//方形点表 //方形点表
static SquarePts(size) static SquarePts(size: number)
{ {
return [ return [
new Vector3(-size, -size), new Vector3(-size, -size),
@ -14,7 +14,7 @@ export class PointShapeUtils
]; ];
} }
//方形外圈十字直线点表 //方形外圈十字直线点表
static OutsideLinePts(squareSize, lineLength) static OutsideLinePts(squareSize: number, lineLength: number)
{ {
return [ return [
//-X //-X

@ -50,6 +50,7 @@ export class ConfigStore extends Singleton
app.Viewer.AAType = userConfig.SystemConfig.aaType; app.Viewer.AAType = userConfig.SystemConfig.aaType;
app.Editor.SelectCtrl.MaxHightightCount = userConfig.SystemConfig.maxHightightCount; app.Editor.SelectCtrl.MaxHightightCount = userConfig.SystemConfig.maxHightightCount;
app.Editor.SnapDragServices.SnapSize = userConfig.SystemConfig.snapSize; app.Editor.SnapDragServices.SnapSize = userConfig.SystemConfig.snapSize;
app.Editor.GetPointServices.snapServices.SnapSize = userConfig.SystemConfig.snapSize;
await userConfigStore.SaveConfig(BoardModalType.UserConfig, userConfig); await userConfigStore.SaveConfig(BoardModalType.UserConfig, userConfig);
}; };
} }

@ -134,6 +134,7 @@ export class UserConfigStore extends Singleton
app.Viewer.AAType = userConfig.SystemConfig.aaType; app.Viewer.AAType = userConfig.SystemConfig.aaType;
app.Editor.SelectCtrl.MaxHightightCount = userConfig.SystemConfig.maxHightightCount; app.Editor.SelectCtrl.MaxHightightCount = userConfig.SystemConfig.maxHightightCount;
app.Editor.SnapDragServices.SnapSize = userConfig.SystemConfig.snapSize; app.Editor.SnapDragServices.SnapSize = userConfig.SystemConfig.snapSize;
app.Editor.GetPointServices.snapServices.SnapSize = userConfig.SystemConfig.snapSize;
} }
else else
{ {

Loading…
Cancel
Save