fix
This commit is contained in:
28
src/tool/mdEvent.js
Normal file
28
src/tool/mdEvent.js
Normal 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,
|
||||
}
|
||||
Reference in New Issue
Block a user