engine icon indicating copy to clipboard operation
engine copied to clipboard

Bug: PointerEvent.offsetX 在 chrome 和 firefox 中表现不同

Open cptbtptpbcptdtptp opened this issue 2 years ago • 1 comments

示例:在 Chrome 和 FireFox 中分别监听 PointerDown 事件

window.onpointerdown = (e)=>{console.log('e', e.offsetX);setTimeout(()=>{console.log('e', e.offsetX)}, 0);} 

Chrome: image FireFox: image

cptbtptpbcptdtptp avatar Sep 05 '22 09:09 cptbtptpbcptdtptp

看起来 FireFox 里 PointerEvent 中的 OffsetX 和 OffsetY 属性只有在触发的那一刻是正确的,然后就会被立刻重置为 0 。

cptbtptpbcptdtptp avatar Sep 05 '22 09:09 cptbtptpbcptdtptp