Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: screenY is undefined #50

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/bui-utils/src/touchBlocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export default function blockTouch(root) {
};
const onTouchMove = (e) => {
const currentTouch = e.touches[0];
// 如果单指在滑动的时候另一只手指碰到屏幕一次而滑动手指不放开,就会触发touchend清空lastTouch引发这个问题
if (!lastTouch || !currentTouch) return;
if (!moveAxis) {
if (
Math.abs(lastTouch.screenY - currentTouch.screenY) >
Expand All @@ -81,7 +83,8 @@ export default function blockTouch(root) {
e.preventDefault();
// setLastTouch(e.touches[0]);
};
const onTouchEnd = () => {
const onTouchEnd = (e) => {
if (e.touches.length !== 0) return;
lastTouch = undefined;
moveDirection = undefined;
moveAxis = undefined;
Expand Down
Loading