StaticTYPEThe hollow mode determines how the node's hollow property is calculated based on its fill style.
Protectedmin_Protectedmin_Indicates whether the adapter is for a connector node, which may require special handling for rendering and hit testing.
Indicates whether the node creation process involves multiple steps, such as defining multiple points for a polyline or curve. If true, the diagram control may need to handle additional user interactions during node creation.
Indicates whether the node can be created by dragging from the tool palette onto the canvas. If true, the adapter should implement the onCreateDraft method to provide the initial geometry of the draft node to be dragged.
Indicates whether the adapter supports rendering text within the node, which may affect how the node is rendered and whether text-related interactions are enabled.
Indicates whether the adapter supports single-line text rendering within the node. If true, the text will be rendered on a single line, and any overflow will be handled according to the text_overflow property. If false or undefined, multi-line text rendering may be supported.
The text overflow mode determines how text that exceeds the node's bounding box is handled.
Returns the text orientation values this node type supports.
Only relevant for nodes that support text (has_text === true).
When not defined, all orientations are assumed to be supported.
Adapters that render text differently (e.g. curved text) should override this to return a restricted subset.
Returns the text baseline values this node type supports.
Only relevant for nodes that support text (has_text === true).
When not defined, all baselines are assumed to be supported.
Adapters that render text differently (e.g. curved text) should override this to return a restricted subset.
The baseline determines how the text is aligned vertically relative to its bounding box or path.
For example, 'top' aligns the top of the text with the top of the bounding box, 'middle' centers the text vertically, and 'bottom' aligns the bottom of the text with the bottom of the bounding box.
Indicates whether the adapter supports rotation of the node. If true, the diagram control may provide rotation handles and allow the user to rotate the node.
Indicates whether the adapter supports snapping the node to a grid or guides when moving or resizing. If true, the diagram control may adjust the node's position and size to align with the grid or guides.
Specifies the connection handles that this node type supports for connecting to other nodes. Each handle is represented by a NodeHandle value, which indicates the position or type of the handle on the node. This property is used to determine where connections can be made to this node and how the diagram control should render connection points. Adapters that support connections should override this to return the appropriate handles for their node type.
The unique type name of the adapter, which is used to associate it with nodes of a specific type. This type is typically registered with the NodeRegistry to enable the diagram control to find the appropriate adapter for each node.
StaticregisterRegisters the RectangleAdapter with the NodeRegistry.
Registers the RectangleAdapter instance with the NodeRegistry.
Performs a hit test on the given node with the specified point.
The handle of the node that was hit, or NodeHandle.NONE if no hit occurred.
Returns a default connection object for this node type, which can be used to create a new connection when the user initiates a connection to this node.
Creates and returns a new draft node for the given tool when the user initiates a drag-create action from the tool palette. This will only be called if the adapter's drag_create property is true.
The tool identifier for which to create the draft node.
The newly created draft node, or undefined if the draft node should not be created.
Optionaldirection: "from" | "to" | "any"Additional logic to determine whether a connection can be made to this node from the specified direction and handle. This method is called during connection creation to validate whether a connection is allowed based on the node's state, geometry, or other criteria. The target can also be used to decide whether a connection can be made. The target can be the connection iteself or the node that is being connected to. The point parameter can be used to determine the world-space coordinates of the connection point, if available. Adapters that support connections should override this to implement custom connection rules.
The node to which the connection is being made.
The connection handle on the node.
The direction of the connection, either 'from' (outgoing) or 'to' (incoming).
Optionaltarget: Partial<INode>The target node or connection that is being connected to, if available. This can be used to determine whether the connection is allowed based on the target's type or state.
Optionalpoint: IPointThe world-space coordinates of the connection point, if available.
Snaps the given node to the specified grid by modifying its points.
The node to snap.
The grid to snap the node to.
Optionalhandle: NodeHandleThe handle being used to resize the node.
Renders the selection state of the given node on the specified canvas context.
The node whose selection state to render.
Specifies whether to show all handles or connection handles.
Where to place the text for this node, if it has any. This is used for rendering and in-place editing.
The node whose text placement to determine.
The text placement information, or undefined if the node has no text.
Returns the visual bounding rect of the node's rendered path in world coordinates.
For most nodes this equals the rect computed from their points.
Adapters whose paths extend beyond that rect (e.g. a document node whose
wavy bottom dips below the bottom edge) should override this to return the
true visual bounds so that cover-mode images fill the entire visible shape.
The default implementation returns rect unchanged.
The visual bounding rect.
Writes the given node to a JSON-serializable format using the provided serializer.
The node to serialize.
The serializer to use for converting the node to JSON.
The JSON-serializable representation of the node.
Reads a node from the given JSON data using the provided serializer.
The JSON data to read the node from.
The serializer to use for converting the JSON data to a node.
A promise that resolves to the deserialized node.
Renders the given node on the specified canvas context.
The node to render.
Optionalshow: "all" | "quick"ProtectedgetProtectedhitTest a point against the handle used to define a custom skew at the top left of the shape. No transformation necessary here.
True if the point is within the handle's bounding rectangle, false otherwise.
ProtectedrenderRender the handle used to define a custom skew at the top left of the shape. It has the shape of a trapezoid to indicate its function for adjusting the skew. No transformation necessary here.
Updates the node's size while the user is dragging a resize handle. Called on every pointermove while a resize is active.
The node being resized.
TrapezoidAdapter is a node adapter responsible for rendering trapezoid nodes in the diagram. It extends the RectangleAdapter to leverage basic rectangle rendering capabilities while adding specific logic for handling trapezoid shapes and hit testing. Registers with the NodeRegistry under the name 'trapezoid'.