Merge pull request #64 from dermotduffy/scrollbars-and-css-messy
Refactor CSS to force aspect ratio and avoid scrollbars
This commit is contained in:
+15
-19
@@ -512,7 +512,7 @@ export class FrigateCard extends LitElement {
|
||||
icon: string,
|
||||
message: string | TemplateResult | null = null,
|
||||
): TemplateResult {
|
||||
return html` <div class="frigate-card-attention">
|
||||
return html` <div class="attention">
|
||||
<span>
|
||||
<ha-icon icon="${icon}"> </ha-icon>
|
||||
${message ? html` ${message}` : ''}
|
||||
@@ -737,12 +737,12 @@ export class FrigateCard extends LitElement {
|
||||
'frigate-media-controls': true,
|
||||
previous: previous,
|
||||
next: !previous,
|
||||
thumbnails: (
|
||||
thumbnails:
|
||||
!this.config.controls?.nextprev ||
|
||||
this.config.controls?.nextprev === "thumbnails"),
|
||||
chevrons: this.config.controls?.nextprev === "chevrons",
|
||||
button: this.config.controls?.nextprev === "chevrons",
|
||||
}
|
||||
this.config.controls?.nextprev === 'thumbnails',
|
||||
chevrons: this.config.controls?.nextprev === 'chevrons',
|
||||
button: this.config.controls?.nextprev === 'chevrons',
|
||||
};
|
||||
|
||||
const clickChangeView = () => {
|
||||
this._view = new View({
|
||||
@@ -751,7 +751,7 @@ export class FrigateCard extends LitElement {
|
||||
childIndex: targetChildIndex,
|
||||
previous: this._view,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (this.config.controls?.nextprev == 'chevrons') {
|
||||
return html` <ha-icon-button
|
||||
@@ -827,9 +827,9 @@ export class FrigateCard extends LitElement {
|
||||
${this._view.is('clip')
|
||||
? resolvedMedia?.mime_type.toLowerCase() == 'application/x-mpegurl'
|
||||
? html`<ha-hls-player
|
||||
class="media"
|
||||
.hass=${this._hass}
|
||||
.url=${resolvedMedia.url}
|
||||
class="frigate-card-viewer"
|
||||
title="${mediaToRender.title}"
|
||||
muted
|
||||
controls
|
||||
@@ -839,7 +839,7 @@ export class FrigateCard extends LitElement {
|
||||
>
|
||||
</ha-hls-player>`
|
||||
: html`<video
|
||||
class="frigate-card-viewer"
|
||||
class="media"
|
||||
title="${mediaToRender.title}"
|
||||
muted
|
||||
controls
|
||||
@@ -856,7 +856,7 @@ export class FrigateCard extends LitElement {
|
||||
</video>`
|
||||
: html`<img
|
||||
src=${resolvedMedia.url}
|
||||
class="frigate-card-viewer"
|
||||
class="media"
|
||||
title="${mediaToRender.title}"
|
||||
@click=${() => {
|
||||
// Get clips potentially related to this snapshot.
|
||||
@@ -998,20 +998,16 @@ export class FrigateCard extends LitElement {
|
||||
}
|
||||
return html` <ha-card @click=${this._interactionHandler}>
|
||||
${this.config.menu_mode != 'below' ? this._renderMenu() : ''}
|
||||
<div class="container_16_9">
|
||||
<div class="frigate-card-contents">
|
||||
${this._view.is('clips') || this._view.is('snapshots')
|
||||
? html`<div class="frigate-card-gallery">
|
||||
${until(this._renderEvents(), this._renderProgressIndicator())}
|
||||
</div>`
|
||||
? until(this._renderEvents(), this._renderProgressIndicator())
|
||||
: ``}
|
||||
${this._view.is('clip') || this._view.is('snapshot')
|
||||
? html`<div class="frigate-card-viewer">
|
||||
${until(this._renderViewer(), this._renderProgressIndicator())}
|
||||
</div>`
|
||||
: ``}
|
||||
${this._view.is('live')
|
||||
? html`<div class="frigate-card-viewer">${this._renderLiveViewer()}</div>`
|
||||
? until(this._renderViewer(), this._renderProgressIndicator())
|
||||
: ``}
|
||||
${this._view.is('live') ? this._renderLiveViewer() : ``}
|
||||
</div>
|
||||
</div>
|
||||
${this.config.menu_mode == 'below' ? this._renderMenu() : ''}
|
||||
</ha-card>`;
|
||||
|
||||
+20
-21
@@ -2,43 +2,42 @@
|
||||
@use "@material/image-list";
|
||||
@use './common.scss';
|
||||
|
||||
.container_16_9 {
|
||||
/* 16:9 Aspect Ratio. When Safari supports 'aspect-ratio' this should not be
|
||||
necessary */
|
||||
position: relative;
|
||||
padding-top: 56.25%; // 9 / 16 == 0.5625
|
||||
}
|
||||
|
||||
.frigate-card-contents {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
|
||||
max-height: 277px; /* Max Lovelace 16/9 video height */
|
||||
height: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.frigate-card-viewer {
|
||||
width: 100%;
|
||||
|
||||
height: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
|
||||
.frigate-card-gallery {
|
||||
overflow: auto;
|
||||
-ms-overflow-style: none; /* Hide scrollbar: IE and Edge */
|
||||
scrollbar-width: none; /* Hide scrollbar: Firefox */
|
||||
}
|
||||
|
||||
height: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
.frigate-card-contents img.media,video.media {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||
.frigate-card-gallery::-webkit-scrollbar {
|
||||
.frigate-card-contents::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.frigate-card-attention {
|
||||
.frigate-card-contents .attention {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0% 5% 0% 5%;
|
||||
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 5%;
|
||||
}
|
||||
|
||||
.frigate-card-image-list {
|
||||
|
||||
Reference in New Issue
Block a user