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

View file

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