mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
tweak valid checks and event types
This commit is contained in:
parent
00a05ee839
commit
4cf6088441
@ -142,11 +142,9 @@
|
|||||||
$.publish(Events.MOUSE_EVENT, [event, this]);
|
$.publish(Events.MOUSE_EVENT, [event, this]);
|
||||||
var frame = this.piskelController.getCurrentFrame();
|
var frame = this.piskelController.getCurrentFrame();
|
||||||
var coords = this.getSpriteCoordinates(event.clientX, event.clientY);
|
var coords = this.getSpriteCoordinates(event.clientX, event.clientY);
|
||||||
if (typeof event.targetTouches != 'undefined' &&
|
if (typeof event.changedTouches != 'undefined' &&
|
||||||
typeof event.targetTouches[0] != 'undefined' &&
|
typeof event.changedTouches[0] != 'undefined') {
|
||||||
typeof event.targetTouches[0].pageX != 'undefined' &&
|
coords = this.getSpriteCoordinates(event.changedTouches[0].clientX, event.changedTouches[0].clientY);
|
||||||
typeof event.targetTouches[0].pageY != 'undefined') {
|
|
||||||
coords = this.getSpriteCoordinates(event.targetTouches[0].pageX, event.targetTouches[0].pageY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isClicked = true;
|
this.isClicked = true;
|
||||||
@ -172,12 +170,10 @@
|
|||||||
ns.DrawingController.prototype.onMousemove_ = function (event) {
|
ns.DrawingController.prototype.onMousemove_ = function (event) {
|
||||||
this._clientX = event.clientX;
|
this._clientX = event.clientX;
|
||||||
this._clientY = event.clientY;
|
this._clientY = event.clientY;
|
||||||
if (typeof event.targetTouches != 'undefined' &&
|
if (typeof event.changedTouches != 'undefined' &&
|
||||||
typeof event.targetTouches[0] != 'undefined' &&
|
typeof event.changedTouches[0] != 'undefined') {
|
||||||
typeof event.targetTouches[0].pageX != 'undefined' &&
|
this._clientX = event.changedTouches[0].clientX;
|
||||||
typeof event.targetTouches[0].pageY != 'undefined') {
|
this._clientY = event.changedTouches[0].clientY;
|
||||||
this._clientX = event.targetTouches[0].pageX;
|
|
||||||
this._clientY = event.targetTouches[0].pageY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentTime = new Date().getTime();
|
var currentTime = new Date().getTime();
|
||||||
@ -268,10 +264,8 @@
|
|||||||
var frame = this.piskelController.getCurrentFrame();
|
var frame = this.piskelController.getCurrentFrame();
|
||||||
var coords = this.getSpriteCoordinates(event.clientX, event.clientY);
|
var coords = this.getSpriteCoordinates(event.clientX, event.clientY);
|
||||||
if (typeof event.changedTouches != 'undefined' &&
|
if (typeof event.changedTouches != 'undefined' &&
|
||||||
typeof event.changedTouches[0] != 'undefined' &&
|
typeof event.changedTouches[0] != 'undefined') {
|
||||||
typeof event.changedTouches[0].pageX != 'undefined' &&
|
coords = this.getSpriteCoordinates(event.changedTouches[0].clientX, event.changedTouches[0].clientY);
|
||||||
typeof event.changedTouches[0].pageY != 'undefined') {
|
|
||||||
coords = this.getSpriteCoordinates(event.changedTouches[0].pageX, event.changedTouches[0].pageY);
|
|
||||||
}
|
}
|
||||||
if (this.isClicked) {
|
if (this.isClicked) {
|
||||||
// A mouse button was clicked on the drawing canvas before this mouseup event,
|
// A mouse button was clicked on the drawing canvas before this mouseup event,
|
||||||
|
Loading…
Reference in New Issue
Block a user