max123 Posted June 2, 2017 Share Posted June 2, 2017 Hi, Can anyone think of any reasons why cameras would not respond to touch events on a mobile (iPhone) but work perfectly fine with click/drag on a desktop? I have PEP loaded, scene.activeCamera.attachControl(this.canvas, false); set, CSS property touch-action: none; applied to canvas... I've tried ArcRotate and Universal cameras. Thanks Quote Link to comment Share on other sites More sharing options...
max123 Posted June 2, 2017 Author Share Posted June 2, 2017 Appears that setting touch-action: none should be set via javascript attribute; adding this property via CSS has no effect: this.canvas.setAttribute("touch-action", "none"); GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
davrous Posted June 2, 2017 Share Posted June 2, 2017 Hello, We were using @Deltakosh hand.js pointer events polyfill in the past that was using the CSS property on the DOM element as specified by the W3C spec. But after some discussion with the jQuery foundation, we decided to support their Polyfill and use PEP now by default. PEP needs a HTML attribute on the DOM element like <canvas id="babylonCanvas" touch-action="none"></canvas> to work. They didn't want to use the CSS approach as it requires some hack to download the CSS and reparse it to detect it. In conclusion: - if you're using hand.js (deprecated), use touch-action: "none" in CSS or if you're using only IE11/Edge - if you're using PEP, add an HTML property touch-action="none" rather in the markup or by code like you've done David The Leftover and max123 2 Quote Link to comment Share on other sites More sharing options...
lhx880619 Posted June 2, 2017 Share Posted June 2, 2017 1 hour ago, davrous said: Hello, We were using @Deltakosh hand.js pointer events polyfill in the past that was using the CSS property on the DOM element as specified by the W3C spec. But after some discussion with the jQuery foundation, we decided to support their Polyfill and use PEP now by default. PEP needs a HTML attribute on the DOM element like <canvas id="babylonCanvas" touch-action="none"></canvas> to work. They didn't want to use the CSS approach as it requires some hack to download the CSS and reparse it to detect it. In conclusion: - if you're using hand.js (deprecated), use touch-action: "none" in CSS or if you're using only IE11/Edge - if you're using PEP, add an HTML property touch-action="none" rather in the markup or by code like you've done David use pep by default , do you mean we dont need to load pep js file? or we still need to have pep.js? could u pls share some links for the doc about the touch support? Quote Link to comment Share on other sites More sharing options...
davrous Posted June 5, 2017 Share Posted June 5, 2017 I mean we're using PEP by default on our web site & demos. We don't include the source of PEP inside babylon.js directly, you still need to reference it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.