move grouped shape when flipping
This commit is contained in:
parent
ac9802570c
commit
18e47ad56b
2 changed files with 6 additions and 6 deletions
|
@ -18,7 +18,7 @@ export function distributeShapes(
|
||||||
const { before, after } = TLDR.mutateShapes(
|
const { before, after } = TLDR.mutateShapes(
|
||||||
app.state,
|
app.state,
|
||||||
ids.filter((id) => deltaMap[id] !== undefined),
|
ids.filter((id) => deltaMap[id] !== undefined),
|
||||||
(shape) => ({ point: deltaMap[shape.id].next }),
|
(shape) => ({ point: deltaMap[shape.id]?.next }),
|
||||||
currentPageId
|
currentPageId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ describe('Flip command', () => {
|
||||||
expect(app.getShape<RectangleShape>('rect1').point).toStrictEqual([100, 0])
|
expect(app.getShape<RectangleShape>('rect1').point).toStrictEqual([100, 0])
|
||||||
expect(app.getShape<RectangleShape>('rect2').point).toStrictEqual([0, 100])
|
expect(app.getShape<RectangleShape>('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.group(
|
||||||
[app.getShape<RectangleShape>('rect1').id, app.getShape<RectangleShape>('rect2').id],
|
[app.getShape<RectangleShape>('rect1').id, app.getShape<RectangleShape>('rect2').id],
|
||||||
'groupId'
|
'groupId'
|
||||||
|
@ -100,11 +100,11 @@ describe('Flip command', () => {
|
||||||
|
|
||||||
app.flipHorizontal()
|
app.flipHorizontal()
|
||||||
|
|
||||||
expect(app.getShape<RectangleShape>('rect1').point).toStrictEqual([0, 0])
|
expect(app.getShape<RectangleShape>('rect1').point).toStrictEqual([100, 0])
|
||||||
expect(app.getShape<RectangleShape>('rect2').point).toStrictEqual([100, 100])
|
expect(app.getShape<RectangleShape>('rect2').point).toStrictEqual([0, 100])
|
||||||
|
|
||||||
app.flipVertical()
|
app.flipVertical()
|
||||||
expect(app.getShape<RectangleShape>('rect1').point).toStrictEqual([0, 0])
|
expect(app.getShape<RectangleShape>('rect1').point).toStrictEqual([100, 100])
|
||||||
expect(app.getShape<RectangleShape>('rect2').point).toStrictEqual([100, 100])
|
expect(app.getShape<RectangleShape>('rect2').point).toStrictEqual([0, 0])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue