diff --git a/packages/tldraw/src/state/commands/distributeShapes/distributeShapes.ts b/packages/tldraw/src/state/commands/distributeShapes/distributeShapes.ts index ba5f3e149..2e36905a6 100644 --- a/packages/tldraw/src/state/commands/distributeShapes/distributeShapes.ts +++ b/packages/tldraw/src/state/commands/distributeShapes/distributeShapes.ts @@ -18,7 +18,7 @@ export function distributeShapes( const { before, after } = TLDR.mutateShapes( app.state, ids.filter((id) => deltaMap[id] !== undefined), - (shape) => ({ point: deltaMap[shape.id].next }), + (shape) => ({ point: deltaMap[shape.id]?.next }), currentPageId ) diff --git a/packages/tldraw/src/state/commands/flipShapes/flipShapes.spec.ts b/packages/tldraw/src/state/commands/flipShapes/flipShapes.spec.ts index 96a2ba398..3fbfdd77a 100644 --- a/packages/tldraw/src/state/commands/flipShapes/flipShapes.spec.ts +++ b/packages/tldraw/src/state/commands/flipShapes/flipShapes.spec.ts @@ -89,7 +89,7 @@ describe('Flip command', () => { expect(app.getShape('rect1').point).toStrictEqual([100, 0]) expect(app.getShape('rect2').point).toStrictEqual([0, 100]) }) - it('stays in the same point when the grouped shape is selected with other shape', () => { + it('move the grouped shape when flipped with other shape', () => { app.group( [app.getShape('rect1').id, app.getShape('rect2').id], 'groupId' @@ -100,11 +100,11 @@ describe('Flip command', () => { app.flipHorizontal() - expect(app.getShape('rect1').point).toStrictEqual([0, 0]) - expect(app.getShape('rect2').point).toStrictEqual([100, 100]) + expect(app.getShape('rect1').point).toStrictEqual([100, 0]) + expect(app.getShape('rect2').point).toStrictEqual([0, 100]) app.flipVertical() - expect(app.getShape('rect1').point).toStrictEqual([0, 0]) - expect(app.getShape('rect2').point).toStrictEqual([100, 100]) + expect(app.getShape('rect1').point).toStrictEqual([100, 100]) + expect(app.getShape('rect2').point).toStrictEqual([0, 0]) }) })