Skip to content

Commit

Permalink
Merge pull request #578 from brunosabot/fix/feedbac-element-pointer
Browse files Browse the repository at this point in the history
fix: Prevent the feedback element to be clicked
  • Loading branch information
Clooos authored Jun 14, 2024
2 parents e0ae933 + 5ae45fa commit 81db665
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cards/button/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export default `
width: 100%;
height: 100%;
background-color: rgb(0,0,0);
pointer-events: none;
}
@keyframes tap-feedback {
Expand Down
7 changes: 4 additions & 3 deletions src/tools/tap-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ActionHandler {

this.startTime = Date.now();
clearTimeout(this.tapTimeout);
this.tapTimeout = null;
}

handleEnd() {
Expand All @@ -42,16 +43,16 @@ class ActionHandler {
this.startTime = null;

const doubleTapAction = this.config?.double_tap_action || this.defaultActions?.double_tap_action || { action: "toggle" };
const doubleTapTimeout = doubleTapAction.action === "none" ? 0 : 200;
const localDoubleTapTimeout = doubleTapAction.action === "none" ? 0 : doubleTapTimeout;

if (holdDuration > maxHoldDuration) {
this.sendActionEvent(this.element, this.config, 'hold', this.defaultEntity, this.defaultActions);
} else if (doubleTapDuration < doubleTapTimeout) {
} else if (doubleTapDuration < localDoubleTapTimeout) {
this.sendActionEvent(this.element, this.config, 'double_tap', this.defaultEntity, this.defaultActions);
} else {
this.tapTimeout = setTimeout(() => {
this.sendActionEvent(this.element, this.config, 'tap', this.defaultEntity, this.defaultActions);
}, doubleTapTimeout);
}, localDoubleTapTimeout);
}
}
}
Expand Down

0 comments on commit 81db665

Please sign in to comment.