timeline: recomputeSizes rework
parent
fd621f8211
commit
2611af969b
|
@ -17,7 +17,6 @@
|
||||||
ref="recycler"
|
ref="recycler"
|
||||||
class="recycler"
|
class="recycler"
|
||||||
:class="{ 'empty': list.length === 0 }"
|
:class="{ 'empty': list.length === 0 }"
|
||||||
:key="state"
|
|
||||||
:items="list"
|
:items="list"
|
||||||
:emit-update="true"
|
:emit-update="true"
|
||||||
:buffer="400"
|
:buffer="400"
|
||||||
|
@ -290,7 +289,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
// Size of outer container
|
// Size of outer container
|
||||||
const e = this.$refs.container as Element;
|
const e = this.$refs.container as Element;
|
||||||
let height = e.clientHeight;
|
let height = e.clientHeight;
|
||||||
this.rowWidth = e.clientWidth;
|
const width = e.clientWidth;
|
||||||
|
|
||||||
// Scroller spans the container height
|
// Scroller spans the container height
|
||||||
this.scrollerHeight = height;
|
this.scrollerHeight = height;
|
||||||
|
@ -301,7 +300,24 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
|
|
||||||
// Recycler height
|
// Recycler height
|
||||||
const recycler = this.$refs.recycler as any;
|
const recycler = this.$refs.recycler as any;
|
||||||
recycler.$el.style.height = (height - tmHeight - 4) + 'px';
|
const targetHeight = (height - tmHeight - 4);
|
||||||
|
const targetWidth = this.isMobile() ? width : width - 40;
|
||||||
|
const heightChanged = recycler.$el.clientHeight !== targetHeight;
|
||||||
|
const widthChanged = this.rowWidth !== targetWidth;
|
||||||
|
|
||||||
|
if (heightChanged) {
|
||||||
|
recycler.$el.style.height = targetHeight + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widthChanged) {
|
||||||
|
this.rowWidth = targetWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!heightChanged && !widthChanged) {
|
||||||
|
// If the target size is the same, nothing else could have
|
||||||
|
// possibly changed either, so just skip
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isMobile()) {
|
if (this.isMobile()) {
|
||||||
// Mobile
|
// Mobile
|
||||||
|
@ -310,7 +326,6 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
this.squareMode = true;
|
this.squareMode = true;
|
||||||
} else {
|
} else {
|
||||||
// Desktop
|
// Desktop
|
||||||
this.rowWidth -= 40;
|
|
||||||
this.squareMode = this.config_squareThumbs;
|
this.squareMode = this.config_squareThumbs;
|
||||||
|
|
||||||
if (this.squareMode) {
|
if (this.squareMode) {
|
||||||
|
@ -324,7 +339,11 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scrollerManager.adjust();
|
// Reflow if there are elements (this isn't an init call)
|
||||||
|
// An init call reaches here when the top matter size changes
|
||||||
|
if (this.list.length > 0) {
|
||||||
|
this.scrollerManager.adjust();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue