moves undo / redo
This commit is contained in:
parent
8dfef5c302
commit
239aea30b4
2 changed files with 14 additions and 5 deletions
|
@ -258,6 +258,8 @@ const state = createState({
|
||||||
do: "createShape",
|
do: "createShape",
|
||||||
to: "draw.editing",
|
to: "draw.editing",
|
||||||
},
|
},
|
||||||
|
UNDO: { do: "undo" },
|
||||||
|
REDO: { do: "redo" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
editing: {
|
editing: {
|
||||||
|
|
|
@ -978,12 +978,19 @@ export function getBoundsFromPoints(points: number[][]): Bounds {
|
||||||
let maxX = -Infinity
|
let maxX = -Infinity
|
||||||
let maxY = -Infinity
|
let maxY = -Infinity
|
||||||
|
|
||||||
|
if (points.length === 0) {
|
||||||
|
minX = 0
|
||||||
|
minY = 0
|
||||||
|
maxX = 1
|
||||||
|
maxY = 1
|
||||||
|
} else {
|
||||||
for (let [x, y] of points) {
|
for (let [x, y] of points) {
|
||||||
minX = Math.min(x, minX)
|
minX = Math.min(x, minX)
|
||||||
minY = Math.min(y, minY)
|
minY = Math.min(y, minY)
|
||||||
maxX = Math.max(x, maxX)
|
maxX = Math.max(x, maxX)
|
||||||
maxY = Math.max(y, maxY)
|
maxY = Math.max(y, maxY)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minX,
|
minX,
|
||||||
|
|
Loading…
Reference in a new issue