Skip to content

Commit

Permalink
updating touches on pointer up
Browse files Browse the repository at this point in the history
  • Loading branch information
diyaayay committed Nov 25, 2024
1 parent dcaa55a commit effb4b2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/events/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ function pointer(p5, fn){
fn._updatePointerCoords = function (e) {
if (this._curElement !== null) {
const canvas = this._curElement.elt;
const rect = canvas.getBoundingClientRect();
const sx = canvas.scrollWidth / this.width || 1;
const sy = canvas.scrollHeight / this.height || 1;

Expand Down Expand Up @@ -1152,10 +1151,6 @@ function pointer(p5, fn){

if(e.pointerType === 'touch') {
this._activeTouches.set(e.pointerId, e);
const touches = Array.from(this._activeTouches.values()).map((touch)=>
getTouchInfo(this._curElement.elt, this.width, this.height, touch)
);
this.touches = touches;
}

if (!this.mouseIsPressed && typeof context.mouseMoved === 'function') {
Expand Down Expand Up @@ -1484,6 +1479,9 @@ function pointer(p5, fn){

if(e.pointerType == 'touch'){
this._activeTouches.delete(e.pointerId);
this.touches = Array.from(this._activeTouches.values()).map((touch) =>
getTouchInfo(this._curElement.elt, this.width, this.height, touch)
);
}

this._updatePointerCoords(e);
Expand Down

0 comments on commit effb4b2

Please sign in to comment.