Thumbnail carousel initial draft
This commit is contained in:
+2
-30
@@ -913,41 +913,13 @@ export class FrigateCard extends LitElement {
|
||||
*/
|
||||
protected render(): TemplateResult | void {
|
||||
const padding = this._getAspectRatioPadding();
|
||||
const outerStyle = {},
|
||||
innerStyle = {};
|
||||
const outerStyle = {};
|
||||
|
||||
// Padding to force a particular aspect ratio.
|
||||
if (padding != null) {
|
||||
outerStyle['padding-top'] = `${padding}%`;
|
||||
}
|
||||
|
||||
// Special hacky treatment required when:
|
||||
//
|
||||
// - It's in fullscreen mode
|
||||
// - It's viewing a media item
|
||||
// - And the aspect ratio of the media item < aspect ratio of the window
|
||||
//
|
||||
// Cannot seem to scale the video by height in CSS without actually styling
|
||||
// the underlying video element (which there is no access to as it's buried
|
||||
// past multiple shadow roots), so instead scale the width in terms of'vh'
|
||||
// (viewport height) in proportion to the aspect-ratio of the media.
|
||||
if (
|
||||
screenfull.isEnabled &&
|
||||
screenfull.isFullscreen &&
|
||||
this._view.isMediaView() &&
|
||||
this._mediaShowInfo &&
|
||||
this._mediaShowInfo.width / this._mediaShowInfo.height <
|
||||
window.innerWidth / window.innerHeight
|
||||
) {
|
||||
// If the menu is outside the media (i.e. above/below) allow space for it.
|
||||
const allowance = ['above', 'below'].includes(this.config.menu.mode)
|
||||
? MENU_HEIGHT
|
||||
: 0;
|
||||
innerStyle['max-width'] = `calc(${
|
||||
(100 * this._mediaShowInfo.width) / this._mediaShowInfo.height
|
||||
}vh - ${allowance}px )`;
|
||||
}
|
||||
|
||||
const contentClasses = {
|
||||
'frigate-card-contents': true,
|
||||
absolute: padding != null,
|
||||
@@ -965,7 +937,7 @@ export class FrigateCard extends LitElement {
|
||||
>
|
||||
${this.config.menu.mode == 'above' ? this._renderMenu() : ''}
|
||||
<div class="container outer" style="${styleMap(outerStyle)}">
|
||||
<div class="${classMap(contentClasses)}" style="${styleMap(innerStyle)}">
|
||||
<div class="${classMap(contentClasses)}">
|
||||
${this._frigateCameraName == undefined
|
||||
? until(
|
||||
(async () => {
|
||||
|
||||
Reference in New Issue
Block a user