JavaScript
语言:
JaveScriptBabelCoffeeScript
确定
var initMouse = {
position: {
client: {
x: null,
y: null
},
screen: {
x: null,
y: null
},
page: {
x: null,
y: null
}
},
buttons: {
left: null,
middle: null,
right: null
}
};
var useMightyMouse = function(elementId) {
var _a = React.useState(initMouse),
mouse = _a[0],
setMouse = _a[1];
React.useEffect(function() {
var onMouseEvent = function(event) {
var _a = event,
clientX = _a.clientX,
clientY = _a.clientY,
screenX = _a.screenX,
screenY = _a.screenY,
pageX = _a.p