@mocanvas/editor · class

Group2d

declare class Group2d extends Geometry2d

Several geometries drawn as one shape (e.g. a geo shape and its label).


Methods · 19

constructor(config: Flags & {
distanceToLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): number
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number
getArea(): number
getBounds(): Box

Children flagged excludeFromShapeBounds are hit-tested but do not count towards the group's bounds. If every child is excluded the group falls back to all of them, so a shape is never reported as having no bounds at all.

getBoundsVertices(): Vec[]
getLength(filters?: Geometry2dFilters): number
getSvgPathData(_first?: boolean): string
getVertices(filters?: Geometry2dFilters): Vec[]
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number, filters?: Geometry2dFilters): boolean
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean
get ignoredChildren(): Geometry2d[]

The children a filter says to skip.

intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[]
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[]
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[]
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[]
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec
overlapsPolygon(polygon: VecLike[]): boolean
toPathWords(): number[]

Properties · 1

readonly children: Geometry2d[]

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.