Minor pointer fixes.

This commit is contained in:
Dermot Duffy
2024-08-17 11:40:33 -07:00
parent e503f0e429
commit 869c2f9049
3 changed files with 26 additions and 17 deletions
+15 -10
View File
@@ -211,9 +211,12 @@ class FrigateCard extends LitElement {
// If there's nothing to render... // If there's nothing to render...
(menuStyle === 'none' && statusBarStyle === 'none') || (menuStyle === 'none' && statusBarStyle === 'none') ||
// ... or the position I'm rendering does not contain the menu/status bar // ... or the position I'm rendering does not contain the menu/status bar
(position === 'overlay' &&
menuStyle === 'outside' &&
statusBarStyle === 'outside') ||
(position !== 'overlay' && (position !== 'overlay' &&
menuPosition !== position && (menuStyle !== 'outside' || menuPosition !== position) &&
statusBarPosition !== position) (statusBarStyle !== 'outside' || statusBarPosition !== position))
) { ) {
// ... then there's nothing to do. // ... then there's nothing to do.
return; return;
@@ -230,16 +233,18 @@ class FrigateCard extends LitElement {
((statusBarStyle === 'outside' && kind === 'outerlay') || ((statusBarStyle === 'outside' && kind === 'outerlay') ||
(statusBarStyle !== 'outside' && kind === 'overlay')); (statusBarStyle !== 'outside' && kind === 'overlay'));
// As an exception, to improve the visual flow, if the menu is being
// rendered on the bottom, render the status bar first. // Complex logic to try to always put the menu in the right-looking place.
const renderMenuFirst =
menuPosition === 'left' ||
menuPosition === 'right' ||
(menuPosition === 'bottom' && menuStyle === 'hidden' && statusBarStyle !== 'popup') ||
(menuPosition === 'top' && (menuStyle !== 'hidden' || statusBarStyle === 'popup'));
return html` return html`
${shouldRenderMenu && menuPosition !== 'bottom' ${shouldRenderMenu && renderMenuFirst ? this._renderMenu(menuPosition) : ''}
? this._renderMenu(menuPosition)
: ''}
${shouldRenderStatusBar ? this._renderStatusBar(statusBarPosition) : ''} ${shouldRenderStatusBar ? this._renderStatusBar(statusBarPosition) : ''}
${shouldRenderMenu && menuPosition === 'bottom' ${shouldRenderMenu && !renderMenuFirst ? this._renderMenu(menuPosition) : ''}
? this._renderMenu(menuPosition)
: ''}
`; `;
}; };
+3 -6
View File
@@ -505,7 +505,7 @@ export class FrigateCardViewerCarousel extends LitElement {
return html` <div class="embla__slide"> return html` <div class="embla__slide">
<frigate-card-viewer-provider <frigate-card-viewer-provider
.hass=${this.hass} .hass=${this.hass}
.view=${view} .viewManagerEpoch=${this.viewManagerEpoch}
.media=${media} .media=${media}
.viewerConfig=${this.viewerConfig} .viewerConfig=${this.viewerConfig}
.resolvedMediaCache=${this.resolvedMediaCache} .resolvedMediaCache=${this.resolvedMediaCache}
@@ -724,10 +724,7 @@ export class FrigateCardViewerProvider
return null; return null;
} }
/** protected async _switchToRelatedClipView(): Promise<void> {
* Dispatch a clip view that matches the current (snapshot) query.
*/
protected async _dispatchRelatedClipView(): Promise<void> {
const view = this.viewManagerEpoch?.manager.getView(); const view = this.viewManagerEpoch?.manager.getView();
if ( if (
!this.hass || !this.hass ||
@@ -912,7 +909,7 @@ export class FrigateCardViewerProvider
title="${this.media.getTitle() ?? ''}" title="${this.media.getTitle() ?? ''}"
@click=${() => { @click=${() => {
if (this.viewerConfig?.snapshot_click_plays_clip) { if (this.viewerConfig?.snapshot_click_plays_clip) {
this._dispatchRelatedClipView(); this._switchToRelatedClipView();
} }
}} }}
@load=${(ev: Event) => { @load=${(ev: Event) => {
+8 -1
View File
@@ -13,6 +13,14 @@
transition: opacity 1s; transition: opacity 1s;
} }
/*******************************************************
* Non-hover styles should not interact with the pointer
*******************************************************/
:host(:not([data-style*='hover'])) {
pointer-events: none;
}
/*************** /***************
* Outside style * Outside style
***************/ ***************/
@@ -32,7 +40,6 @@
} }
:host([data-style='popup'][hide]) { :host([data-style='popup'][hide]) {
opacity: 0; opacity: 0;
pointer-events: none;
} }
/********************* /*********************