Global

Members

(constant) NODE_DEFAULTS

Description:
  • Default values for node and connection properties.

Source:

Default values for node and connection properties.

(constant) fixSvgNs

Description:
  • Vue 2 bug #7330: 位於內之元件, 其$vnode.ns恆為'svg', 致該元件render出的所有元素(含傳入子元件之slot內容)皆被建為SVGElement, HTML元素因而無排版盒(0x0不可見)。

    官方applyNS雖於遇到foreignObject時重置後代ns, 但僅走vnode.children; 傳入子元件之slot內容存於componentOptions.children, 不在其巡訪範圍, 故無法被救回。

    修正: 於render前清除自身$vnode.ns, 使其createElement改依getTagNamespace決定 (g/path→svg, div/span→HTML), root之再經applyNS正確處理foreignObject。

    用法: 於「內含foreignObject且在內」之元件掛上 mixins: [fixSvgNs]。

Source:

Vue 2 bug #7330: 位於內之元件, 其$vnode.ns恆為'svg', 致該元件render出的所有元素(含傳入子元件之slot內容)皆被建為SVGElement, HTML元素因而無排版盒(0x0不可見)。

官方applyNS雖於遇到foreignObject時重置後代ns, 但僅走vnode.children; 傳入子元件之slot內容存於componentOptions.children, 不在其巡訪範圍, 故無法被救回。

修正: 於render前清除自身$vnode.ns, 使其createElement改依getTagNamespace決定 (g/path→svg, div/span→HTML), root之再經applyNS正確處理foreignObject。

用法: 於「內含foreignObject且在內」之元件掛上 mixins: [fixSvgNs]。

Methods

buildRoundedPath() → {Object}

Description:
  • Build a rounded (smoothstep-style) svg path from an orthogonal point list.

Source:
Returns:
Type
Object

clampPosition()

Description:
  • Clamp a position within a coordinate extent.

Source:

generateId()

Description:
  • Generate a unique ID.

Source:

getBezierPath() → {Object}

Description:
  • Get bezier curve path.

Source:
Returns:
Type
Object

getControlOffset()

Description:
  • Calculate the control point offset for bezier curves based on handle position.

Source:

getDiamondEdgePoint()

Description:
  • Get a point on the diamond edge for same-side handles. Each "side" of the diamond is split into two edges meeting at the vertex. ratio < 0.5: on the first edge, ratio >= 0.5: on the second edge.

Source:

getEllipseEdgePoint()

Description:
  • Get a point on the ellipse edge for handle positioning. Maps ratio (0..1) to a parametric angle based on the side.

Source:

getHandlePosition()

Description:
  • Calculate the absolute position of a handle on the canvas.

Source:

getOverlappingNodes()

Description:
  • Get all nodes that overlap with a given rectangle.

Source:

getSmoothStepPath() → {Object}

Description:
  • Get smooth step (rounded right-angle) path.

Source:
Returns:
Type
Object

getStepPath() → {Object}

Description:
  • Get step (right-angle) path.

Source:
Returns:
Type
Object

getStraightPath() → {Object}

Description:
  • Get straight line path.

Source:
Returns:
Type
Object

getTriangleEdgePoint()

Description:
  • Get a point on the triangle edge for handle positioning. Supports 4 directions: triangle (up), triangle-right, triangle-down, triangle-left.

Source:

isValidConnection()

Description:
  • Validate a potential connection.

Source:

labelAtHalfLength()

Description:
  • Find the point at exactly half the total Manhattan path length.

Source:

lookupRoute()

Description:
  • draw.io OrthConnector route generation. Uses bit-encoded route patterns + quad rotation + limits clamping. Returns waypoint array or null (fallback needed).

Source:

normalizeConnPoints()

Description:
  • Normalize conn.points (forced waypoints) into [{x,y},...]. Accepts [[x,y],...] or [{x,y},...]; returns null when absent/invalid so callers can fall back to automatic routing.

Source:

orthogonalizeThroughPoints()

Description:
  • Build an orthogonal point list passing through forced waypoints.

    • Leaves the source along its anchor axis (perpendicular to the node edge).
    • Turns AT each waypoint (leaves it along the other axis than it arrived on).
    • Arrives at the target along its anchor axis. Inserts at most one corner between consecutive points; skips zero-length segments.
Source:

rectsOverlap()

Description:
  • Check if two rectangles overlap.

Source:

segmentFallback()

Description:
  • SegmentConnector fallback (draw.io style). Used when nodes are too close for OrthConnector (tooShort).

Source:

snapPosition(position, gridSize)

Description:
  • Snap a position to the nearest grid point.

Source:
Parameters:
Name Type Description
position Object
gridSize number | null

Grid cell size (single number for both axes)