Options
All
  • Public
  • Public/Protected
  • All
Menu

Mx - v0.1.236

Index

References

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

References

Renames and re-exports MxFun

Type Aliases

MxDbEntity 用于构建一个自定义对象的抽象类(该类无法实例化 请通过继承的方式对其抽象方法进行实现)

description

MxDbEntity 属于 abstract class(抽象类) 主要用途是通过继承这个类实现一个用于动态绘制的图形对象 继承实现这个类必须实现的抽象方法:(方法名称前有'Abstract'标签就是必须实现的方法)

example
import THREE from "three"
import { McGiWorldDraw, MxDbEntity } from "mxdraw"
class MxLineEntity extends MxDbEntity {
constructor() {
super(); // 在派生类的构造函数中必须调用 super()
}
private pt1: THREE.Vector3 = new THREE.Vector3();
private pt2: THREE.Vector3 = new THREE.Vector3();
worldDraw(pWorldDraw: McGiWorldDraw) {
pWorldDraw.drawLine(this.pt1,this.pt2);
}
...
}
EventType: string | symbol
MxColorType: number | string | THREE.Color
MxDbEntityEventsType: { onEndGripEidt: any; onStartGripEidt: any }

Type declaration

  • onEndGripEidt:function
    • onEndGripEidt(): void
    • Returns void

  • onStartGripEidt:function
    • onStartGripEidt(): void
    • Returns void

MxDrawEvents: { MxEntitySelectChange: any; addResizeEvent: any; databaseModify: any; initObject: any; loadComplete: any; objectGripEdit: any; openFileComplete: any; render: any; saveFileComplete: any; uiSetLayerData: any; viewchange: any; whetherEditTheGripPoint: any } & RendererEventsType
MxFunType: MxFun
PubSubEvent: Record<EventType, ((...ages: any) => any)>
RendererEventsType: { click: any; hover: any; mousedown: any; mousemove: any; mouseout: any; mouseover: any; mouseup: any }

Type declaration

  • click:function
    • click(): void
    • Returns void

  • hover:function
    • hover(): void
    • Returns void

  • mousedown:function
    • mousedown(): void
    • Returns void

  • mousemove:function
    • mousemove(): void
    • Returns void

  • mouseout:function
    • mouseout(): void
    • Returns void

  • mouseover:function
    • mouseover(): void
    • Returns void

  • mouseup:function
    • mouseup(): void
    • Returns void

SpriteTextClass: typeof SpriteText
SpriteTextColorType: THREE.Color | string | number | CanvasGradient | CanvasPattern | undefined
SpriteTextObj: SpriteText
TextFontStyle: "normal" | "italic" | "oblique"
TextFontWeight: "normal" | "bold" | "lighter" | "bolder" | "inherit" | number
UnstableColor: MxColorType | undefined
stateType: { MxFun: any | null; Mxassembly: MxassemblyType | null; isCreateDrawObj: boolean }

Type declaration

  • [x: string]: any
  • MxFun: any | null
  • Mxassembly: MxassemblyType | null
  • isCreateDrawObj: boolean

Variables

MXDBDATATYPE: "datatype" = 'datatype'
McGeTool: McGeToolClass = ...
MrxDbgUtils: MrxDbgUtilsClass = ...
MxPaintBrush: { getProps: any; setProps: any; use: any } = ...

自定义对象绘制时使用全局默认属性的画笔对象

Type declaration

MxPaintBrushProps: MxPaintBrushPropsType = {}
MxThreeJS: MxThreeJS = ...
Mxassembly: MxassemblyClass = ...

Mxassembly 模块 导出库时已实例化,只需要调用实例方法 例如:


store: Store<stateType> = ...

Functions

  • createMxObject(this: MxFun, __namedParameters: { cadFile?: string | string[]; canvasId?: string; isAutoResize?: boolean; isCPPMxCAD?: boolean; isMxCAD?: boolean; isNewFile?: boolean; mapBox?: any; useWebsocket?: boolean; userIdentitySign?: string; callback?: any }): void
  • 创建图纸展示控件实例

    paramtype

    string | HTMLCanvasElement | JQuery

    paramtype

    string

    paramtype

    function

    paramtype

    boolean

    example
    Mx.MxFun.createMxObject({
    canvasId: "my-app",
    cadFile: "test2.dwg",
    callback(mxDraw, { canvas, canvasParent }) {
    console.log(mxDraw, canvas, canvasParent)
    },
    isNewFile: true
    })

    Parameters

    • this: MxFun
    • __namedParameters: { cadFile?: string | string[]; canvasId?: string; isAutoResize?: boolean; isCPPMxCAD?: boolean; isMxCAD?: boolean; isNewFile?: boolean; mapBox?: any; useWebsocket?: boolean; userIdentitySign?: string; callback?: any }
      • Optional cadFile?: string | string[]
      • Optional canvasId?: string
      • Optional isAutoResize?: boolean
      • Optional isCPPMxCAD?: boolean
      • Optional isMxCAD?: boolean
      • Optional isNewFile?: boolean
      • Optional mapBox?: any
      • Optional useWebsocket?: boolean
      • Optional userIdentitySign?: string
      • callback?:function

    Returns void

    void

  • initEvents(canvas: HTMLCanvasElement): void
  • 初始化事件

    Parameters

    • canvas: HTMLCanvasElement

    Returns void

  • loadCoreCode(): Promise<void>
  • 加载MxDraw库的核心代码 才能使用Mx的其他模块

    example
    Mx.loadCoreCode().then(()=> console.log("加载完成", Mx.MxFun))
    

    Returns Promise<void>

    Promise<MxFun>

  • toCSSFont(family: string, size: string | number, style: string, variant: string, weight: string): string
  • Parameters

    • family: string
    • size: string | number
    • style: string
    • variant: string
    • weight: string

    Returns string

  • useCanvasResizeListener(mxdrawObj: MxDrawObject, canvas: HTMLCanvasElement, time?: number): Promise<void>
  • 使用canvas大小调整侦听器 (只有在 MxFun.createMxObject 的callbakc回调中调用才有效) 不调用该方法则默认使用window窗口监听从而自动调整画布大小,canvas大小或者其canvas父级元素变化不会自动调整。

    注意:调用方法会加载element-resize-event-polyfill}依赖包 可以通过resize监听dom元素大小变化 dom.addEventListener('resize', callback) 注意: MxFun.createMxObject 方法调用后默认会依据canvasParent父级元素作为自动调整的参考大小 所以传入的canvas也会默认监听canvas父级元素,适配大小请将canvas和canvasParent当作一个整体。

    Parameters

    • mxdrawObj: MxDrawObject

      调用MxFun.createMxObject的callback回调函数拿到的 mxDraw 对象参数

    • canvas: HTMLCanvasElement

      调用{@link MxFun?.createMxObject}的callback回调函数拿到的dom.canvas作为要监听的元素

    • time: number = 100

      大小监听节流函数节流时间 默认 100

    Returns Promise<void>