简体   繁体   中英

mouse drag seems to be offset when i make my game responsive

I am making a very simple site which is mainly a JavaScript mobile game. The game involves dragging a character left and right. Before I make my game responsive, the mouse drag works fine and perfect (the character move followed the dragging) but the moment I applied responsiveness, the mouse drag seems to be offset which my character does not follow the finger accurately.

Note: the mouse event is bound to canvas, responsive also to canvas

不确定,但是也许您可以获得当前移动设备的宽度/高度,然后将其设置为CSS?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM