mxcad 1.0.289 → 1.0.291

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mxcad.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  // Generated by dts-bundle-generator v6.13.0
2
2
 
3
3
  import { DetailedResult, DynamicInputType, McEdGetPointWorldDrawObject, MrxDbgUiPrBaseReturn, MrxDbgUiPrPoint, MxCursorType, MxDbEntity, MxDrawObject } from 'mxdraw';
4
- import * as THREE from 'three';
5
4
 
6
5
  /**
7
6
  * 将数据进行 Base64 编码
@@ -725,7 +724,6 @@ export declare class McGePoint3d {
725
724
  * @example
726
725
  * ```ts
727
726
  * import { McGePoint3d } from "mxcad";
728
- * import THREE from "three";
729
727
  *
730
728
  * const pt_vec = new THREE.Vector3(20,50,0);
731
729
  * const pt = pt_vec.setFromVector3();
@@ -2129,7 +2127,6 @@ export declare class MxCoordConvertType {
2129
2127
  * @example
2130
2128
  * ```ts
2131
2129
  * import { MxCpp, McGePoint3d } from 'mxcad';
2132
- * import THREE from "three"
2133
2130
  *
2134
2131
  * const mxcad = MxCpp.getCurrentCAD();
2135
2132
  * let pt = mxcad.doc2cad1(new THREE.Vector3(20, 10));
@@ -2145,7 +2142,6 @@ export declare class MxCoordConvertType {
2145
2142
  * @example
2146
2143
  * ```ts
2147
2144
  * import { MxCpp, McGePoint3d } from 'mxcad';
2148
- * import THREE from "three"
2149
2145
  *
2150
2146
  * const mxcad = MxCpp.getCurrentCAD();
2151
2147
  * let pt = mxcad.doc2cad1(20, 10, 0);
@@ -11125,7 +11121,7 @@ export type CreateColorArgs = THREEColorArgs | [
11125
11121
  * @param ages 颜色参数
11126
11122
  * @returns THREE.Color
11127
11123
  * */
11128
- export declare const getColorUtils: (...ages: THREEColorArgs) => THREE.Color;
11124
+ export declare const getColorUtils: (...ages: THREEColorArgs) => import("three").Color;
11129
11125
  /**
11130
11126
  * 创建颜色对象
11131
11127
  * @param ages 颜色参数类型
@@ -12768,7 +12764,7 @@ export declare class McAppType {
12768
12764
  * }
12769
12765
  * ```
12770
12766
  */
12771
- addNetworkLoadingFont(fontfiles: string | string[], fontFilesLoadOnInitialization?: string[]): void;
12767
+ addNetworkLoadingFont(fontfiles: string | string[], fontFilesLoadOnInitialization?: string[], isAddTo?: boolean): void;
12772
12768
  /**
12773
12769
  * 全局参数的初始设置
12774
12770
  * @param ini 初始设置值
@@ -12808,7 +12804,7 @@ export declare class McAppType {
12808
12804
  * }
12809
12805
  * ```
12810
12806
  */
12811
- addNetworkLoadingBigFont(fontfiles: string | string[], fontFilesLoadOnInitialization?: string[]): void;
12807
+ addNetworkLoadingBigFont(fontfiles: string | string[], fontFilesLoadOnInitialization?: string[], isAddTo?: boolean): void;
12812
12808
  /**
12813
12809
  * 配置需要通过网络加载的Truetype字体
12814
12810
  * @param fontname 字体名
@@ -12884,7 +12880,15 @@ export declare class McAppType {
12884
12880
  }
12885
12881
  * ```
12886
12882
  */
