{ "version": 3, "sources": ["../../../../../src/lib/tools/SelectTool/children/Translating.ts"], "sourcesContent": ["import {\n\tBox2d,\n\tEditor,\n\tMatrix2d,\n\tMatrix2dModel,\n\tPageRecordType,\n\tSnapPoint,\n\tStateNode,\n\tTLEventHandlers,\n\tTLPointerEventInfo,\n\tTLShape,\n\tTLShapePartial,\n\tVec2d,\n\tcompact,\n\tisPageId,\n} from '@tldraw/editor'\nimport { DragAndDropManager } from '../DragAndDropManager'\n\nexport class Translating extends StateNode {\n\tstatic override id = 'translating'\n\n\tinfo = {} as TLPointerEventInfo & {\n\t\ttarget: 'shape'\n\t\tisCreating?: boolean\n\t\teditAfterComplete?: boolean\n\t\tonInteractionEnd?: string\n\t}\n\n\tselectionSnapshot: TranslatingSnapshot = {} as any\n\n\tsnapshot: TranslatingSnapshot = {} as any\n\n\tmarkId = ''\n\n\tisCloning = false\n\tisCreating = false\n\teditAfterComplete = false\n\n\tdragAndDropManager = new DragAndDropManager(this.editor)\n\n\toverride onEnter = (\n\t\tinfo: TLPointerEventInfo & {\n\t\t\ttarget: 'shape'\n\t\t\tisCreating?: boolean\n\t\t\teditAfterComplete?: boolean\n\t\t\tonInteractionEnd?: string\n\t\t}\n\t) => {\n\t\tconst { isCreating = false, editAfterComplete = false } = info\n\n\t\tthis.info = info\n\t\tthis.parent.currentToolIdMask = info.onInteractionEnd\n\t\tthis.isCreating = isCreating\n\t\tthis.editAfterComplete = editAfterComplete\n\n\t\tthis.markId = isCreating ? `creating:${this.editor.onlySelectedShape!.id}` : 'translating'\n\t\tthis.editor.mark(this.markId)\n\t\tthis.isCloning = false\n\t\tthis.info = info\n\n\t\tthis.editor.setCursor({ type: 'move', rotation: 0 })\n\t\tthis.selectionSnapshot = getTranslatingSnapshot(this.editor)\n\n\t\t// Don't clone on create; otherwise clone on altKey\n\t\tif (!this.isCreating) {\n\t\t\tif (this.editor.inputs.altKey) {\n\t\t\t\tthis.startCloning()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tthis.snapshot = this.selectionSnapshot\n\t\tthis.handleStart()\n\t\tthis.updateShapes()\n\t\tthis.editor.on('tick', this.updateParent)\n\t}\n\n\toverride onExit = () => {\n\t\tthis.parent.currentToolIdMask = undefined\n\t\tthis.editor.off('tick', this.updateParent)\n\t\tthis.selectionSnapshot = {} as any\n\t\tthis.snapshot = {} as any\n\t\tthis.editor.snaps.clear()\n\t\tthis.editor.updateInstanceState(\n\t\t\t{ cursor: { type: 'default', rotation: 0 } },\n\t\t\t{ ephemeral: true }\n\t\t)\n\t\tthis.dragAndDropManager.clear()\n\t}\n\n\toverride onPointerMove = () => {\n\t\tthis.updateShapes()\n\t}\n\n\toverride onKeyDown = () => {\n\t\tif (this.editor.inputs.altKey && !this.isCloning) {\n\t\t\tthis.startCloning()\n\t\t\treturn\n\t\t}\n\n\t\t// need to update in case user pressed a different modifier key\n\t\tthis.updateShapes()\n\t}\n\n\toverride onKeyUp: TLEventHandlers['onKeyUp'] = () => {\n\t\tif (!this.editor.inputs.altKey && this.isCloning) {\n\t\t\tthis.stopCloning()\n\t\t\treturn\n\t\t}\n\n\t\t// need to update in case user pressed a different modifier key\n\t\tthis.updateShapes()\n\t}\n\n\toverride onPointerUp: TLEventHandlers['onPointerUp'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onComplete: TLEventHandlers['onComplete'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel: TLEventHandlers['onCancel'] = () => {\n\t\tthis.cancel()\n\t}\n\n\tprotected startCloning() {\n\t\tif (this.isCreating) return\n\n\t\tthis.isCloning = true\n\t\tthis.reset()\n\t\tthis.markId = 'translating'\n\t\tthis.editor.mark(this.markId)\n\n\t\tthis.editor.duplicateShapes(Array.from(this.editor.selectedShapeIds))\n\n\t\tthis.snapshot = getTranslatingSnapshot(this.editor)\n\t\tthis.handleStart()\n\t\tthis.updateShapes()\n\t}\n\n\tprotected stopCloning() {\n\t\tthis.isCloning = false\n\t\tthis.snapshot = this.selectionSnapshot\n\t\tthis.reset()\n\t\tthis.markId = 'translating'\n\t\tthis.editor.mark(this.markId)\n\t\tthis.updateShapes()\n\t}\n\n\tupdateParent = () => {\n\t\tconst { snapshot } = this\n\t\tthis.dragAndDropManager.updateDroppingNode(snapshot.movingShapes, this.updateParentTransforms)\n\t}\n\n\treset() {\n\t\tthis.editor.bailToMark(this.markId)\n\t}\n\n\tprotected complete() {\n\t\tthis.updateShapes()\n\t\tthis.dragAndDropManager.dropShapes(this.snapshot.movingShapes)\n\t\tthis.handleEnd()\n\n\t\tif (this.editor.instanceState.isToolLocked && this.info.onInteractionEnd) {\n\t\t\tthis.editor.setCurrentTool(this.info.onInteractionEnd)\n\t\t} else {\n\t\t\tif (this.editAfterComplete) {\n\t\t\t\tconst onlySelected = this.editor.onlySelectedShape\n\t\t\t\tif (onlySelected) {\n\t\t\t\t\tthis.editor.setEditingShape(onlySelected.id)\n\t\t\t\t\tthis.editor.setCurrentTool('select.editing_shape')\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.parent.transition('idle', {})\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate cancel() {\n\t\tthis.reset()\n\t\tif (this.info.onInteractionEnd) {\n\t\t\tthis.editor.setCurrentTool(this.info.onInteractionEnd)\n\t\t} else {\n\t\t\tthis.parent.transition('idle', this.info)\n\t\t}\n\t}\n\n\tprotected handleStart() {\n\t\tconst { movingShapes } = this.snapshot\n\n\t\tconst changes: TLShapePartial[] = []\n\n\t\tmovingShapes.forEach((shape) => {\n\t\t\tconst util = this.editor.getShapeUtil(shape)\n\t\t\tconst change = util.onTranslateStart?.(shape)\n\t\t\tif (change) {\n\t\t\t\tchanges.push(change)\n\t\t\t}\n\t\t})\n\n\t\tif (changes.length > 0) {\n\t\t\tthis.editor.updateShapes(changes)\n\t\t}\n\n\t\tthis.editor.setHoveredShape(null)\n\t}\n\n\tprotected handleEnd() {\n\t\tconst { movingShapes } = this.snapshot\n\n\t\tconst changes: TLShapePartial[] = []\n\n\t\tmovingShapes.forEach((shape) => {\n\t\t\tconst current = this.editor.getShape(shape.id)!\n\t\t\tconst util = this.editor.getShapeUtil(shape)\n\t\t\tconst change = util.onTranslateEnd?.(shape, current)\n\t\t\tif (change) {\n\t\t\t\tchanges.push(change)\n\t\t\t}\n\t\t})\n\n\t\tif (changes.length > 0) {\n\t\t\tthis.editor.updateShapes(changes)\n\t\t}\n\t}\n\n\tprotected handleChange() {\n\t\tconst { movingShapes } = this.snapshot\n\n\t\tconst changes: TLShapePartial[] = []\n\n\t\tmovingShapes.forEach((shape) => {\n\t\t\tconst current = this.editor.getShape(shape.id)!\n\t\t\tconst util = this.editor.getShapeUtil(shape)\n\t\t\tconst change = util.onTranslate?.(shape, current)\n\t\t\tif (change) {\n\t\t\t\tchanges.push(change)\n\t\t\t}\n\t\t})\n\n\t\tif (changes.length > 0) {\n\t\t\tthis.editor.updateShapes(changes)\n\t\t}\n\t}\n\n\tprotected updateShapes() {\n\t\tconst { snapshot } = this\n\t\tthis.dragAndDropManager.updateDroppingNode(snapshot.movingShapes, this.updateParentTransforms)\n\n\t\tmoveShapesToPoint({\n\t\t\teditor: this.editor,\n\t\t\tshapeSnapshots: snapshot.shapeSnapshots,\n\t\t\taveragePagePoint: snapshot.averagePagePoint,\n\t\t\tinitialSelectionPageBounds: snapshot.initialPageBounds,\n\t\t\tinitialSelectionSnapPoints: snapshot.initialSnapPoints,\n\t\t})\n\n\t\tthis.handleChange()\n\t}\n\n\tprotected updateParentTransforms = () => {\n\t\tconst {\n\t\t\teditor,\n\t\t\tsnapshot: { shapeSnapshots },\n\t\t} = this\n\t\tconst movingShapes: TLShape[] = []\n\n\t\tshapeSnapshots.forEach((shapeSnapshot) => {\n\t\t\tconst shape = editor.getShape(shapeSnapshot.shape.id)\n\t\t\tif (!shape) return null\n\t\t\tmovingShapes.push(shape)\n\n\t\t\tconst parentTransform = isPageId(shape.parentId)\n\t\t\t\t? null\n\t\t\t\t: Matrix2d.Inverse(editor.getShapePageTransform(shape.parentId)!)\n\n\t\t\tshapeSnapshot.parentTransform = parentTransform\n\t\t})\n\t}\n}\n\nfunction getTranslatingSnapshot(editor: Editor) {\n\tconst movingShapes: TLShape[] = []\n\tconst pagePoints: Vec2d[] = []\n\n\tconst shapeSnapshots = compact(\n\t\teditor.selectedShapeIds.map((id): null | MovingShapeSnapshot => {\n\t\t\tconst shape = editor.getShape(id)\n\t\t\tif (!shape) return null\n\t\t\tmovingShapes.push(shape)\n\n\t\t\tconst pagePoint = editor.getShapePageTransform(id)!.point()\n\t\t\tif (!pagePoint) return null\n\t\t\tpagePoints.push(pagePoint)\n\n\t\t\tconst parentTransform = PageRecordType.isId(shape.parentId)\n\t\t\t\t? null\n\t\t\t\t: Matrix2d.Inverse(editor.getShapePageTransform(shape.parentId)!)\n\n\t\t\treturn {\n\t\t\t\tshape,\n\t\t\t\tpagePoint,\n\t\t\t\tparentTransform,\n\t\t\t}\n\t\t})\n\t)\n\n\treturn {\n\t\taveragePagePoint: Vec2d.Average(pagePoints),\n\t\tmovingShapes,\n\t\tshapeSnapshots,\n\t\tinitialPageBounds: editor.selectionPageBounds!,\n\t\tinitialSnapPoints:\n\t\t\teditor.selectedShapeIds.length === 1\n\t\t\t\t? editor.snaps.snapPointsCache.get(editor.selectedShapeIds[0])!\n\t\t\t\t: editor.selectionPageBounds\n\t\t\t\t? editor.selectionPageBounds.snapPoints.map((p, i) => ({\n\t\t\t\t\t\tid: 'selection:' + i,\n\t\t\t\t\t\tx: p.x,\n\t\t\t\t\t\ty: p.y,\n\t\t\t\t }))\n\t\t\t\t: [],\n\t}\n}\n\nexport type TranslatingSnapshot = ReturnType\n\nexport interface MovingShapeSnapshot {\n\tshape: TLShape\n\tpagePoint: Vec2d\n\tparentTransform: Matrix2dModel | null\n}\n\nexport function moveShapesToPoint({\n\teditor,\n\tshapeSnapshots: snapshots,\n\taveragePagePoint,\n\tinitialSelectionPageBounds,\n\tinitialSelectionSnapPoints,\n}: {\n\teditor: Editor\n\tshapeSnapshots: MovingShapeSnapshot[]\n\taveragePagePoint: Vec2d\n\tinitialSelectionPageBounds: Box2d\n\tinitialSelectionSnapPoints: SnapPoint[]\n}) {\n\tconst {\n\t\tinputs,\n\t\tinstanceState: { isGridMode },\n\t\tdocumentSettings: { gridSize },\n\t} = editor\n\n\tconst delta = Vec2d.Sub(inputs.currentPagePoint, inputs.originPagePoint)\n\n\tconst flatten: 'x' | 'y' | null = editor.inputs.shiftKey\n\t\t? Math.abs(delta.x) < Math.abs(delta.y)\n\t\t\t? 'x'\n\t\t\t: 'y'\n\t\t: null\n\n\tif (flatten === 'x') {\n\t\tdelta.x = 0\n\t} else if (flatten === 'y') {\n\t\tdelta.y = 0\n\t}\n\n\t// Provisional snapping\n\teditor.snaps.clear()\n\n\tconst shouldSnap =\n\t\t(editor.user.isSnapMode ? !inputs.ctrlKey : inputs.ctrlKey) &&\n\t\teditor.inputs.pointerVelocity.len() < 0.5 // ...and if the user is not dragging fast\n\n\tif (shouldSnap) {\n\t\tconst { nudge } = editor.snaps.snapTranslate({\n\t\t\tdragDelta: delta,\n\t\t\tinitialSelectionPageBounds,\n\t\t\tlockedAxis: flatten,\n\t\t\tinitialSelectionSnapPoints,\n\t\t})\n\n\t\tdelta.add(nudge)\n\t}\n\n\tconst averageSnappedPoint = Vec2d.Add(averagePagePoint, delta)\n\n\tif (isGridMode && !inputs.ctrlKey) {\n\t\taverageSnappedPoint.snapToGrid(gridSize)\n\t}\n\n\tconst averageSnap = Vec2d.Sub(averageSnappedPoint, averagePagePoint)\n\n\teditor.updateShapes(\n\t\tcompact(\n\t\t\tsnapshots.map(({ shape, pagePoint, parentTransform }): TLShapePartial | null => {\n\t\t\t\tconst newPagePoint = Vec2d.Add(pagePoint, averageSnap)\n\t\t\t\tconst newLocalPoint = parentTransform\n\t\t\t\t\t? Matrix2d.applyToPoint(parentTransform, newPagePoint)\n\t\t\t\t\t: newPagePoint\n\n\t\t\t\treturn {\n\t\t\t\t\tid: shape.id,\n\t\t\t\t\ttype: shape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