This commit is contained in:
ChenX
2024-10-29 17:14:43 +08:00
parent 3cdbeeb178
commit dccd6ec73e
2683 changed files with 37067 additions and 201 deletions

View File

@@ -0,0 +1,12 @@
import { Font, Shape } from "three";
export declare class FontExt extends Font {
/**
* @param {string} text
* @param {number} [size=100]
* @param {number} [widthFactor=1] 宽度因子
* @return {*}
* @memberof FontExt
*/
generateShapes(text: string, size?: number, widthFactor?: number): Shape[];
}
//# sourceMappingURL=FontExt.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"FontExt.d.ts","sourceRoot":"","sources":["../../../../src/DatabaseServices/Text/FontExt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAQ,KAAK,EAAsB,MAAM,OAAO,CAAC;AAO9D,qBAAa,OAAQ,SAAQ,IAAI;IAE7B;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,EAAE,WAAW,SAAI;CAQnE"}

View File

@@ -0,0 +1,33 @@
import { FontExt } from "./FontExt";
/**
* 字体加载器
* # Example:
```
let l = FontLoader.GetLoader("宋体");//得到某个字体的加载器
l.LoadGlyphs(""); //这行代码同时初始化了字体.
await l.AwaitLoaded(); //等待载入完成
let ft = l.Font; //得到字体
```
*/
export declare class FontLoader {
FontName: string;
Font: FontExt;
private constructor();
/**
* 得到某个字体的加载器
* @param fontName 字体名称
* @returns 字体加载器
*/
static GetLoader(fontName: string): FontLoader;
LoadGlyphs(str: string): Promise<void>;
private waitsFunction;
AwaitLoaded(): Promise<boolean>;
/**
* 初始化加载器
*/
private Init;
private _LoadIng;
private _LoadQueue;
private LoodLoop;
}
//# sourceMappingURL=FontLoader.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../../../../src/DatabaseServices/Text/FontLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC;;;;;;;;;GASG;AACH,qBAAa,UAAU;IAGQ,QAAQ,EAAE,MAAM;IAD3C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO;IAIP;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM;IAW3B,UAAU,CAAC,GAAG,EAAE,MAAM;IAM5B,OAAO,CAAC,aAAa,CAAM;IAErB,WAAW;IAWjB;;OAEG;YACW,IAAI;IAOlB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAgB;YACpB,QAAQ;CAgBzB"}

88
types/DatabaseServices/Text/Text.d.ts vendored Normal file
View File

