-
Notifications
You must be signed in to change notification settings - Fork 49
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
dom touchmove event is broken by the plugin #10
Comments
Hi, So you're using the Thanks, |
Unfortunatly this lib is pure JS, so it doesn't work for us. Neitheir it implements 3dtouchs to the current webview (so only WKWebview is supported) nor it allows to configure quickstart menu on the home button. Your implementation seems to be the only available at this moment for Cordova apps and it works great if not for this bug. |
I'm testing this plugin on iPhone 6s and app was build with Xcode 7, still following code ```
returns me false. |
@array-addu Please don't hijack issues of others. |
@JiDW Can you post me the JS code to track touchmove (etc) events? |
Hello, Thanks for your help! I tried a lot of things yesterday but knowing nothing about Objective-C is a big issue to find the bug :) I tried to set "cancelsTouchesInView" without success. Here is a commit on my fork for testing purpose: To answer your question: canvas.addEventListener("touchstart", function(event){
console.log("CANVAS: Touch start event fired");
});
canvas.addEventListener("touchmove", function(event){
console.log("CANVAS: Touch move event fired");
});
canvas.addEventListener("touchend", function(event){
console.log("CANVAS: Touch end event fired");
});
canvas.addEventListener("touchmove", function(event){
console.log("CANVAS: Touch cancel event fired");
}); Then call your plugin inside the deviceready cordova event: ThreeDeeTouch.isAvailable(function (avail){
//if(avail) <= Put in comment just to show that the same bug occurs even when 3dtouch isnt available
ThreeDeeTouch.watchForceTouches(function(result) {
console.log("3DTOUCH-JS: hard press event fired");
});
}); And that's it. Just launch this code and try to move your finger on the canvas element. My guess is that once iOS recognize the forceTouchRecognizer gesture, it mess with javascript in some way. Tapping quickly on the canvas allows to fire an event that isn't recognized by the plugin and momentarily restore the state of the event listener. It's just a guess however. Finally, I still don't know if this happen in every webview. If this issue isn't reproductible on a standard phoneGap app, I will contact the devs at Ludei that develops Cocoon. However, I wouldn't be surprised to foud out that this can happens everywhere.. Here is a video of the bug (sorry for the potatoe quality) : https://www.youtube.com/watch?v=2pJ6yqAgGG0 |
Hi, Thanks for being so thorough. I've created a new Cordova CLI app and added this plugin and <!DOCTYPE html>
<html>
<head>
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body>
<div class="app">
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
<button onclick="watchForceTouches()">watchForceTouches</button><br/><br/>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000"></canvas>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script>
var canvas = document.getElementById("myCanvas");
canvas.addEventListener("touchstart", function(event){
console.log("CANVAS: Touch start event fired");
});
canvas.addEventListener("touchmove", function(event){
console.log("CANVAS: Touch move event fired");
});
canvas.addEventListener("touchend", function(event){
console.log("CANVAS: Touch end event fired");
});
canvas.addEventListener("touchmove", function(event){
console.log("CANVAS: Touch cancel event fired");
});
function watchForceTouches() {
ThreeDeeTouch.watchForceTouches(function(result) {
console.log("3DTOUCH-JS: hard press event fired");
});
}
</script>
</body>
</html> After
Then I force-pressed inside the canvas again, but moved my finger a bit as well:
Looks good, right? |
This case would work for me too. What happens for you when you try to move your finger a bit a second time, just after the first one ? Thanks! |
A few interactions - anything unexpected?
|
Hello,
Thanks a lot for this plugin! It works well except one important issue : touchmove never calls touchend once we lift our finger from the screen. This makes the next touchmove to not start on DOM side. We have to tap once (and so get a touchend event) to be able to receive the next touchmove event.
This is what happens when we try to move a finger across the screen:
Then we lift our finger up, and that's it. No touchend event.
If we try to do another move gesture, this is what happens:
And that's it.
No touchstart, no touchmove or touchend.
If we tap once, , we correctly get a touchstart, then a touchend. After this tap, we can once again repeat the initial sequence.
We use your plugin on top of Cocoon.io (built on Cordova). I do not know if this is specific to Cocoon.io webview or if it is a general issue, even with Phonegap. However it is fairly easy to test for you I guess.
Could you take a look at it please ? We have a deadline pretty soon and Apple asked us if we'll make use of 3dtouch in our game, we'd love to say yes to them as you can imagine :)
Regards.
The text was updated successfully, but these errors were encountered: