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] Under the full screen, the virtual joystick partially fails #145

Open
slmholder opened this issue Jul 14, 2020 · 0 comments
Open

[BUG] Under the full screen, the virtual joystick partially fails #145

slmholder opened this issue Jul 14, 2020 · 0 comments
Labels

Comments

@slmholder
Copy link

slmholder commented Jul 14, 2020

const managerDirection = nipplejs.create({
zone: this.direction,
mode: 'static',
position: { left: '50%', top: '50%' },
color: 'white',
})
managerDirection.on('end', (evt, data) => {
this.props.moveEnd()
})
managerDirection.on('move', (evt, data) => {
if (!data.direction) return
let speed
switch (data.direction.angle) {
case 'left': speed = Math.abs(data.vector.x * 0.1).toFixed(2); break;
case 'right': speed = Math.abs(data.vector.x * 0.1).toFixed(2); break;
case 'down': speed = Math.abs(data.vector.y * 0.1).toFixed(2); break;
case 'up': speed = Math.abs(data.vector.y * 0.1).toFixed(2); break;
}
this.props.moveStart(data.direction.angle, speed)
})

const managerPerspective = nipplejs.create({
  zone: this.perspective,
  mode: 'static',
  position: { left: '50%', top: '50%' },
  color: 'white',
})
managerPerspective.on('end', (evt, data) => {
  this.props.angleEnd()
})
managerPerspective.on('move', (evt, data) => {
  const x = Math.round(data.vector.x * 400)
  const y = Math.round(data.vector.y * -400)
  this.props.angleStart(x, y)
})

When operating one of the two virtual joysticks in a full-screen Android browser, the other one fails.

How to modify or improve it?

Thank you

@slmholder slmholder added the bug label Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant