Improves file saving / page saving and loading

This commit is contained in:
Steve Ruiz 2021-06-16 13:09:45 +01:00
parent 7e03adcd52
commit 4ce2b8cc6b
68 changed files with 1166 additions and 997 deletions

View file

@ -8,16 +8,16 @@ import {
getSelectedShapes,
setSelectedIds,
} from 'utils/utils'
import { v4 as uuid } from 'uuid'
import { uniqueId } from 'utils/utils'
import { current } from 'immer'
import * as vec from 'utils/vec'
import vec from 'utils/vec'
export default function duplicateCommand(data: Data) {
const { currentPageId } = data
const selectedShapes = getSelectedShapes(current(data))
const duplicates = selectedShapes.map((shape) => ({
...shape,
id: uuid(),
id: uniqueId(),
point: vec.add(shape.point, vec.div([16, 16], getCurrentCamera(data).zoom)),
}))