Skip to content
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

Bug when working with two joysticks #45

Open
bern-aex opened this issue Jan 4, 2024 · 1 comment
Open

Bug when working with two joysticks #45

bern-aex opened this issue Jan 4, 2024 · 1 comment

Comments

@bern-aex
Copy link

bern-aex commented Jan 4, 2024

I have two joysticks which are supposed to control movement and camera for a vehicle simulation respectively, and they are positioned next to each other in the html document. The first joystick works as expected, but the second uses the first joysticks center as its center, opposeed to using its own center.
This is my html code fro the joysticks:

And here is the JS:
var joy = new JoyStick('vehicle_joy',{
title: 'vehicle_joystick',
width: 100,
height: 100,
internalFillColor: '#00000F',
internalLineWidth: 2,
internalStrokeColor: '#00000F',
externalLineWidth: 2,
externalStrokeColor: '#00000F',
autoReturnToCenter: true
});

(The second joystick is the same only with a name change)

Steps to reproduce the behavior:

  1. Create html and js documents with the code before
  2. Try to move the second joystick. It moves as if its center was the one from the first joystick

I expected, as it should be natural, for each joystick to move respectively to thir own center.

  • OS: Windows 11
  • Browser: Chrome
  • Version 120.0.6099.130
@bern-aex
Copy link
Author

bern-aex commented Jan 4, 2024

I also just noticed, as I was trying to move the joysticks using CSS, that applying any padding or margin to the joystick moves the joystick drawing, but not its center (it acts as if it had no padding or margin, being off-centered).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant