From bc791cf681ee31fa4b1bf8dde5ad320404c690b2 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Tue, 31 Dec 2019 17:53:30 +0800 Subject: [PATCH] Fix bug --- libs/events.js | 7 ++++++- main.js | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/events.js b/libs/events.js index 628d5548..56f6db85 100644 --- a/libs/events.js +++ b/libs/events.js @@ -842,8 +842,13 @@ events.prototype.doEvent = function (data, x, y, prefix) { events.prototype.setEvents = function (list, x, y, callback) { var data = core.status.event.data || {}; - if (list) + if (list) { data.list = [{todo: core.clone(list), total: core.clone(list), condition: "false"}]; + // 结束所有正在执行的自动事件 + core.status.autoEvents.forEach(function (autoEvent) { + core.autoEventExecuting(autoEvent.symbol, null); + }); + } if (x != null) data.x = x; if (y != null) data.y = y; if (callback) data.callback = callback; diff --git a/main.js b/main.js index af3f1100..8f581d72 100644 --- a/main.js +++ b/main.js @@ -489,6 +489,7 @@ main.dom.data.ontouchstart = function (e) { e.preventDefault(); var loc = main.core.actions._getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY); if (loc == null) return; + main.lastTouchLoc = loc; main.core.ondown(loc); }catch (ee) { main.log(ee); } } @@ -499,6 +500,7 @@ main.dom.data.ontouchmove = function (e) { e.preventDefault(); var loc = main.core.actions._getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY); if (loc == null) return; + main.lastTouchLoc = loc; main.core.onmove(loc); }catch (ee) { main.log(ee); } } @@ -507,8 +509,9 @@ main.dom.data.ontouchmove = function (e) { main.dom.data.ontouchend = function (e) { try { e.preventDefault(); - var loc = main.core.actions._getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY); - if (loc == null) return; + if (main.lastTouchLoc == null) return; + var loc = main.lastTouchLoc; + delete main.lastTouchLoc; main.core.onup(loc); } catch (e) { main.log(e);