This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
Mismatching coords from touch event #66
Open
Description
The following method doesn't take into account the coordinates of the canvas element inside the window.
__proto.initEvent=function(e,nativeEvent) //line 2989 laya.core.js
If the canvas element suffers some modifications inside the window, such as translations via style properties (margin, top, left), all the touch events will work incorrectly. The following seems to fix it:
const canvas = Laya.Render._$GET_canvas()
const rect = canvas.getBoundingClientRect()
this._point.setTo(e.pageX - rect.left || e.clientX - rect.left, e.clientY - rect.top || e.pageY - rect.top)
Metadata
Assignees
Labels
No labels
Activity