Only use actionHandler on card.
This commit is contained in:
+10
-17
@@ -677,22 +677,6 @@ export class FrigateCard extends LitElement {
|
||||
return `${this.config.frigate.url}/events?camera=${this._frigateCameraName}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle interaction with the card.
|
||||
*/
|
||||
protected _interactionHandler(): void {
|
||||
if (!this.config.view.timeout) {
|
||||
return;
|
||||
}
|
||||
if (this._interactionTimerID) {
|
||||
window.clearTimeout(this._interactionTimerID);
|
||||
}
|
||||
this._interactionTimerID = window.setTimeout(() => {
|
||||
this._interactionTimerID = null;
|
||||
this._changeView();
|
||||
}, this.config.view.timeout * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an action called on an element.
|
||||
* @param ev The actionHandler event.
|
||||
@@ -718,6 +702,16 @@ export class FrigateCard extends LitElement {
|
||||
) {
|
||||
handleAction(node, this._hass as HomeAssistant, config, ev.detail.action);
|
||||
}
|
||||
|
||||
if (this.config.view.timeout) {
|
||||
if (this._interactionTimerID) {
|
||||
window.clearTimeout(this._interactionTimerID);
|
||||
}
|
||||
this._interactionTimerID = window.setTimeout(() => {
|
||||
this._interactionTimerID = null;
|
||||
this._changeView();
|
||||
}, this.config.view.timeout * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -962,7 +956,6 @@ export class FrigateCard extends LitElement {
|
||||
const actions = this._getMergedActions();
|
||||
|
||||
return html` <ha-card
|
||||
@click=${this._interactionHandler}
|
||||
.actionHandler=${actionHandler({
|
||||
hasHold: hasAction(actions.hold_action),
|
||||
hasDoubleClick: hasAction(actions.double_tap_action),
|
||||
|
||||
Reference in New Issue
Block a user