Don't breakout folders and tags (fix #94)

old-stable24
Varun Patil 2022-10-23 10:46:09 -07:00
parent 2503b21e48
commit 6f7bdad55b
2 changed files with 15 additions and 5 deletions

View File

@ -803,6 +803,9 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
data = data.filter((p) => !(p.isfolder && (<IFolder>p).name.startsWith('.')));
}
// Convert server flags to bitflags
data.forEach(utils.convertFlags);
// Set and make reactive
day.count = data.length;
day.detail = data;
@ -817,6 +820,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
return {
width: p.w || this.rowHeight,
height: p.h || this.rowHeight,
forceSquare: Boolean((p.flag & this.c.FLAG_IS_FOLDER) | (p.flag & this.c.FLAG_IS_TAG)),
};
}), {
rowWidth: this.rowWidth,
@ -896,9 +900,6 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
photo.d = day; // backref to day
}
// Flag conversion
utils.convertFlags(photo);
// Get aspect ratio
const setPos = () => {
photo.dispW = utils.roundHalf(jbox.width);

View File

@ -7,7 +7,11 @@ import justifiedLayout from "justified-layout";
* Otherwise, use flickr/justified-layout (at least for now).
*/
export function getLayout(
input: { width: number, height: number }[],
input: {
width: number,
height: number,
forceSquare: boolean,
}[],
opts: {
rowWidth: number,
rowHeight: number,
@ -110,8 +114,13 @@ export function getLayout(
// The next row gets filled
(numLeft === 0 || numLeft >= opts.numCols);
// Probably folders or tags or faces
if (input[photoId].forceSquare) {
// We are square already. Everything below is else-if.
}
// Full width breakout
if (canBreakout && rand() < (input.length > 0 ? 0.25 : 0.1)) {
else if (canBreakout && rand() < (input.length > 0 ? 0.25 : 0.1)) {
matrix[row][col] |= FLAG_BREAKOUT;
for (let i = 1; i < opts.numCols; i++) {
matrix[row][i] |= FLAG_USED;