Skip to content

Commit

Permalink
fix: 修复x, y为0的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Feb 28, 2020
1 parent 1059bdd commit 1dcb5f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/graphic/event/controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getRelativePosition } from '../../util/dom';
import { isNumber } from '../../util/common';

// 计算滑动的方向
const calcDirection = (start, end) => {
Expand Down Expand Up @@ -35,7 +36,7 @@ const convertPoints = (ev, canvas) => {
const { x, y, clientX, clientY } = touch;
let point;
// 小程序环境会有x,y
if (x && y) {
if (isNumber(x) || isNumber(y)) {
point = { x, y };
} else {
// 浏览器环境再计算下canvas的相对位置
Expand Down

0 comments on commit 1dcb5f9

Please sign in to comment.