Fix double undos, cleans up utils

This commit is contained in:
Steve Ruiz 2021-06-24 13:34:43 +01:00
parent 8271e6d431
commit bdafae3db6
53 changed files with 1676 additions and 1515 deletions

View file

@ -13,8 +13,6 @@ export default function distributeCommand(
data: Data,
type: DistributeType
): void {
const { currentPageId } = data
const selectedShapes = getSelectedShapes(data).filter(
(shape) => !shape.isLocked
)
@ -40,7 +38,7 @@ export default function distributeCommand(
name: 'distribute_shapes',
category: 'canvas',
do(data) {
const { shapes } = getPage(data, currentPageId)
const { shapes } = getPage(data)
const len = entries.length
switch (type) {
@ -132,7 +130,7 @@ export default function distributeCommand(
}
},
undo(data) {
const { shapes } = getPage(data, currentPageId)
const { shapes } = getPage(data)
for (const id in boundsForShapes) {
const shape = shapes[id]
const initialBounds = boundsForShapes[id]