Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/right click #92

Merged
merged 16 commits into from
Oct 23, 2019
Prev Previous commit
Next Next commit
backward compatible api
  • Loading branch information
tibotiber committed Oct 17, 2019
commit 4c653c5f9045bc5fbbe1c03ca49bfecdf45c8096
10 changes: 5 additions & 5 deletions src/UI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ export class UI {
/**
* Listen for UI events and trigger action handlers.
* @param type an action type. Can be one of UIPointerActions or a custom one.
* @param evt a MouseEvent emitted by the browser (See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent))
* @param p a point to check
* @param evt a MouseEvent emitted by the browser (See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent))
*/
listen( type:string, evt:MouseEvent, p:PtLike ):boolean {
listen( type:string, p:PtLike, evt:MouseEvent ):boolean {
if ( this._actions[type] !== undefined ) {

if ( this._within(p) || Array.from(this._holds.values()).indexOf(type) >= 0 ) {
Expand Down Expand Up @@ -211,12 +211,12 @@ export class UI {
* A static function to listen for a list of UIs. See also [`UI.listen`](#link).
* @param uis an array of UI
* @param type an action type. Can be one of `UIPointerActions` or a custom one.
* @param evt a MouseEvent emitted by the browser (See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent))
* @param p a point to check
* @param evt a MouseEvent emitted by the browser (See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent))
*/
static track( uis:UI[], type:string, evt:MouseEvent, p:PtLike ):void {
static track( uis:UI[], type:string, p:PtLike, evt:MouseEvent ):void {
for (let i=0, len=uis.length; i<len; i++) {
uis[i].listen( type, evt, p );
uis[i].listen( type, p, evt );
}
}

Expand Down