Remove frame rowHeight dep
parent
06452f9aa6
commit
059e3ff010
|
@ -138,4 +138,11 @@ body {
|
||||||
|
|
||||||
width: calc(100% - var(--body-container-margin)*1); // was *2
|
width: calc(100% - var(--body-container-margin)*1); // was *2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fill all available space
|
||||||
|
.fill-block {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -51,20 +51,18 @@
|
||||||
class="photo-row"
|
class="photo-row"
|
||||||
:style="{ height: rowHeight + 'px' }">
|
:style="{ height: rowHeight + 'px' }">
|
||||||
|
|
||||||
<div class="photo" v-for="(photo, index) in item.photos" :key="index">
|
<div class="photo" v-for="(photo, index) in item.photos" :key="index"
|
||||||
|
:style="{ width: rowHeight + 'px' }">
|
||||||
<Folder v-if="photo.flag & c.FLAG_IS_FOLDER"
|
<Folder v-if="photo.flag & c.FLAG_IS_FOLDER"
|
||||||
:data="photo"
|
:data="photo"
|
||||||
:rowHeight="rowHeight"
|
|
||||||
:key="photo.fileid" />
|
:key="photo.fileid" />
|
||||||
|
|
||||||
<Tag v-else-if="photo.flag & c.FLAG_IS_TAG"
|
<Tag v-else-if="photo.flag & c.FLAG_IS_TAG"
|
||||||
:data="photo"
|
:data="photo"
|
||||||
:rowHeight="rowHeight"
|
|
||||||
:key="photo.fileid" />
|
:key="photo.fileid" />
|
||||||
|
|
||||||
<Photo v-else
|
<Photo v-else
|
||||||
:data="photo"
|
:data="photo"
|
||||||
:rowHeight="rowHeight"
|
|
||||||
:day="item.day"
|
:day="item.day"
|
||||||
@select="selectionManager.selectPhoto"
|
@select="selectionManager.selectPhoto"
|
||||||
@delete="deleteFromViewWithAnimation"
|
@delete="deleteFromViewWithAnimation"
|
||||||
|
@ -841,6 +839,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.head-row {
|
.head-row {
|
||||||
|
|
|
@ -1,28 +1,25 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="folder" v-bind:class="{
|
<div class="folder fill-block" :class="{
|
||||||
hasPreview: previewFileInfos.length > 0,
|
hasPreview: previewFileInfos.length > 0,
|
||||||
onePreview: previewFileInfos.length === 1,
|
onePreview: previewFileInfos.length === 1,
|
||||||
hasError: error,
|
hasError: error,
|
||||||
}"
|
}"
|
||||||
@click="openFolder(data)"
|
@click="openFolder(data)">
|
||||||
v-bind:style="{
|
<div class="big-icon fill-block">
|
||||||
width: rowHeight + 'px',
|
|
||||||
height: rowHeight + 'px',
|
|
||||||
}">
|
|
||||||
<div class="big-icon">
|
|
||||||
<FolderIcon class="memories__big-folder-icon" />
|
<FolderIcon class="memories__big-folder-icon" />
|
||||||
<div class="name">{{ data.name }}</div>
|
<div class="name">{{ data.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="previews">
|
<div class="previews fill-block">
|
||||||
<div class="img-outer" v-for="info of previewFileInfos" :key="info.fileid">
|
<div class="img-outer" v-for="info of previewFileInfos" :key="info.fileid">
|
||||||
<img
|
<img
|
||||||
:key="'fpreview-' + info.fileid"
|
class="fill-block"
|
||||||
:src="getPreviewUrl(info.fileid, info.etag)"
|
|
||||||
:class="{
|
:class="{
|
||||||
'p-loading': !(info.flag & c.FLAG_LOADED),
|
'p-loading': !(info.flag & c.FLAG_LOADED),
|
||||||
'p-load-fail': info.flag & c.FLAG_LOAD_FAIL,
|
'p-load-fail': info.flag & c.FLAG_LOAD_FAIL,
|
||||||
}"
|
}"
|
||||||
|
:key="'fpreview-' + info.fileid"
|
||||||
|
:src="getPreviewUrl(info.fileid, info.etag)"
|
||||||
@load="info.flag |= c.FLAG_LOADED"
|
@load="info.flag |= c.FLAG_LOADED"
|
||||||
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,7 +44,6 @@ import FolderIcon from 'vue-material-design-icons/Folder.vue';
|
||||||
})
|
})
|
||||||
export default class Folder extends Mixins(GlobalMixin) {
|
export default class Folder extends Mixins(GlobalMixin) {
|
||||||
@Prop() data: IFolder;
|
@Prop() data: IFolder;
|
||||||
@Prop() rowHeight: number;
|
|
||||||
|
|
||||||
// Separate property because the one on data isn't reactive
|
// Separate property because the one on data isn't reactive
|
||||||
private previewFileInfos: IFileInfo[] = [];
|
private previewFileInfos: IFileInfo[] = [];
|
||||||
|
@ -127,7 +123,6 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0; left: 0;
|
top: 0; left: 0;
|
||||||
width: 100%; height: 100%;
|
|
||||||
transition: opacity 0.2s ease-in-out;
|
transition: opacity 0.2s ease-in-out;
|
||||||
|
|
||||||
> .name {
|
> .name {
|
||||||
|
@ -176,7 +171,6 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 100%; width: 100%;
|
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
@media (max-width: 768px) { padding: 1px; }
|
@media (max-width: 768px) { padding: 1px; }
|
||||||
|
|
||||||
|
@ -194,8 +188,6 @@ export default class Folder extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
> img {
|
> img {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
filter: brightness(50%);
|
filter: brightness(50%);
|
||||||
transition: filter 0.2s ease-in-out;
|
transition: filter 0.2s ease-in-out;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="p-outer"
|
<div class="p-outer fill-block"
|
||||||
:class="{
|
:class="{
|
||||||
'selected': (data.flag & c.FLAG_SELECTED),
|
'selected': (data.flag & c.FLAG_SELECTED),
|
||||||
'p-loading': !(data.flag & c.FLAG_LOADED),
|
'p-loading': !(data.flag & c.FLAG_LOADED),
|
||||||
|
@ -15,10 +15,7 @@
|
||||||
<Video :size="20" v-if="data.flag & c.FLAG_IS_VIDEO" />
|
<Video :size="20" v-if="data.flag & c.FLAG_IS_VIDEO" />
|
||||||
<Star :size="20" v-if="data.flag & c.FLAG_IS_FAVORITE" />
|
<Star :size="20" v-if="data.flag & c.FLAG_IS_FAVORITE" />
|
||||||
|
|
||||||
<div class="img-outer" :style="{
|
<div class="img-outer fill-block"
|
||||||
width: rowHeight + 'px',
|
|
||||||
height: rowHeight + 'px',
|
|
||||||
}"
|
|
||||||
@click="click"
|
@click="click"
|
||||||
@contextmenu="contextmenu"
|
@contextmenu="contextmenu"
|
||||||
@touchstart="touchstart"
|
@touchstart="touchstart"
|
||||||
|
@ -26,6 +23,7 @@
|
||||||
@touchend="touchend"
|
@touchend="touchend"
|
||||||
@touchcancel="touchend" >
|
@touchcancel="touchend" >
|
||||||
<img
|
<img
|
||||||
|
class="fill-block"
|
||||||
:src="src()"
|
:src="src()"
|
||||||
:key="data.fileid"
|
:key="data.fileid"
|
||||||
|
|
||||||
|
@ -61,7 +59,6 @@ export default class Photo extends Mixins(GlobalMixin) {
|
||||||
private touchTimer = 0;
|
private touchTimer = 0;
|
||||||
|
|
||||||
@Prop() data: IPhoto;
|
@Prop() data: IPhoto;
|
||||||
@Prop() rowHeight: number;
|
|
||||||
@Prop() day: IDay;
|
@Prop() day: IDay;
|
||||||
|
|
||||||
@Emit('delete') emitDelete(remPhotos: IPhoto[]) {}
|
@Emit('delete') emitDelete(remPhotos: IPhoto[]) {}
|
||||||
|
@ -272,7 +269,6 @@ div.img-outer {
|
||||||
background-clip: content-box;
|
background-clip: content-box;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%; height: 100%;
|
|
||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
|
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
|
|
@ -1,28 +1,25 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="tag" v-bind:class="{
|
<div class="tag fill-block" :class="{
|
||||||
hasPreview: previews.length > 0,
|
hasPreview: previews.length > 0,
|
||||||
onePreview: previews.length === 1,
|
onePreview: previews.length === 1,
|
||||||
hasError: error,
|
hasError: error,
|
||||||
isFace: isFace,
|
isFace: isFace,
|
||||||
}"
|
}"
|
||||||
@click="openTag(data)"
|
@click="openTag(data)">
|
||||||
v-bind:style="{
|
|
||||||
width: rowHeight + 'px',
|
|
||||||
height: rowHeight + 'px',
|
|
||||||
}">
|
|
||||||
|
|
||||||
<div class="bbl"> <NcCounterBubble> {{ data.count }} </NcCounterBubble> </div>
|
<div class="bbl"> <NcCounterBubble> {{ data.count }} </NcCounterBubble> </div>
|
||||||
<div class="name"> {{ data.name }} </div>
|
<div class="name"> {{ data.name }} </div>
|
||||||
|
|
||||||
<div class="previews">
|
<div class="previews fill-block" ref="previews">
|
||||||
<div class="img-outer" v-for="info of previews" :key="info.fileid">
|
<div class="img-outer" v-for="info of previews" :key="info.fileid">
|
||||||
<img
|
<img
|
||||||
:key="'fpreview-' + info.fileid"
|
class="fill-block"
|
||||||
:src="getPreviewUrl(info.fileid, info.etag)"
|
|
||||||
:class="{
|
:class="{
|
||||||
'p-loading': !(info.flag & c.FLAG_LOADED),
|
'p-loading': !(info.flag & c.FLAG_LOADED),
|
||||||
'p-load-fail': info.flag & c.FLAG_LOAD_FAIL,
|
'p-load-fail': info.flag & c.FLAG_LOAD_FAIL,
|
||||||
}"
|
}"
|
||||||
|
:key="'fpreview-' + info.fileid"
|
||||||
|
:src="getPreviewUrl(info.fileid, info.etag)"
|
||||||
:style="getCoverStyle(info)"
|
:style="getCoverStyle(info)"
|
||||||
@load="info.flag |= c.FLAG_LOADED"
|
@load="info.flag |= c.FLAG_LOADED"
|
||||||
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
||||||
|
@ -56,7 +53,6 @@ interface IFaceDetection extends IPhoto {
|
||||||
})
|
})
|
||||||
export default class Tag extends Mixins(GlobalMixin) {
|
export default class Tag extends Mixins(GlobalMixin) {
|
||||||
@Prop() data: ITag;
|
@Prop() data: ITag;
|
||||||
@Prop() rowHeight: number;
|
|
||||||
@Prop() noNavigate: boolean;
|
@Prop() noNavigate: boolean;
|
||||||
|
|
||||||
// Separate property because the one on data isn't reactive
|
// Separate property because the one on data isn't reactive
|
||||||
|
@ -159,13 +155,19 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
// if the face is larger than the image, we don't zoom out (reason for the Math.max)
|
// if the face is larger than the image, we don't zoom out (reason for the Math.max)
|
||||||
const zoom = Math.max(1, (1 / detection.width) * 0.4)
|
const zoom = Math.max(1, (1 / detection.width) * 0.4)
|
||||||
|
|
||||||
|
// Get center coordinate in percent
|
||||||
const horizontalCenterOfFace = (detection.x + detection.width / 2) * 100
|
const horizontalCenterOfFace = (detection.x + detection.width / 2) * 100
|
||||||
const verticalCenterOfFace = (detection.y + detection.height / 2) * 100
|
const verticalCenterOfFace = (detection.y + detection.height / 2) * 100
|
||||||
|
|
||||||
|
// Get preview element dimensions
|
||||||
|
const elem = this.$refs.previews as HTMLElement;
|
||||||
|
const elemWidth = elem.clientWidth;
|
||||||
|
const elemHeight = elem.clientHeight;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// we translate the image so that the center of the detected face is in the center
|
// we translate the image so that the center of the detected face is in the center
|
||||||
// and add the zoom
|
// and add the zoom
|
||||||
transform: `translate(calc(${this.rowHeight}px/2 - ${horizontalCenterOfFace}% ), calc(${this.rowHeight}px/2 - ${verticalCenterOfFace}% )) scale(${zoom})`,
|
transform: `translate(calc(${elemWidth}px/2 - ${horizontalCenterOfFace}% ), calc(${elemHeight}px/2 - ${verticalCenterOfFace}% )) scale(${zoom})`,
|
||||||
// this is necessary for the zoom to zoom toward the center of the face
|
// this is necessary for the zoom to zoom toward the center of the face
|
||||||
transformOrigin: `${horizontalCenterOfFace}% ${verticalCenterOfFace}%`,
|
transformOrigin: `${horizontalCenterOfFace}% ${verticalCenterOfFace}%`,
|
||||||
}
|
}
|
||||||
|
@ -209,7 +211,6 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 100%; width: 100%;
|
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
@media (max-width: 768px) { padding: 1px; }
|
@media (max-width: 768px) { padding: 1px; }
|
||||||
|
|
||||||
|
@ -229,7 +230,6 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
> img {
|
> img {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
|
||||||
filter: brightness(60%);
|
filter: brightness(60%);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: filter 0.2s ease-in-out;
|
transition: filter 0.2s ease-in-out;
|
||||||
|
|
Loading…
Reference in New Issue