@mocanvas/editor · function

getShapeStyleIfExists

declare function getShapeStyleIfExists<T>(editor: Editor, shape: ShapeRef, style: StyleProp<T>): T | undefined

A shape's value for one style prop, or undefined when that shape does not carry that style at all.

The IfExists is the whole point: asking a text shape for its fill must be answerable without throwing, because style panels are built by asking every selected shape about every style.

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.