mobile and desktop fix
This commit is contained in:
parent
d28b0e898b
commit
58779f7f86
1 changed files with 10 additions and 12 deletions
22
js/core.js
22
js/core.js
|
@ -33,6 +33,14 @@ function Canvas(width, height, upscale) {
|
|||
that.pageY = e.touches[0].pageY;
|
||||
}
|
||||
|
||||
function unclicker(e) {
|
||||
that.clicked = false;
|
||||
|
||||
that.firstX = this.pageX;
|
||||
that.firstY = this.pageY;
|
||||
}
|
||||
|
||||
|
||||
this.elem.addEventListener('mousedown', function (e) {
|
||||
that.clicked = true;
|
||||
});
|
||||
|
@ -57,19 +65,9 @@ function Canvas(width, height, upscale) {
|
|||
e.preventDefault();
|
||||
})
|
||||
|
||||
this.elem.addEventListener('mouseup', function (e) {
|
||||
that.clicked = false;
|
||||
this.elem.addEventListener('mouseup', unclicker);
|
||||
|
||||
that.firstX = this.pageX;
|
||||
that.firstY = this.pageY;
|
||||
});
|
||||
|
||||
this.elem.addEventListener('touchend', function (e) {
|
||||
that.clicked = false;
|
||||
|
||||
that.firstX = this.pageX;
|
||||
that.firstY = this.pageY;
|
||||
});
|
||||
this.elem.addEventListener('touchend',unclicker);
|
||||
|
||||
|
||||
this.clicked = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue