fix(Signature): should prevent page move when signing (#11796)

This commit is contained in:
neverland 2023-05-01 16:34:17 +08:00 committed by GitHub
parent 5374a2f317
commit 77c1d589ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ import {
makeNumberProp,
makeStringProp,
createNamespace,
preventDefault,
} from '../utils';
import { Button } from '../button';
@ -54,6 +55,8 @@ export default defineComponent({
return false;
}
preventDefault(event);
const evt = event.changedTouches
? event.changedTouches[0]
: event.targetTouches[0];
@ -74,8 +77,8 @@ export default defineComponent({
state.ctx?.stroke();
};
const touchEnd = (event: { preventDefault: () => void }) => {
event.preventDefault();
const touchEnd = (event: TouchEvent) => {
preventDefault(event);
emit('end');
};
@ -83,10 +86,11 @@ export default defineComponent({
if (!state.ctx) {
return false;
}
emit('start');
state.ctx.beginPath();
state.ctx.lineWidth = props.lineWidth;
state.ctx.strokeStyle = props.penColor;
emit('start');
};
const isCanvasEmpty = (canvas: HTMLCanvasElement) => {
@ -141,7 +145,7 @@ export default defineComponent({
width={state.width}
height={state.height}
onTouchstartPassive={touchStart}
onTouchmovePassive={touchMove}
onTouchmove={touchMove}
onTouchend={touchEnd}
/>
) : (