mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 14:14:55 +00:00
limit clone functionality
This commit is contained in:
committed by
Gabriel Horner
parent
6e67df9e37
commit
81eab963e6
@@ -1,6 +1,6 @@
|
||||
import Vec from '@tldraw/vec'
|
||||
import type { TLAsset, TLBinding, TLEventMap } from '../../types'
|
||||
import { TLCloneDirection, TLTargetType } from '../../types'
|
||||
import { TLCloneDirection, Geometry } from '../../types'
|
||||
import { BoundsUtils, isNonNullable, uniqueId } from '../../utils'
|
||||
import type { TLShape, TLShapeModel } from '../shapes'
|
||||
import type { TLApp } from '../TLApp'
|
||||
@@ -232,6 +232,12 @@ export class TLApi<S extends TLShape = TLShape, K extends TLEventMap = TLEventMa
|
||||
}
|
||||
|
||||
clone = (direction: TLCloneDirection) => {
|
||||
if (
|
||||
this.app.readOnly ||
|
||||
this.app.selectedShapesArray.length !== 1 ||
|
||||
!Object.values(Geometry).some((geometry: string) => geometry === this.app.selectedShapesArray[0].type)
|
||||
) return;
|
||||
|
||||
const shape = this.app.allSelectedShapesArray[0]
|
||||
const ShapeClass = this.app.getShapeClass(shape.type)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user