mese79 / TouchControls

This is a three.js controller which supports touch events and hit-testing.
http://mese79.github.io/TouchControls/
MIT License
68 stars 17 forks source link

Change device orientation #5

Open gjhatzis opened 1 year ago

gjhatzis commented 1 year ago

Hello,

First of all thank you for the great work on touch controls!

I'm trying to apply them on mobile devices and everything works great until I change the device orientation. If I reload the page on either portrait or landscape, everything works again. I think the problem is in utils.js where you calculate the rect top and rect left with getBoundingClientRect, which do not change when viewport is.

Have you managed to find a solution?

mese79 commented 1 year ago

Hi, sorry for the late response!
I just updated the code so on window resize event, pads' positions and configs get updated. I think that should do the work.
Checkout #0a309c3