@mocanvas/mocanvas · class

HighlightShapeUtil

declare class HighlightShapeUtil extends ShapeUtil<HighlightShape, HighlightShapeUtilDisplayValues>

A translucent marker stroke, drawn behind the shapes it marks.


Methods · 10

backgroundComponent(_shape: HighlightShape): ReactNode

The highlight belongs *behind* the shapes it marks, so a renderer with a background layer draws it from here instead of from component.

Both are null because the stroke is painted on the GPU from getRenderStyle; the method exists so that a renderer asking "does this shape want a background pass?" gets a truthful answer, and so a subclass has the seam to paint one in the DOM.

canResize(_shape: HighlightShape): boolean
component(_shape: HighlightShape): ReactNode
getDefaultProps(): HighlightShapeProps
getEngineGeometry(shape: HighlightShape): EngineGeometry

The same freehand generator a draw shape uses, so a highlight and a pen stroke recorded from the same movement have the same silhouette; only the width, the colour and the opacity differ, and those are render style.

getGeometry(shape: HighlightShape): Geometry2d
getIndicatorPath(shape: HighlightShape): Path2D
getRenderStyle(shape: HighlightShape): StyleWords
hideResizeHandles(_shape: HighlightShape): boolean
onResize(shape: HighlightShape, info: ResizeInfo<HighlightShape>): Partial<HighlightShape>

Properties · 5

static migrations: _mocanvas_editor.PropsMigrations
static options: HighlightShapeOptions
readonly options: HighlightShapeOptions
static props: _mocanvas_editor.RecordProps<HighlightShape>
static type: "highlight"

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.