Skip to content

Commit

Permalink
check if touchpad click count is greater than 1 rather than comparing…
Browse files Browse the repository at this point in the history
… to touches count
  • Loading branch information
Nerwyn committed Dec 13, 2024
1 parent 201bcb9 commit 1b644ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/universal-remote-card.min.js

Large diffs are not rendered by default.

12 changes: 1 addition & 11 deletions src/classes/remote-touchpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class RemoteTouchpad extends BaseRemoteElement {
onClick(e: TouchEvent | MouseEvent) {
e.stopImmediatePropagation();
this.clickCount++;
const doubleTapThreshold = this.targetTouches?.length || 1;
const multiPrefix = this.getMultiPrefix();

if (
Expand All @@ -47,7 +46,7 @@ export class RemoteTouchpad extends BaseRemoteElement {
// Double tap action is defined
const doubleTapAction: ActionType = `${multiPrefix}double_tap_action`;

if (this.clickCount > doubleTapThreshold) {
if (this.clickCount > 1) {
// Double tap action is triggered
this.fireHapticEvent('success');
this.sendAction(doubleTapAction);
Expand All @@ -64,15 +63,6 @@ export class RemoteTouchpad extends BaseRemoteElement {
this.clickTimer = setTimeout(() => {
this.fireHapticEvent('light');
this.sendAction(`${multiPrefix}tap_action`);

// DEBUG REMOVE LATER
const clickCount = this.clickCount;
const touchesCount = this.targetTouches?.length ?? 0;
setTimeout(() => {
alert(
`Clicks: ${clickCount}\nTouches: ${touchesCount}`,
);
}, 1000);
this.endAction();
}, doubleTapWindow);
}
Expand Down

0 comments on commit 1b644ce

Please sign in to comment.