Wrap content in a 16/9 container.
This commit is contained in:
@@ -512,7 +512,7 @@ export class FrigateCard extends LitElement {
|
|||||||
icon: string,
|
icon: string,
|
||||||
message: string | TemplateResult | null = null,
|
message: string | TemplateResult | null = null,
|
||||||
): TemplateResult {
|
): TemplateResult {
|
||||||
return html` <div class="frigate-card-contents attention">
|
return html` <div class="attention">
|
||||||
<span>
|
<span>
|
||||||
<ha-icon icon="${icon}"> </ha-icon>
|
<ha-icon icon="${icon}"> </ha-icon>
|
||||||
${message ? html` ${message}` : ''}
|
${message ? html` ${message}` : ''}
|
||||||
@@ -829,7 +829,6 @@ export class FrigateCard extends LitElement {
|
|||||||
? html`<ha-hls-player
|
? html`<ha-hls-player
|
||||||
.hass=${this._hass}
|
.hass=${this._hass}
|
||||||
.url=${resolvedMedia.url}
|
.url=${resolvedMedia.url}
|
||||||
class="frigate-card-contents"
|
|
||||||
title="${mediaToRender.title}"
|
title="${mediaToRender.title}"
|
||||||
muted
|
muted
|
||||||
controls
|
controls
|
||||||
@@ -839,7 +838,6 @@ export class FrigateCard extends LitElement {
|
|||||||
>
|
>
|
||||||
</ha-hls-player>`
|
</ha-hls-player>`
|
||||||
: html`<video
|
: html`<video
|
||||||
class="frigate-card-contents"
|
|
||||||
title="${mediaToRender.title}"
|
title="${mediaToRender.title}"
|
||||||
muted
|
muted
|
||||||
controls
|
controls
|
||||||
@@ -856,7 +854,7 @@ export class FrigateCard extends LitElement {
|
|||||||
</video>`
|
</video>`
|
||||||
: html`<img
|
: html`<img
|
||||||
src=${resolvedMedia.url}
|
src=${resolvedMedia.url}
|
||||||
class="frigate-card-contents"
|
class="snapshot"
|
||||||
title="${mediaToRender.title}"
|
title="${mediaToRender.title}"
|
||||||
@click=${() => {
|
@click=${() => {
|
||||||
// Get clips potentially related to this snapshot.
|
// Get clips potentially related to this snapshot.
|
||||||
@@ -998,6 +996,7 @@ export class FrigateCard extends LitElement {
|
|||||||
}
|
}
|
||||||
return html` <ha-card @click=${this._interactionHandler}>
|
return html` <ha-card @click=${this._interactionHandler}>
|
||||||
${this.config.menu_mode != 'below' ? this._renderMenu() : ''}
|
${this.config.menu_mode != 'below' ? this._renderMenu() : ''}
|
||||||
|
<div class="container_16_9">
|
||||||
<div class="frigate-card-contents">
|
<div class="frigate-card-contents">
|
||||||
${this._view.is('clips') || this._view.is('snapshots')
|
${this._view.is('clips') || this._view.is('snapshots')
|
||||||
? until(this._renderEvents(), this._renderProgressIndicator())
|
? until(this._renderEvents(), this._renderProgressIndicator())
|
||||||
@@ -1007,6 +1006,7 @@ export class FrigateCard extends LitElement {
|
|||||||
: ``}
|
: ``}
|
||||||
${this._view.is('live') ? this._renderLiveViewer() : ``}
|
${this._view.is('live') ? this._renderLiveViewer() : ``}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
${this.config.menu_mode == 'below' ? this._renderMenu() : ''}
|
${this.config.menu_mode == 'below' ? this._renderMenu() : ''}
|
||||||
</ha-card>`;
|
</ha-card>`;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-3
@@ -2,26 +2,38 @@
|
|||||||
@use "@material/image-list";
|
@use "@material/image-list";
|
||||||
@use './common.scss';
|
@use './common.scss';
|
||||||
|
|
||||||
|
.container_16_9 {
|
||||||
|
/* 16:9 Aspect Ratio. When Safari supports 'aspect-ratio' this should not be
|
||||||
|
necessary */
|
||||||
|
padding-top: 56.25%; // 9 / 16 == 0.5625
|
||||||
|
}
|
||||||
|
|
||||||
.frigate-card-contents {
|
.frigate-card-contents {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
aspect-ratio: 16 / 9;
|
aspect-ratio: 16 / 9;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
-ms-overflow-style: none; /* Hide scrollbar: IE and Edge */
|
-ms-overflow-style: none; /* Hide scrollbar: IE and Edge */
|
||||||
scrollbar-width: none; /* Hide scrollbar: Firefox */
|
scrollbar-width: none; /* Hide scrollbar: Firefox */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.frigate-card-contents img.snapshot {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hide scrollbar for Chrome, Safari and Opera */
|
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||||
.frigate-card-contents::-webkit-scrollbar {
|
.frigate-card-contents::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.frigate-card-contents.attention {
|
.frigate-card-contents .attention {
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 5%;
|
padding: 5%;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user