Skip to content

Commit

Permalink
Add more-info on double click event (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasqued2 authored Jul 5, 2024
1 parent e5bc7b1 commit 6dc977b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions dist/teamtracker_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ export class TeamTrackerCard extends LitElement {

setConfig(config) {
this._config = config;
this._actionConfig = {
entity: this._config.entity,
// tap_action: {
// action: "more-info",
// },
dblclick_action: {
action: "more-info",
},
// hold_action: {
// action: "more-info",
// start_listening: true,
// },
};
}

getCardSize() {
Expand Down Expand Up @@ -171,6 +184,23 @@ export class TeamTrackerCard extends LitElement {
}
}

firstUpdated() {
// Add the double-click event listener to the card
this.shadowRoot.querySelector('ha-card').addEventListener('dblclick', () => this._handleDoubleClick());
}

_handleDoubleClick() {
const event = new Event('hass-action', {
bubbles: true,
composed: true,
});
event.detail = {
config: this._actionConfig,
action: 'dblclick',
};
this.dispatchEvent(event);
}

//
// Trigger the UI Card Editor from Card Picker
// Uncomment to enable visual editor
Expand Down

0 comments on commit 6dc977b

Please sign in to comment.