moves undo / redo

canvas-rendering
Steve Ruiz 2021-05-28 15:43:35 +01:00
rodzic 8dfef5c302
commit 239aea30b4
2 zmienionych plików z 14 dodań i 5 usunięć

Wyświetl plik

@ -258,6 +258,8 @@ const state = createState({
do: "createShape",
to: "draw.editing",
},
UNDO: { do: "undo" },
REDO: { do: "redo" },
},
},
editing: {

Wyświetl plik

@ -978,11 +978,18 @@ export function getBoundsFromPoints(points: number[][]): Bounds {
let maxX = -Infinity
let maxY = -Infinity
for (let [x, y] of points) {
minX = Math.min(x, minX)
minY = Math.min(y, minY)
maxX = Math.max(x, maxX)
maxY = Math.max(y, maxY)
if (points.length === 0) {
minX = 0
minY = 0
maxX = 1
maxY = 1
} else {
for (let [x, y] of points) {
minX = Math.min(x, minX)
minY = Math.min(y, minY)
maxX = Math.max(x, maxX)
maxY = Math.max(y, maxY)
}
}
return {