Fix expanded mode / fullscreen interactions.
This commit is contained in:
+17
-6
@@ -1441,10 +1441,11 @@ class FrigateCard extends LitElement {
|
|||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'expand':
|
||||||
|
this._setExpand(!this._expand);
|
||||||
|
break;
|
||||||
case 'fullscreen':
|
case 'fullscreen':
|
||||||
if (screenfull.isEnabled) {
|
this._toggleFullscreen();
|
||||||
screenfull.toggle(this);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'menu_toggle':
|
case 'menu_toggle':
|
||||||
// This is a rare code path: this would only be used if someone has a
|
// This is a rare code path: this would only be used if someone has a
|
||||||
@@ -1488,9 +1489,6 @@ class FrigateCard extends LitElement {
|
|||||||
case 'diagnostics':
|
case 'diagnostics':
|
||||||
this._diagnostics();
|
this._diagnostics();
|
||||||
break;
|
break;
|
||||||
case 'expand':
|
|
||||||
this._setExpand(!this._expand);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
console.warn(`Frigate card received unknown card action: ${action}`);
|
console.warn(`Frigate card received unknown card action: ${action}`);
|
||||||
}
|
}
|
||||||
@@ -1926,10 +1924,23 @@ class FrigateCard extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected _setExpand(expand: boolean): void {
|
protected _setExpand(expand: boolean): void {
|
||||||
|
if (screenfull.isEnabled && screenfull.isFullscreen) {
|
||||||
|
// Fullscreen and expanded mode are mutually exclusive.
|
||||||
|
screenfull.exit();
|
||||||
|
}
|
||||||
|
|
||||||
this._expand = expand;
|
this._expand = expand;
|
||||||
this._generateConditionState();
|
this._generateConditionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected _toggleFullscreen(): void {
|
||||||
|
if (screenfull.isEnabled) {
|
||||||
|
// Fullscreen and expanded mode are mutually exclusive.
|
||||||
|
this._expand = false;
|
||||||
|
screenfull.toggle(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected _renderInDialogIfNecessary(contents: TemplateResult): TemplateResult | void {
|
protected _renderInDialogIfNecessary(contents: TemplateResult): TemplateResult | void {
|
||||||
if (this._expand) {
|
if (this._expand) {
|
||||||
return html` <web-dialog
|
return html` <web-dialog
|
||||||
|
|||||||
@@ -184,4 +184,8 @@ web-dialog {
|
|||||||
|
|
||||||
web-dialog::part(dialog) {
|
web-dialog::part(dialog) {
|
||||||
aspect-ratio: var(--frigate-card-expand-aspect-ratio);
|
aspect-ratio: var(--frigate-card-expand-aspect-ratio);
|
||||||
|
|
||||||
|
// Fixes to render the dialog correctly in Safari.
|
||||||
|
border-radius: 0px;
|
||||||
|
background: transparent;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user