Created
December 20, 2013 16:46
-
-
Save ryandotsmith/8057623 to your computer and use it in GitHub Desktop.
Crafty: remove listener which prevents touchmove events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 3bfcdec1cfbf155fade70afbb0a8aee91a46d5e3 Mon Sep 17 00:00:00 2001 | |
From: Eric Rykwalder <e.rykwalder@gmail.com> | |
Date: Thu, 19 Dec 2013 18:38:23 -0800 | |
Subject: [PATCH] fix disableTouch issue on crafty | |
--- | |
static/libs/crafty.js | 9 ++++++--- | |
static/systems/home.js | 2 ++ | |
2 files changed, 8 insertions(+), 3 deletions(-) | |
diff --git a/static/libs/crafty.js b/static/libs/crafty.js | |
index 64265f7..2d69e18 100644 | |
--- a/static/libs/crafty.js | |
+++ b/static/libs/crafty.js | |
@@ -5334,9 +5334,7 @@ Crafty.extend({ | |
head.appendChild(meta); | |
setTimeout(function () { window.scrollTo(0, 1); }, 0); | |
- Crafty.addEvent(this, window, "touchmove", function (e) { | |
- e.preventDefault(); | |
- }); | |
+ Crafty.addEvent(this, window, "touchmove", Crafty.disableTouch); | |
Crafty.stage.x = 0; | |
Crafty.stage.y = 0; | |
@@ -6160,6 +6158,11 @@ Crafty.extend({ | |
keydown: {}, | |
selected: false, | |
+ disableTouch: function (e) { | |
+ e.preventDefault(); | |
+ }, | |
+ | |
+ | |
/**@ | |
* #Crafty.keydown | |
* @category Input | |
diff --git a/static/systems/home.js b/static/systems/home.js | |
index dc8311d..39b5d67 100644 | |
--- a/static/systems/home.js | |
+++ b/static/systems/home.js | |
@@ -40,8 +40,10 @@ koa.systems.Home = (function() { | |
var board = koa.systems.Game.getBoard(); | |
if (board) { | |
board.timeline.destroy(); | |
+ Crafty.timer.stop(); | |
} | |
koa.api.Leaderboard.draw(); | |
+ Crafty.removeEvent(this, window, "touchmove", Crafty.disableTouch); | |
} | |
-- | |
1.8.3.4 (Apple Git-47) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment