[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:
- Inherit MxCADBaseCustomizaElement and implement three abstract members: type, calculate, and render.
- Calculate layout data such as width, height, and line information based on the incoming text and editor elements in Calculate.
- 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
| Name | Type |
|---|---|
entity | MxCADMText |
element | IMxEditorElement |
index? | number |
Returns
CalculateData
render
▸ Abstract render(entity, draw, element, calculateData, renderData): RenderResult
Rendering entities
Parameters
| Name | Type |
|---|---|
entity | MxCADMText |
draw | MxCADWorldDraw |
element | IMxEditorElement |
calculateData | CalculateData |
renderData | RenderData |
Returns
RenderResult
