Skip to content

[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/MxCADBaseCustomizing Element

Class: MxCADBaseCustomElement ​

2d.MxCADBaseCustomElement

Represents a custom text element base class used to define the calculation and drawing logic for text rendering.

Description

MxCADBaseCustomizalElement is an abstract base class for all custom text elements, which defines contracts for element types, layout calculations, and drawing results. Custom text elements can calculate layout data using the calculate method, generate the final entity list using the render method, and draw it to world coordinates. Instructions:

  1. Inherit MxCADBaseCustomizaElement and implement three abstract members: type, calculate, and render.
  2. Calculate layout data such as width, height, and line information based on the incoming text and editor elements in Calculate.
  3. Generate entity arrays, positions, sizes, and row heights in render, and return RenderResult.

Table of contents ​

Constructors ​

Properties ​

Methods ​

Constructors ​

constructor ​

• new MxCADBaseCustomElement()

Properties ​

type ​

• Abstract type: string

type

Methods ​

calculate ​

▸ Abstract calculate(entity, element, index?): CalculateData

Calculate layout data

Parameters ​

NameType
entityMxCADMText
elementIMxEditorElement
index?number

Returns ​

CalculateData


render ​

▸ Abstract render(entity, draw, element, calculateData, renderData): RenderResult

Rendering entities

Parameters ​

NameType
entityMxCADMText
drawMxCADWorldDraw
elementIMxEditorElement
calculateDataCalculateData
renderDataRenderData

Returns ​

RenderResult