@mocanvas/mocanvas · class

GeoShapeUtil

declare class GeoShapeUtil extends BaseBoxShapeUtil<GeoShape>

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


Methods · 16

canEdit(_shape: GeoShape): boolean
component(shape: GeoShape): ReactNode
getDefaultProps(): GeoShapeProps
getEngineGeometry(shape: GeoShape): EngineGeometry | undefined

The engine has a generator for every built-in geo kind, so a built-in travels as (kind, w, h, flips) rather than as its vertices. A custom geo type returns undefined and keeps uploading whatever its getPath builds.

getFontFaces(shape: GeoShape): TLFontFace[]

A geo shape needs its family's faces only while it carries a label.

getGeometry(shape: GeoShape): Geometry2d
getGeoTypeDefinition(geo: string): GeoTypeDefinition

The silhouette for geo, taking this util's customGeoTypes into account. Falls back to the rectangle so an unknown value still draws something.

getGeoValue(shape: {

The geo value this util will actually draw.

props.geo is a *style* prop, and its validator only knows the built-in silhouettes — so reading it through the style would turn every custom geo type back into a rectangle before it ever reached the table. A stored value this util has a definition for is therefore kept as it is; anything else falls back to the validated style, which is what keeps a value from another editor's vocabulary drawing something rather than nothing.

getIndicatorPath(shape: GeoShape): Path2D
getRenderStyle(shape: GeoShape): StyleWords
getText(shape: GeoShape): string
hasOverlayLabel(shape: GeoShape): boolean
needsOverlay(_shape: GeoShape): boolean

The GPU keeps drawing the body while editing; only the label lives in the DOM.

onBeforeCreate(next: GeoShape): GeoShape | void
onBeforeUpdate(prev: GeoShape, next: GeoShape): GeoShape | void
onEditEnd(shape: GeoShape): void

Properties · 5

static migrations: _mocanvas_editor.PropsMigrations
static options: GeoShapeOptions
readonly options: GeoShapeOptions
static props: _mocanvas_editor.RecordProps<GeoShape>
static type: "geo"

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.