Skip to content

Commit

Permalink
Take into account cropped layout setting
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge authored and backportbot-nextcloud[bot] committed Mar 1, 2023
1 parent 9a856bf commit 03d4a30
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/FilesListViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import TiledLayout from '../components/TiledLayout/TiledLayout.vue'
import { fetchFile } from '../services/fileFetcher.js'
import VirtualScrolling from '../components/VirtualScrolling.vue'
import EmptyBox from '../assets/Illustrations/empty.svg'
import { loadState } from '@nextcloud/initial-state'

export default {
name: 'FilesListViewer',
Expand Down Expand Up @@ -135,9 +136,10 @@ export default {
data() {
return {
EmptyBox,
croppedLayout: loadState('photos', 'croppedLayout', 'false') === 'true',
placeholderFiles: Array(20).fill(0).map((_, index) => {
const height = 200
const width = height * (1 + Math.random() * 2)
const width = this.croppedLayout ? height : height * (1 + Math.random() * 2)
return {
id: index,
width,
Expand Down Expand Up @@ -248,7 +250,7 @@ export default {
id: file.fileid,
width: file.fileMetadataSizeParsed.width,
height: file.fileMetadataSizeParsed.height,
ratio: file.fileMetadataSizeParsed.width / file.fileMetadataSizeParsed.height,
ratio: this.croppedLayout ? 1 : file.fileMetadataSizeParsed.width / file.fileMetadataSizeParsed.height,
}
},

Expand Down

0 comments on commit 03d4a30

Please sign in to comment.