Skip to content

Commit 1dd48f4

Browse files
committed
Revert "I hate you event handler..."
This reverts commit a059a01.
1 parent 5449925 commit 1dd48f4

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/action-handler.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ export interface ActionHandlerOptions {
2525
disabled?: boolean;
2626
repeat?: number;
2727
repeatLimit?: number;
28-
isIcon?: boolean;
29-
cardHasHold?: boolean;
3028
}
3129

3230
interface ActionHandlerElement extends HTMLElement {
@@ -141,12 +139,6 @@ class ActionHandlerType extends HTMLElement implements ActionHandlerType {
141139
}
142140

143141
element.actionHandler.start = (ev: Event) => {
144-
if (options.cardHasHold && !options.hasHold) {
145-
return;
146-
}
147-
if (options.isIcon) {
148-
ev.stopPropagation();
149-
}
150142
this.cancelled = false;
151143
let x;
152144
let y;
@@ -180,9 +172,6 @@ class ActionHandlerType extends HTMLElement implements ActionHandlerType {
180172
};
181173

182174
element.actionHandler.end = (ev: Event) => {
183-
if (options.isIcon) {
184-
ev.stopPropagation();
185-
}
186175
// Don't respond when moved or scrolled while touch
187176
if (['touchend', 'touchcancel'].includes(ev.type) && this.cancelled) {
188177
if (this.isRepeating && this.repeatTimeout) {

src/button-card.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,12 @@ class ButtonCard extends LitElement {
12251225
const liveStream = this._buildLiveStream(entityPictureStyle);
12261226
const shouldShowIcon = this._config!.show_icon && (icon || state);
12271227

1228+
// Check if any icon actions are configured
1229+
const hasIconActions =
1230+
this._config!.icon_tap_action!.action !== 'none' ||
1231+
this._config!.icon_hold_action!.action !== 'none' ||
1232+
this._config!.icon_double_tap_action!.action !== 'none';
1233+
12281234
if (shouldShowIcon || entityPicture) {
12291235
let domain: string | undefined = undefined;
12301236
if (state) {
@@ -1250,8 +1256,6 @@ class ButtonCard extends LitElement {
12501256
hasHold: this._config!.icon_hold_action!.action !== 'none',
12511257
repeat: this._config!.icon_hold_action!.repeat,
12521258
repeatLimit: this._config!.icon_hold_action!.repeat_limit,
1253-
isIcon: true,
1254-
cardHasHold: this._config!.hold_action!.action !== 'none',
12551259
})}
12561260
></ha-state-icon>
12571261
`

0 commit comments

Comments
 (0)