This commit is contained in:
X1627315083
2024-09-06 13:48:16 +08:00
parent 4301c4051a
commit 4e2d3d672c
7 changed files with 388 additions and 156 deletions

28
src/tool/mdEvent.js Normal file
View File

@@ -0,0 +1,28 @@
const getMousePosition = (e,bor,dom) => {
e.stopPropagation()
if(bor){
const touch = e.changedTouches[0];
event = {
offsetX:touch.clientX - e.target.getBoundingClientRect().left,
offsetY: touch.clientY - e.target.getBoundingClientRect().top,
clientX:touch.clientX,
clientY:touch.clientY,
}
if(dom){
event.offsetX = touch.clientX - dom.getBoundingClientRect().left
event.offsetY = touch.clientY - dom.getBoundingClientRect().top
}
}else{
event = {
offsetX:e.offsetX,
offsetY:e.offsetY,
clientX:e.clientX,
clientY:e.clientY,
}
}
return event
}
export {
getMousePosition,
}