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

Error with different css-positions #10

Closed
morasp opened this issue Apr 10, 2020 · 7 comments
Closed

Error with different css-positions #10

morasp opened this issue Apr 10, 2020 · 7 comments
Assignees

Comments

@morasp
Copy link

morasp commented Apr 10, 2020

When working with a CSS position other than the default, the joystick can not be moved correctly.
I suspect, this is an issue with the calculation of the movement.
I suggest to calculate the movement based on the last and the current position.

@bobboteck bobboteck self-assigned this Apr 10, 2020
@bobboteck
Copy link
Owner

Hi @morasp can you send me more detail of your problem?

@morasp
Copy link
Author

morasp commented Apr 11, 2020

If I position the Container with css

    position: fixed;
    bottom: 30px;
    left:0px;

the movement of the stick is restricted to sidewards movement (I have only tested vertical repositioning)
If I check the value of canvas.offsetTop is the same as without the positioning.
Tested on MacOS 10.15.5 and Safari

@bobboteck
Copy link
Owner

bobboteck commented Apr 17, 2020

Hi @morasp, I think the problem is due to the absolute positioning that you used.
The JoyStick work on the position in the parent element, and if you force it the Stick can't move correctly.
For now I'm sorry, I can try to check if there is a way to make it work even like this, when I have closed the other issues and I will have time to work on it.

@samburdge
Copy link

Hi,
I had this same issue. It definitely makes sense to have the joystick at the bottom of the screen, but at the moment you can't position it where you want.
Apart from that the joystick is great!

@bobboteck bobboteck moved this from To do to In progress in ISSUE Traking May 8, 2020
@Tezcan98
Copy link

Tezcan98 commented Jun 9, 2020

I discover that's trick. You should create a div before joystick. Also Thanks guy, after I publish my game I'll add you to credits. But I just started the game :D

@bobboteck
Copy link
Owner

I discover that's trick. You should create a div before joystick. Also Thanks guy, after I publish my game I'll add you to credits. But I just started the game :D

Yes if you use DIV and put the JoyStick into it work correctly.
I try to find a solution on @morasp question

bobboteck added a commit that referenced this issue Jun 10, 2020
@bobboteck
Copy link
Owner

Hi guys, I'm happy to declare this issue closed, now you can use FIXED or ABSOLUTE position in the CSS style.
See the example of implementation here: https://bobboteck.github.io/joy/joy.html
Have fun using the joystick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
ISSUE Traking
  
Done
Development

No branches or pull requests

4 participants