Fix pinching resetting tool

This commit is contained in:
Steve Ruiz 2021-06-29 19:08:25 +01:00
parent a230e4d83a
commit d828ac072f
2 changed files with 8 additions and 10 deletions

View file

@ -30,10 +30,8 @@ export function fastDrawUpdate(info: PointerInfo): void {
selectedId
] as DrawShape
;(data.document.pages[data.currentPageId].shapes[selectedId] as DrawShape) = {
...shape,
points: [...shape.points],
}
;(data.document.pages[data.currentPageId].shapes[selectedId] as DrawShape) =
deepClone(shape)
state.forceData(freeze(data))
}
@ -43,7 +41,7 @@ export function fastPanUpdate(delta: number[]): void {
const camera = tld.getCurrentCamera(data)
camera.point = vec.sub(camera.point, vec.div(delta, camera.zoom))
data.pageStates[data.currentPageId].camera = { ...camera }
data.pageStates[data.currentPageId].camera = deepClone(camera)
state.forceData(freeze(data))
}
@ -59,7 +57,7 @@ export function fastZoomUpdate(point: number[], delta: number): void {
const p1 = tld.screenToWorld(point, data)
camera.point = vec.add(camera.point, vec.sub(p1, p0))
data.pageStates[data.currentPageId].camera = { ...camera }
data.pageStates[data.currentPageId].camera = deepClone(camera)
state.forceData(freeze(data))
}

View file

@ -312,10 +312,6 @@ const state = createState({
if: 'hasSelection',
do: 'zoomCameraToSelection',
},
STARTED_PINCHING: {
unless: 'isInSession',
to: 'pinching',
},
ZOOMED_TO_FIT: ['zoomCameraToFit', 'zoomCameraToActual'],
ZOOMED_IN: 'zoomIn',
ZOOMED_OUT: 'zoomOut',
@ -337,6 +333,10 @@ const state = createState({
selecting: {
onEnter: ['setActiveToolSelect', 'clearInputs'],
on: {
STARTED_PINCHING: {
unless: 'isInSession',
to: 'pinching.selectPinching',
},
SAVED: 'forceSave',
DELETED: {
unless: 'isReadOnly',