MCPcopy
hub / github.com/tldraw/tldraw / getShapeUtil

Method getShapeUtil

packages/editor/src/lib/editor/Editor.ts:1325–1330  ·  view source on GitHub ↗
(arg: string | { type: string })

Source from the content-addressed store, hash-verified

1323 getShapeUtil<S extends TLShape>(shape: S | TLShapePartial<S> | S['type']): ShapeUtil<S>
1324 getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T
1325 getShapeUtil(arg: string | { type: string }) {
1326 const type = typeof arg === 'string' ? arg : arg.type
1327 const shapeUtil = getOwnProperty(this.shapeUtils, type)
1328 assert(shapeUtil, `No shape util found for type "${type}"`)
1329 return shapeUtil
1330 }
1331
1332 /**
1333 * Returns true if the editor has a shape util for the given shape / shape type.

Callers 15

constructorMethod · 0.95
canEditShapeMethod · 0.95
setEditingShapeMethod · 0.95
canCropShapeMethod · 0.95
_getReferencedUserIdsMethod · 0.95
addShapeByIdMethod · 0.95
getShapeGeometryMethod · 0.95
_getShapeHandlesCacheMethod · 0.95
_getShapeMaskCacheMethod · 0.95
getShapeAtPointMethod · 0.95

Calls 1

getOwnPropertyFunction · 0.90

Tested by 3

lineHandlesFunction · 0.64
getConfiguredOptionsFunction · 0.64
getTextFunction · 0.64