@@ -0,0 +1,88 @@
import { Matrix3, Matrix4, Object3D, Vector3 } from 'three';
import { FontType } from '../../Add-on/TextStyle/FontStyleInterface';
import { ObjectSnapMode } from '../../Editor/ObjectSnapMode';
import { Box3Ext } from '../../Geometry/Box';
import { RenderType } from '../../GraphicsSystem/RenderType';
import { CADFiler } from '../CADFiler';
import { Entity } from '../Entity/Entity';
import { FontStyleKeyCode } from '../FontStyle/FontStyleKeyCodeEnum';
import { ObjectId } from '../ObjectId';
export declare const TEXT_HEIGHT_SCALE = 1.35;
export declare enum TextAligen {
LeftTop = 3,
Top = 1,
RightTop = 5,
LeftMid = 2,
Mid = 0,
RightMid = 4,
LeftDown = 10,
Down = 8,
RightDown = 12
}
export declare function DisposeTextShapeCache(): void;
/**
* 单/多行文字实体
*/
export declare class Text extends Entity {
private _TextString;
private _TextRotation;
protected OnlyRenderType: boolean;
protected _FontStyle: ObjectId;
protected _FontStyleOverride: Map<FontStyleKeyCode, any>;
protected _RoomName: string;
protected _CabinetName: string;
private _Align;
IsDoubleMesh: boolean;
IsFsText: boolean;
constructor(pos?: Vector3, _TextString?: string, _TextRotation?: number, fontName?: FontType, widthFactor?: number);
get RoomName(): string;
set RoomName(value: string);
get CabinetName(): string;
set CabinetName(value: string);
get TextRotation(): number;
set TextRotation(v: number);
get TextString(): string;
set TextString(str: string);
set TextAligen(al: TextAligen);
get TextAligen(): TextAligen;
/**设置字体样式 */
set FontStyle(styleId: ObjectId);
/**大概多行文字的高度 */
get MultiHeight(): number;
get FontStyle(): ObjectId;
get FontName(): FontType;
set FontName(fontName: FontType);
get Height(): number;
set Height(value: number);
get WidthFactor(): number;
set WidthFactor(value: number);
get FontStyleOverride(): Map<FontStyleKeyCode, any>;
GetFontStyleOverrideValue(key: FontStyleKeyCode): any;
GetFontStyleValue(key: FontStyleKeyCode): any;
SetFontStyleOverrideValue(key: FontStyleKeyCode, value: any): void;
ClearFontStyleOverride(): void;
AsyncUpdateDrawObject(obj: Object3D, renderType: RenderType): Promise<void>;
/**大概宽度 */
get Width(): number;
get HasBoundingBox(): boolean;
get BoundingBox(): Box3Ext | import("three").Box3;
get BoundingBoxInOCS(): Box3Ext;
UpdateTranslate(): void;
private UpdateObjectTranslate;
ApplyMatrix(m: Matrix4): this;
protected ApplyScaleMatrix(m: Matrix4): this;
InitDrawObject(renderType?: RenderType): Object3D;
UpdateDrawObject(type: RenderType, obj: Object3D): void;
UpdateDrawObjectMaterial(renderType: RenderType, en: Object3D): void;
GetGripPoints(): Array<Vector3>;
MoveGripPoints(indexList: number[], vec: Vector3): void;
GetObjectSnapPoints(snapMode: ObjectSnapMode, pickPoint: Vector3, lastPoint: Vector3, viewXform?: Matrix3): Vector3[];
GetStretchPoints(): Array<Vector3>;
MoveStretchPoints(indexList: Array<number>, vec: Vector3): void;
protected ReadFontStyle(file: CADFiler): void;
protected WriteFontStyle(file: CADFiler): void;
protected _ReadFile(file: CADFiler): void;
WriteFile(file: CADFiler): void;
}
export declare const DbText: typeof Text;
//# sourceMappingURL=Text.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/DatabaseServices/Text/Text.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,OAAO,EAAE,OAAO,EAAQ,QAAQ,EAAiB,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3G,OAAO,EAAE,QAAQ,EAA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AAE,OAAO,GAAG,IAAI;IAM7B,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;IAW5C,cAAc,CAAC,UAAU,GAAE,UAAiC,GAAG,QAAQ;IAqBvE,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ;IAIhD,wBAAwB,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ;IAU7D,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC;IAI/B,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO;IAYhD,mBAAmB,CACf,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,OAAO,EAClB,SAAS,CAAC,EAAE,OAAO,GACpB,OAAO,EAAE;IAcZ,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC;IAIlC,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO;IAOxD,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ;IAWtC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ;IAWvC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ;IA+BlC,SAAS,CAAC,IAAI,EAAE,QAAQ;CAgB3B;AAGD,eAAO,MAAM,MAAM,aAAO,CAAC"}

View File

@@ -0,0 +1,41 @@
import { Vector3 } from 'three';
import { FontType } from '../../Add-on/TextStyle/FontStyleInterface';
import { Singleton } from '../../Common/Singleton';
import { Text } from './Text';
export interface TextRoomCabinetName {
roomName: string;
cabinetName: string;
}
export declare class TextArea extends Singleton {
private _AreaContiner;
private _EditorElList;
private _TextHeight;
private _TextPosition;
private _TextRotation;
private _CurrentValue;
private _EditoringObject;
private _FontType;
private _TextRoomCabinetName;
constructor();
StartDrawText(position: Vector3, height: number, rotate: number, str: string, fontType: FontType, textRoomCabinet?: TextRoomCabinetName): void;
StartEditorText(textObj: any, editorPosition?: Vector3): void;
WorldToScreenHeight(h: number): number;
CreateEditorArea(position?: Vector3): void;
get TextareaHeight(): number;
get ScreenPostion(): Vector3;
rm: Function;
RegisterEvent(): void;
ClearEvent(): void;
DispatchEsc: () => void;
OnKeyDown: (e: KeyboardEvent) => void;
OnClick: (e: MouseEvent) => void;
OnBlur: (e: Event) => Promise<void>;
/**
*清除监听事件,将编辑的内容构建文字对象,更新视图,移除编辑框Dom
*/
EndEditor(): Promise<void>;
EndEditorEvent(text: Text): void;
private waitPromis;
Wait(): Promise<unknown>;
}
//# sourceMappingURL=TextArea.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/DatabaseServices/Text/TextArea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAIrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,OAAO,EAAqB,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAEhC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAGD,qBAAa,QAAS,SAAQ,SAAS;IAEnC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,aAAa,CAA2C;IAEhE,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,gBAAgB,CAAW;IACnC,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,oBAAoB,CAAsB;;IAgBlD,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAA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