kopia lustrzana https://github.com/Tldraw/Tldraw
add options arg
rodzic
c308cc2edd
commit
9f1fe5dd5a
|
@ -811,7 +811,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|||
getViewportScreenBounds(): Box;
|
||||
getViewportScreenCenter(): Vec;
|
||||
getZoomLevel(): number;
|
||||
groupShapes(shapes: TLShape[] | TLShapeId[], groupId?: TLShapeId): this;
|
||||
groupShapes(shapes: TLShape[] | TLShapeId[], groupId?: TLShapeId, options?: TLGroupShapesOptions): this;
|
||||
hasAncestor(shape: TLShape | TLShapeId | undefined, ancestorId: TLShapeId): boolean;
|
||||
readonly history: HistoryManager<TLRecord>;
|
||||
inputs: {
|
||||
|
|
|
@ -138,6 +138,11 @@ export type TLAnimationOptions = Partial<{
|
|||
easing: (t: number) => number
|
||||
}>
|
||||
|
||||
/** @public */
|
||||
export type TLGroupShapesOptions = Partial<{
|
||||
selectAfterGrouping: boolean
|
||||
}>
|
||||
|
||||
/** @public */
|
||||
export type TLResizeShapeOptions = Partial<{
|
||||
initialBounds: Box
|
||||
|
@ -6582,7 +6587,11 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|||
*
|
||||
* @public
|
||||
*/
|
||||
groupShapes(shapes: TLShapeId[] | TLShape[], groupId = createShapeId()): this {
|
||||
groupShapes(
|
||||
shapes: TLShapeId[] | TLShape[],
|
||||
groupId = createShapeId(),
|
||||
options: TLGroupShapesOptions = { selectAfterGrouping: true }
|
||||
): this {
|
||||
if (!Array.isArray(shapes)) {
|
||||
throw Error('Editor.groupShapes: must provide an array of shapes or shape ids')
|
||||
}
|
||||
|
@ -6632,7 +6641,9 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|||
},
|
||||
])
|
||||
this.reparentShapes(sortedShapeIds, groupId)
|
||||
this.select(groupId)
|
||||
if (options.selectAfterGrouping) {
|
||||
this.select(groupId)
|
||||
}
|
||||
})
|
||||
|
||||
return this
|
||||
|
|
Ładowanie…
Reference in New Issue