Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
williamngan committed Mar 2, 2024
1 parent dd41ab9 commit d00e149
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 10 deletions.
6 changes: 5 additions & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ declare const UIPointerActions: {
click: string;
keydown: string;
keyup: string;
pointerdown: string;
pointerup: string;
contextmenu: string;
all: string;
};
Expand Down Expand Up @@ -464,9 +466,11 @@ declare abstract class MultiTouchSpace extends Space {
bindTouch(bind?: boolean, passive?: boolean, customTarget?: Element): this;
bindKeyboard(bind?: boolean): this;
touchesToPoints(evt: TouchEvent, which?: TouchPointsKey): Pt[];
protected _mouseAction(type: string, evt: MouseEvent | TouchEvent): void;
protected _mouseAction(type: string, evt: MouseEvent | TouchEvent | PointerEvent): void;
protected _mouseDown(evt: MouseEvent | TouchEvent): boolean;
protected _pointerDown(evt: PointerEvent): boolean;
protected _mouseUp(evt: MouseEvent | TouchEvent): boolean;
protected _pointerUp(evt: PointerEvent): boolean;
protected _mouseMove(evt: MouseEvent | TouchEvent): boolean;
protected _mouseOver(evt: MouseEvent | TouchEvent): boolean;
protected _mouseOut(evt: MouseEvent | TouchEvent): boolean;
Expand Down
27 changes: 26 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4300,6 +4300,8 @@ var UIPointerActions = {
click: "click",
keydown: "keydown",
keyup: "keyup",
pointerdown: "pointerdown",
pointerup: "pointerup",
contextmenu: "contextmenu",
all: "all"
};
Expand Down Expand Up @@ -4775,7 +4777,7 @@ var Space = class {
add(p) {
let player = typeof p == "function" ? { animate: p } : p;
let k = this.playerCount++;
let pid = this.id + k;
let pid = player.animateID || this.id + k;
this.players[pid] = player;
player.animateID = pid;
if (player.resize && this.bound.inited)
Expand Down Expand Up @@ -5012,9 +5014,13 @@ var MultiTouchSpace = class extends Space {
this._mouseOut = this._mouseOut.bind(this);
this._mouseMove = this._mouseMove.bind(this);
this._mouseClick = this._mouseClick.bind(this);
this._pointerDown = this._pointerDown.bind(this);
this._pointerUp = this._pointerUp.bind(this);
this._contextMenu = this._contextMenu.bind(this);
this.bindCanvas("mousedown", this._mouseDown, {}, customTarget);
this.bindCanvas("pointerdown", this._pointerDown, {}, customTarget);
this.bindCanvas("mouseup", this._mouseUp, {}, customTarget);
this.bindCanvas("pointerup", this._pointerUp, {}, customTarget);
this.bindCanvas("mouseover", this._mouseOver, {}, customTarget);
this.bindCanvas("mouseout", this._mouseOut, {}, customTarget);
this.bindCanvas("mousemove", this._mouseMove, {}, customTarget);
Expand All @@ -5023,7 +5029,9 @@ var MultiTouchSpace = class extends Space {
this._hasMouse = true;
} else {
this.unbindCanvas("mousedown", this._mouseDown, {}, customTarget);
this.unbindCanvas("pointerdown", this._pointerDown, {}, customTarget);
this.unbindCanvas("mouseup", this._mouseUp, {}, customTarget);
this.unbindCanvas("pointerup", this._pointerUp, {}, customTarget);
this.unbindCanvas("mouseover", this._mouseOver, {}, customTarget);
this.unbindCanvas("mouseout", this._mouseOut, {}, customTarget);
this.unbindCanvas("mousemove", this._mouseMove, {}, customTarget);
Expand Down Expand Up @@ -5135,6 +5143,13 @@ var MultiTouchSpace = class extends Space {
this._pressed = true;
return false;
}
_pointerDown(evt) {
this._mouseAction(UIPointerActions.pointerdown, evt);
if (evt.target instanceof Element) {
evt.target.setPointerCapture(evt.pointerId);
}
return false;
}
/**
* MouseUp handler.
* @param evt
Expand All @@ -5149,6 +5164,16 @@ var MultiTouchSpace = class extends Space {
this._dragged = false;
return false;
}
_pointerUp(evt) {
this._mouseAction(UIPointerActions.pointerup, evt);
if (evt.target instanceof Element) {
evt.target.releasePointerCapture(evt.pointerId);
if (this._dragged)
this._mouseAction(UIPointerActions.drop, evt);
this._dragged = false;
}
return false;
}
/**
* MouseMove handler.
* @param evt
Expand Down
27 changes: 26 additions & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4232,6 +4232,8 @@ var UIPointerActions = {
click: "click",
keydown: "keydown",
keyup: "keyup",
pointerdown: "pointerdown",
pointerup: "pointerup",
contextmenu: "contextmenu",
all: "all"
};
Expand Down Expand Up @@ -4707,7 +4709,7 @@ var Space = class {
add(p) {
let player = typeof p == "function" ? { animate: p } : p;
let k = this.playerCount++;
let pid = this.id + k;
let pid = player.animateID || this.id + k;
this.players[pid] = player;
player.animateID = pid;
if (player.resize && this.bound.inited)
Expand Down Expand Up @@ -4944,9 +4946,13 @@ var MultiTouchSpace = class extends Space {
this._mouseOut = this._mouseOut.bind(this);
this._mouseMove = this._mouseMove.bind(this);
this._mouseClick = this._mouseClick.bind(this);
this._pointerDown = this._pointerDown.bind(this);
this._pointerUp = this._pointerUp.bind(this);
this._contextMenu = this._contextMenu.bind(this);
this.bindCanvas("mousedown", this._mouseDown, {}, customTarget);
this.bindCanvas("pointerdown", this._pointerDown, {}, customTarget);
this.bindCanvas("mouseup", this._mouseUp, {}, customTarget);
this.bindCanvas("pointerup", this._pointerUp, {}, customTarget);
this.bindCanvas("mouseover", this._mouseOver, {}, customTarget);
this.bindCanvas("mouseout", this._mouseOut, {}, customTarget);
this.bindCanvas("mousemove", this._mouseMove, {}, customTarget);
Expand All @@ -4955,7 +4961,9 @@ var MultiTouchSpace = class extends Space {
this._hasMouse = true;
} else {
this.unbindCanvas("mousedown", this._mouseDown, {}, customTarget);
this.unbindCanvas("pointerdown", this._pointerDown, {}, customTarget);
this.unbindCanvas("mouseup", this._mouseUp, {}, customTarget);
this.unbindCanvas("pointerup", this._pointerUp, {}, customTarget);
this.unbindCanvas("mouseover", this._mouseOver, {}, customTarget);
this.unbindCanvas("mouseout", this._mouseOut, {}, customTarget);
this.unbindCanvas("mousemove", this._mouseMove, {}, customTarget);
Expand Down Expand Up @@ -5067,6 +5075,13 @@ var MultiTouchSpace = class extends Space {
this._pressed = true;
return false;
}
_pointerDown(evt) {
this._mouseAction(UIPointerActions.pointerdown, evt);
if (evt.target instanceof Element) {
evt.target.setPointerCapture(evt.pointerId);
}
return false;
}
/**
* MouseUp handler.
* @param evt
Expand All @@ -5081,6 +5096,16 @@ var MultiTouchSpace = class extends Space {
this._dragged = false;
return false;
}
_pointerUp(evt) {
this._mouseAction(UIPointerActions.pointerup, evt);
if (evt.target instanceof Element) {
evt.target.releasePointerCapture(evt.pointerId);
if (this._dragged)
this._mouseAction(UIPointerActions.drop, evt);
this._dragged = false;
}
return false;
}
/**
* MouseMove handler.
* @param evt
Expand Down
29 changes: 27 additions & 2 deletions dist/pts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright © 2017-2023 William Ngan and contributors.
/* Copyright © 2017-2024 William Ngan and contributors.
Licensed under Apache 2.0 License.
See https://github.com/williamngan/pts for details. */
(() => {
Expand Down Expand Up @@ -4318,6 +4318,8 @@ See https://github.com/williamngan/pts for details. */
click: "click",
keydown: "keydown",
keyup: "keyup",
pointerdown: "pointerdown",
pointerup: "pointerup",
contextmenu: "contextmenu",
all: "all"
};
Expand Down Expand Up @@ -4793,7 +4795,7 @@ See https://github.com/williamngan/pts for details. */
add(p) {
let player = typeof p == "function" ? { animate: p } : p;
let k = this.playerCount++;
let pid = this.id + k;
let pid = player.animateID || this.id + k;
this.players[pid] = player;
player.animateID = pid;
if (player.resize && this.bound.inited)
Expand Down Expand Up @@ -5030,9 +5032,13 @@ See https://github.com/williamngan/pts for details. */
this._mouseOut = this._mouseOut.bind(this);
this._mouseMove = this._mouseMove.bind(this);
this._mouseClick = this._mouseClick.bind(this);
this._pointerDown = this._pointerDown.bind(this);
this._pointerUp = this._pointerUp.bind(this);
this._contextMenu = this._contextMenu.bind(this);
this.bindCanvas("mousedown", this._mouseDown, {}, customTarget);
this.bindCanvas("pointerdown", this._pointerDown, {}, customTarget);
this.bindCanvas("mouseup", this._mouseUp, {}, customTarget);
this.bindCanvas("pointerup", this._pointerUp, {}, customTarget);
this.bindCanvas("mouseover", this._mouseOver, {}, customTarget);
this.bindCanvas("mouseout", this._mouseOut, {}, customTarget);
this.bindCanvas("mousemove", this._mouseMove, {}, customTarget);
Expand All @@ -5041,7 +5047,9 @@ See https://github.com/williamngan/pts for details. */
this._hasMouse = true;
} else {
this.unbindCanvas("mousedown", this._mouseDown, {}, customTarget);
this.unbindCanvas("pointerdown", this._pointerDown, {}, customTarget);
this.unbindCanvas("mouseup", this._mouseUp, {}, customTarget);
this.unbindCanvas("pointerup", this._pointerUp, {}, customTarget);
this.unbindCanvas("mouseover", this._mouseOver, {}, customTarget);
this.unbindCanvas("mouseout", this._mouseOut, {}, customTarget);
this.unbindCanvas("mousemove", this._mouseMove, {}, customTarget);
Expand Down Expand Up @@ -5153,6 +5161,13 @@ See https://github.com/williamngan/pts for details. */
this._pressed = true;
return false;
}
_pointerDown(evt) {
this._mouseAction(UIPointerActions.pointerdown, evt);
if (evt.target instanceof Element) {
evt.target.setPointerCapture(evt.pointerId);
}
return false;
}
/**
* MouseUp handler.
* @param evt
Expand All @@ -5167,6 +5182,16 @@ See https://github.com/williamngan/pts for details. */
this._dragged = false;
return false;
}
_pointerUp(evt) {
this._mouseAction(UIPointerActions.pointerup, evt);
if (evt.target instanceof Element) {
evt.target.releasePointerCapture(evt.pointerId);
if (this._dragged)
this._mouseAction(UIPointerActions.drop, evt);
this._dragged = false;
}
return false;
}
/**
* MouseMove handler.
* @param evt
Expand Down
8 changes: 4 additions & 4 deletions dist/pts.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pts.min.js.map

Large diffs are not rendered by default.

0 comments on commit d00e149

Please sign in to comment.