|
|
@@ -61,6 +61,12 @@ define([ |
|
|
|
.on('mousedown', this.events.mouse.mouseDown.bind(this)) |
|
|
|
.on('mouseup', this.events.mouse.mouseUp.bind(this)) |
|
|
|
.on('mousemove', this.events.mouse.mouseMove.bind(this)); |
|
|
|
|
|
|
|
$('.canvas-container'); |
|
|
|
.on('touchstart', this.events.touch.touchStart.bind(this)) |
|
|
|
.on('touchmove', this.events.touch.touchMove.bind(this)) |
|
|
|
.on('touchend', this.events.touch.touchEnd.bind(this)) |
|
|
|
.on('touchcancel', this.events.touch.touchCancel.bind(this)); |
|
|
|
}, |
|
|
|
|
|
|
|
resetKeys: function () { |
|
|
@@ -168,6 +174,7 @@ define([ |
|
|
|
events.emit('onKeyUp', key); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
mouse: { |
|
|
|
mouseDown: function (e) { |
|
|
|
let el = $(e.target); |
|
|
@@ -207,6 +214,32 @@ define([ |
|
|
|
this.mouse.x = e.offsetX + (renderer.pos.x); |
|
|
|
this.mouse.y = e.offsetY + (renderer.pos.y); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
touch: { |
|
|
|
touchStart: function (e) { |
|
|
|
let touch = e.touches[0]; |
|
|
|
events.emit('onTouchStart', { |
|
|
|
x: touch.clientX, |
|
|
|
y: touch.clientY |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
touchMove: function (e) { |
|
|
|
let touch = e.touches[0]; |
|
|
|
events.emit('onTouchMove', { |
|
|
|
x: touch.clientX, |
|
|
|
y: touch.clientY |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
touchEnd: function (e) { |
|
|
|
events.emit('onTouchEnd'); |
|
|
|
}, |
|
|
|
|
|
|
|
touchCancel: function (e) { |
|
|
|
events.emit('onTouchCancel'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|