-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Swipe input not working? #347
Comments
I can take a look at it later today and see if I can spot anything. |
So I tested out a basic example and swipe gestures seem to be working for me. I have an android phone so I'm unable to test iOS though. import kontra from '/src/kontra.defaults.js';
(async () => {
kontra.init();
kontra.initInput();
const sprite = kontra.Sprite({
x: 100,
y: 100,
color: 'red',
width: 40,
height: 40
});
kontra.onInput(['arrowleft', 'swipeleft', 'dpadleft'], () => {
sprite.x -= sprite.width;
});
kontra.onInput(['arrowright', 'swiperight', 'dpadright'], () => {
sprite.x += sprite.width;
});
kontra.GameLoop({
render() {
sprite.render();
}
}).start();
})(); |
Aha I have an iPhone myself... ok, Will try your example tomorrow and get back to you. If it doesn't work it's def an iOS issue... happy to look into it if you tell me where to look in the source code! |
yeah... that example you shared is not working on iOS :( |
Well dang. I don't have any good way to look into that. |
Hi straker It's also not working in Firefox adaptive view ! (easier to test) in Gesture.js there is a test : Lines 135 to 142 in ae63cba
This "key" corresponding to identifier in Touch object So test doesn't work. Question : How to correct this ? if you have an idea, i can try a PR. |
@sylfel interesting find. I'll have to think about how to handle touches that way. Probably just need to make sure that a started touch also has an end so we don't skip one on accident. |
I followed the documentation to enable all the inputs on my game, but although arrows work fine, swiping on a phone doesn't seem to be doing anything...
I have this
I also tried adding this:
but swiping is still not working
The text was updated successfully, but these errors were encountered: