@mocanvas/mocanvas · class

LineShapeUtil

declare class LineShapeUtil extends ShapeUtil<LineShape, LineShapeUtilDisplayValues>

This one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.


Methods · 12

component(_shape: LineShape): ReactNode
getDefaultProps(): LineShapeProps
getEngineGeometry(shape: LineShape): EngineGeometry

A line is its points: the engine fits the spline. w/h are the point extents; a cubic spline through them stays within its control hull, and this util has neither an overlay nor a label, so those words feed a fallback the engine never reaches.

getGeometry(shape: LineShape): Geometry2d
getHandles(shape: LineShape): ShapeHandle[]
getIndicatorPath(shape: LineShape): Path2D
getRenderStyle(shape: LineShape): StyleWords
hideResizeHandles(_shape: LineShape): boolean
hideRotateHandle(_shape: LineShape): boolean
hideSelectionBoundsBg(_shape: LineShape): boolean

A selected line shows its own outline and its points, and nothing else — the same selection an arrow gets, and for the same reason: a line *is* its points, so a box around them is chrome with nothing to do. Turning it means moving the points, and resizing it means moving the points, so neither the rotate handle nor the resize handles have any work either.

All four answers matter together. selectionHandles only drops the frame when resize *and* rotate are both hidden, and hideSelectionBoundsFg must stay false or the shape loses its own outline as well and a selected line shows nothing at all.

hideSelectionBoundsFg(_shape: LineShape): boolean
onHandleDrag(shape: LineShape, info: {

Properties · 5

static migrations: _mocanvas_editor.PropsMigrations
static options: LineShapeOptions
readonly options: LineShapeOptions
static props: _mocanvas_editor.RecordProps<LineShape>
static type: "line"

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.