Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/WebGL/webglInputEvents.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var documentEvents = require('../Utils/documentEvents.js');
let documentEvents = require('../Utils/documentEvents.js');

module.exports = webglInputEvents;

Expand All @@ -13,7 +13,7 @@ function webglInputEvents(webglGraphics) {
return webglGraphics.webglInputEvents;
}

var mouseCapturedNode = null,
let mouseCapturedNode = null,
mouseEnterCallback = [],
mouseLeaveCallback = [],
mouseDownCallback = [],
Expand All @@ -24,10 +24,10 @@ function webglInputEvents(webglGraphics) {
prevSelectStart,
boundRect;

var root = webglGraphics.getGraphicsRoot();
let root = webglGraphics.getGraphicsRoot();
startListen(root);

var api = {
let api = {
mouseEnter: mouseEnter,
mouseLeave: mouseLeave,
mouseDown: mouseDown,
Expand Down Expand Up @@ -103,7 +103,7 @@ function webglInputEvents(webglGraphics) {

function preciseCheck(nodeUI, x, y) {
if (nodeUI && nodeUI.size) {
var pos = nodeUI.position,
let pos = nodeUI.position,
half = nodeUI.size;

return pos.x - half < x && x < pos.x + half &&
Expand Down Expand Up @@ -131,7 +131,7 @@ function webglInputEvents(webglGraphics) {
}

function invoke(callbacksChain, args) {
var i, stopPropagation;
let i, stopPropagation;
for (i = 0; i < callbacksChain.length; i += 1) {
stopPropagation = callbacksChain[i].apply(undefined, args);
if (stopPropagation) {
Expand All @@ -141,7 +141,7 @@ function webglInputEvents(webglGraphics) {
}

function startListen(root) {
var pos = {
let pos = {
x: 0,
y: 0
},
Expand Down Expand Up @@ -179,7 +179,7 @@ function webglInputEvents(webglGraphics) {
updateBoundRect();
lastUpdate = 1;
}
var cancelBubble = false,
let cancelBubble = false,
node;

pos.x = e.clientX - boundRect.left;
Expand All @@ -205,7 +205,7 @@ function webglInputEvents(webglGraphics) {

root.addEventListener('mousedown',
function(e) {
var cancelBubble = false,
let cancelBubble = false,
args;
updateBoundRect();
pos.x = e.clientX - boundRect.left;
Expand Down Expand Up @@ -233,14 +233,14 @@ function webglInputEvents(webglGraphics) {

root.addEventListener('mouseup',
function(e) {
var clickTime = +new Date(),
let clickTime = +new Date(),
args;

pos.x = e.clientX - boundRect.left;
pos.y = e.clientY - boundRect.top;

var nodeAtClientPos = getNodeAtClientPos(pos);
var sameNode = nodeAtClientPos === lastFound;
let nodeAtClientPos = getNodeAtClientPos(pos);
let sameNode = nodeAtClientPos === lastFound;
args = [nodeAtClientPos || lastFound, e];
if (args[0]) {
window.document.onselectstart = prevSelectStart;
Expand Down