12887
- loadFonts(vecShxFonst: string[], vecBigShxFonst: string[], vecTureTypeFonts: string[], retCall: () => void): void;
12883
+ loadFonts(vecShxFonts: string[], vecBigShxFonts: string[], vecTureTypeFonts: string[], retCall: () => void): void;
12884
+ /**
12885
+ * 得到该字体是否已经从网上加载
12886
+ * @returns boolean
12887
+ * @example
12888
+ * ```ts
12889
+ * ```
12890
+ */
12891
+ isAlreadyLoaded(sFont: string, iType?: number): boolean;
12888
12892
  /**
12889
12893
  * 得到当前支持的所有TrueType字体.
12890
12894
  * @returns { object } name 字体名| zhname 字体中文名 | file 字体文件
@@ -13744,10 +13748,6 @@ export declare abstract class McDbCustomEntity extends McDbEntity {
13744
13748
  */
13745
13749
  abstract worldDraw(draw: MxCADWorldDraw): void;
13746
13750
  }
13747
- declare function convertCadPointToSlatePoint(this: MxCADMText, point: McGePoint3d): {
13748
- path: number[];
13749
- offset: number;
13750
- } | null;
13751
13751
  export interface MarksStyleText {
13752
13752
  text: string;
13753
13753
  font?: string;
@@ -13759,6 +13759,7 @@ export interface MarksStyleText {
13759
13759
  style?: string;
13760
13760
  overline?: boolean;
13761
13761
  color?: number | number[];
13762
+ customType?: string;
13762
13763
  }
13763
13764
  export type CustomText = MarksStyleText;
13764
13765
  export interface BaseElement {
@@ -13775,30 +13776,6 @@ export interface IMxEditorPoint {
13775
13776
  offset: number;
13776
13777
  }
13777
13778
  export type IMxEditorDescendant = IMxEditorNode | MarksStyleText;
13778
- declare function convertSlatePointToCadPoint(this: MxCADMText, point: IMxEditorPoint): {
13779
- point: McGePoint3d;
13780
- lineIndex: number;
13781
- } | null;
13782
- declare function worldDraw(this: MxCADMText, draw: MxCADWorldDraw): void;
13783
- export interface BoxInfo {
13784
- start: McGePoint3d;
13785
- end: McGePoint3d;
13786
- width: number;
13787
- box: {
13788
- minPt: McGePoint3d;
13789
- maxPt: McGePoint3d;
13790
- };
13791
- }
13792
- export interface TextInfo extends BoxInfo {
13793
- mcText?: McDbEntity;
13794
- node: MarksStyleText;
13795
- height: number;
13796
- box: {
13797
- minPt: McGePoint3d;
13798
- maxPt: McGePoint3d;
13799
- ret: boolean;
13800
- };
13801
- }
13802
13779
  declare enum BreakType {
13803
13780
  None = "none",
13804
13781
  Overflow = "overflow",
@@ -13806,10 +13783,8 @@ declare enum BreakType {
13806
13783
  Forced = "forced"
13807
13784
  }
13808
13785
  export interface RenderParagraphResult {
13809
- textInfos: TextInfo[];
13810
13786
  position: McGePoint3d;
13811
13787
  width: number;
13812
- entityArr: McDbEntity[];
13813
13788
  height: number;
13814
13789
  lines: LineInfo[];
13815
13790
  }
@@ -13830,22 +13805,39 @@ export interface LineInfo {
13830
13805
  horizontalOffset?: number;
13831
13806
  bottomSpacing?: number;
13832
13807
  }
13833
- declare function transformBy(this: MxCADMText, met: McGeMatrix3d): boolean;
13834
- declare class MultilineTextConverter {
13835
- /**
13836
- * 将McDbMText实体转换为McDbCustomEditorEntity
13837
- * @param mtext CAD多行文本实体
13838
- * @param options 转换选项
13839
- * @returns 自定义编辑器实体
13840
- */
13841
- static fromMText(mtext: McDbMText): MxCADMText;
13842
- /**
13843
- * 将McDbCustomEditorEntity转换为McDbMText
13844
- * @param customEntity 自定义编辑器实体
13845
- * @param options 转换选项
13846
- * @returns CAD多行文本实体
13847
- */
13848
- static toMText(mtext: McDbMText, customEntity: MxCADMText): McDbMText;
13808
+ export interface CalculateData {
13809
+ width: number;
13810
+ height: number;
13811
+ lines: LineInfo[];
13812
+ }
13813
+ export interface RenderData {
13814
+ position: McGePoint3d;
13815
+ index: number;
13816
+ alignmentWidth: number;
13817
+ }
13818
+ export interface RenderResult {
13819
+ position: McGePoint3d;
13820
+ width: number;
13821
+ height: number;
13822
+ lines: LineInfo[];
13823
+ }
13824
+ declare abstract class MxCADBaseCustomElemnet {
13825
+ /** 是否是行内元素 具体可以参考Slate行内元素的定义 */
13826
+ isInline?: boolean;
13827
+ /** 是否是空元素 具体可以参考Slate空元素的定义 */
13828
+ isVoid?: boolean;
13829
+ /** 类型 */
13830
+ abstract type: string;
13831
+ abstract calculate(entity: MxCADMText, element: IMxEditorElement, index: number): CalculateData;
13832
+ abstract render(entity: MxCADMText, draw: MxCADWorldDraw, calculateData: CalculateData, renderData: RenderData): RenderResult;
13833
+ }
13834
+ declare class ElementTextManager {
13835
+ private elementMap;
13836
+ constructor();
13837
+ /** 注册自定义元素 */
13838
+ registerElement(props: MxCADBaseCustomElemnet): void;
13839
+ get(type: string): MxCADBaseCustomElemnet | undefined;
13840
+ has(type: string): boolean;
13849
13841
  }
13850
13842
  export type EventType = string | symbol;
13851
13843
  export type PubSubEvent = Record<EventType, (...ages: any) => any>;
@@ -13879,6 +13871,7 @@ declare class PubSub<Events extends PubSubEvent = PubSubEvent> {
13879
13871
  */
13880
13872
  off<Key extends keyof Events>(event: Key, callback?: Events[keyof Events]): void;
13881
13873
  }
13874
+ declare function getActualRenderStartPosition(this: MxCADMTextImp, contentHeight?: number, contentWidth?: number): McGePoint3d;
13882
13875
  declare function getLinePosition(this: MxCADMTextImp, paragraphIndex: number, lineIndex: number): {
13883
13876
  start: McGePoint3d;
13884
13877
  end: McGePoint3d;
@@ -13886,9 +13879,6 @@ declare function getLinePosition(this: MxCADMTextImp, paragraphIndex: number, li
13886
13879
  maxPt: McGePoint3d;
13887
13880
  height: number;
13888
13881
  } | null;
13889
- declare function getParagraphLines(this: MxCADMTextImp, paragraphIndex: number): LineInfo[];
13890
- declare function getLineCount(this: MxCADMTextImp, paragraphIndex: number): number;
13891
- declare function getActualRenderStartPosition(this: MxCADMTextImp, contentHeight?: number, contentWidth?: number): McGePoint3d;
13892
13882
  declare class MxCADMTextImp extends PubSub<{
13893
13883
  "changed": () => void;
13894
13884
  }> {
@@ -13905,7 +13895,6 @@ declare class MxCADMTextImp extends PubSub<{
13905
13895
  lineHeightRatio: number;
13906
13896
  entityType: "custom" | "mtext";
13907
13897
  isEditState: boolean;
13908
- _auxiliaryBox: () => void;
13909
13898
  __PARAGRAPH_INFOS__: RenderParagraphResult[];
13910
13899
  dwgInFields(filter: IMcDbDwgFiler): boolean;
13911
13900
  dwgOutFields(filter: IMcDbDwgFiler): boolean;
@@ -13913,17 +13902,22 @@ declare class MxCADMTextImp extends PubSub<{
13913
13902
  getActualRenderStartPosition: typeof getActualRenderStartPosition;
13914
13903
  moveGripPointsAt(iIndex: number, dXOffset: number, dYOffset: number, dZOffset: number): void;
13915
13904
  getGripPoints(): McGePoint3dArray;
13916
- worldDraw: typeof worldDraw;
13917
- /** CAD坐标转换为Slate的Point位置 */
13918
- convertCadPointToSlatePoint: typeof convertCadPointToSlatePoint;
13919
- /** Slate的Point位置转换为CAD坐标 */
13920
- convertSlatePointToCadPoint: typeof convertSlatePointToCadPoint;
13921
13905
  /** 获取指定段落和行的位置信息 */
13922
13906
  getLinePosition: typeof getLinePosition;
13923
- /** 获取段落行数 */
13924
- getParagraphLines: typeof getParagraphLines;
13925
- /** 获取行数 */
13926
- getLineCount: typeof getLineCount;
13907
+ /**
13908
+ * 获取指定段落的行信息
13909
+ * @param this McDbCustomEditorEntity实例
13910
+ * @param paragraphIndex 段落索引
13911
+ * @returns 段落中的所有行信息
13912
+ */
13913
+ getParagraphLines(paragraphIndex: number): LineInfo[];
13914
+ /**
13915
+ * 获取指定段落的行数
13916
+ * @param this McDbCustomEditorEntity实例
13917
+ * @param paragraphIndex 段落索引
13918
+ * @returns 行数
13919
+ */
13920
+ getLineCount(paragraphIndex: number): number;
13927
13921
  /** 获取文本节点高度 */
13928
13922
  getTextHeight: (node: MarksStyleText, baseHeight: number) => number;
13929
13923
  /** 获取最大宽度 */
@@ -13949,6 +13943,32 @@ declare class MxCADMTextImp extends PubSub<{
13949
13943
  /** 设置实体类型 */
13950
13944
  setEntityType(type: "custom" | "mtext"): void;
13951
13945
  }
13946
+ declare class MultilineTextConverter {
13947
+ /**
13948
+ * 将McDbMText实体转换为McDbCustomEditorEntity
13949
+ * @param mtext CAD多行文本实体
13950
+ * @param options 转换选项
13951
+ * @returns 自定义编辑器实体
13952
+ */
13953
+ static fromMText(mtext: McDbMText): MxCADMText;
13954
+ /**
13955
+ * 将McDbCustomEditorEntity转换为McDbMText
13956
+ * @param customEntity 自定义编辑器实体
13957
+ * @param options 转换选项
13958
+ * @returns CAD多行文本实体
13959
+ */
13960
+ static toMText(mtext: McDbMText, customEntity: MxCADMText): McDbMText;
13961
+ }
13962
+ declare function convertCadPointToSlatePoint(this: MxCADMText, point: McGePoint3d): {
13963
+ path: number[];
13964
+ offset: number;
13965
+ } | null;
13966
+ declare function convertSlatePointToCadPoint(this: MxCADMText, point: IMxEditorPoint): {
13967
+ point: McGePoint3d;
13968
+ lineIndex: number;
13969
+ } | null;
13970
+ declare function transformBy(this: MxCADMText, met: McGeMatrix3d): boolean;
13971
+ declare function worldDraw(this: MxCADMText, draw: MxCADWorldDraw): void;
13952
13972
  /**
13953
13973
  * 自定义编辑器实体类
13954
13974
  * 用于在CAD中渲染和管理富文本编辑器
@@ -13960,6 +13980,7 @@ export declare class MxCADMText extends McDbCustomEntity {
13960
13980
  static fromMText: typeof MultilineTextConverter.fromMText;
13961
13981
  /** 从MxCADMText转换为McDbMText */
13962
13982
  static toMText: typeof MultilineTextConverter.toMText;
13983
+ static elementTextManager: ElementTextManager;
13963
13984
  constructor(imp?: any);
13964
13985
  get data(): IMxEditorDescendant[];
13965
13986
  set data(val: IMxEditorDescendant[]);