elmarti / react-joystick-component

Tiny, multitouch, component driven joysticks in react
MIT License
86 stars 27 forks source link

Limit movements to X or Y axis #55

Closed dswhy closed 1 year ago

dswhy commented 1 year ago

Is your feature request related to a problem? Please describe. Currently there is no way (that I know) to limit the movement only to one axis. I intend to use this - otherwise amazing and simple to use - component for navigation along a 1-axis path (forwards/backwards). However, it can be confusing for the user if they can move the joystick into an axis that has no effect whatsoever.

Describe the solution you'd like A flag such as axis where I can specify the axis I want to limit, e.g.: JoystickAxis = ['auto', 'x', 'y']

Describe alternatives you've considered Limiting touch-action in the div or the page, results in limiting factor elsewhere. Other alternative implementations:

Additional context No additional context

Thank you in advance! Would like to resolve this quickly if possible :)

elmarti commented 1 year ago

Thank you for your kind words! I will have a look into this later today or tomorrow

elmarti commented 1 year ago

@dswhy we already have the stickShape prop, does it meet your requirements if we were to add a lever style here e.g:

image

dswhy commented 1 year ago

Is that similar to my alternative controlPlaneShape suggestion? I would like to keep the aesthetics and functionality mostly the same, just limit the movement to one axis (X or Y). If your proposal meets this, it will work for me :)

elmarti commented 1 year ago

Ah gotcha, got it working, making a release now

dswhy commented 1 year ago

Thank you so much!! It looks like the release didn't pass through all the check ups though! 😅

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 6.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

elmarti commented 1 year ago

@dswhy my bad - release failed due to this downstream issue: https://github.com/cycjimmy/semantic-release-action/issues/155 Should be available now

dswhy commented 1 year ago

It works great! Thanks a lot!