GeoTypeDefinition

See source code
Table of contents

Defines the behavior for a custom geo shape type. Register custom geo types via .

interface GeoTypeDefinition {}

Properties

defaultSize

optional

Default creation size when clicking (not dragging). Defaults to 200x200.

defaultSize?: {
  h: number;
  w: number;
};

icon

Icon name for the style panel geo picker.

icon: string;

snapType

Snap behavior: 'polygon' snaps to vertices + center, 'blobby' snaps to center only.

snapType: "blobby" | "polygon";

Methods

getPath

Generate the path geometry for this geo type.

Parameters

NameDescription

w

number;

The width of the shape (already clamped to min 1)

h

number;

The height of the shape (already clamped to min 1, includes growY)

shape

The full geo shape record, for access to props like id, dash, fill, etc.

strokeWidth

number;

The scaled stroke width (strokeWidth * scale)

Returns


onDoubleClick

optional

Optional double-click handler. Return an object with partial props to update the shape, or void to do nothing.

Parameters

NameDescription

shape

Returns

{
  props: Partial<TLGeoShape["props"]>;
} | void;

Prev
GeoShapeUtilDisplayValues
Next
HighlightShapeOptions