作者:陈陈 | 来源:互联网 | 2024-12-10 10:44
ExploringtheissuewheretheonScrolleventdoesnotcorrectlycaptureclientXandclientYvaluesacrossdifferentbrowsers.
In my function handleScroll(e)
, I attempt to capture the mouse position during a scroll event and use it to schedule an update:
handleScroll(e) {
// Schedule an update when a scroll event is received.
// Within a single frame, only the most recent value will be published.
this.scheduleUpdate({ x: e.clientX, y: e.clientY });
}
I have tested this functionality in Internet Explorer, Firefox, and Chrome, but in all cases, e.clientX
and e.clientY
return as undefined. For more details, see the following link:
Stack Overflow Discussion
This issue originates from the open-source project ReactJS. Despite reading the documentation, I find it intriguing that this error does not occur with the native touchstart
event. I plan to investigate this discrepancy further.