98oktay / react-native-axis-pad

A virtual joystick for touch capable mobile devices.
21 stars 6 forks source link

onValue not getting called, handler off center, no dual stick support #1

Open MoffKalast opened 5 years ago

MoffKalast commented 5 years ago

So I've tried out the library with the following code and it would seem that whenever I grab the stick the central circle appears randomly off center, usually in the very bottom right corner for some reason.

I would've debugged that further but alas I can't since there aren't any console logs from the onValue callback. Thus making the entire thing completely unusable.

import React, {Component} from 'react';
import {ImageBackground, Text, View, Button, TouchableOpacity, Platform, StyleSheet} from 'react-native';
import AxisPad from 'react-native-axis-pad';

export default class Stick extends Component {

    render(){
        return(
            <AxisPad
                resetOnRelease={true}
                autoCenter={true}
                size={150}
                handlerSize={60}
                onValue={({ x, y }) => {
                    console.log(x, y);
                }}>
            </AxisPad>
        )
    }

}

Now realistically one would only ever practically use two of these things at a time which really isn't possible with React's great single touch capability. Yaay.

98oktay commented 5 years ago

Hi, can you tell me what device you're encountering with this situation?

MoffKalast commented 5 years ago

It's a Lenovo Tab 3 Essential running Android 5.0.1. Haven't tried it on any other devices yet.

98oktay commented 5 years ago

It's a Lenovo Tab 3 Essential running Android 5.0.1. Haven't tried it on any other devices yet.

Thank you for feedback. Fixed a bug on android devices. However, multi-touch does not work correctly on android. We're trying to solve it.

Fr33maan commented 4 years ago

Hello @98oktay, it seems that this lib is the only one which is using native code instead of webviews. The multitouch android issue is known also on the very popular library react-native-gesture-handler issue#47.

It has a merged PR #237.

What do you think about adapt your code to this library to be able to enable multi joystick support as many current mobile games need ?

Thanks for the great work