Skip to content

Commit 88ea907

Browse files
committed
fix(VirtualScroll): Watch sidebar opening and closing
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 2692734 commit 88ea907

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/components/VirtualScroll.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export default {
4343
fetching() {
4444
return this.$store.state.loading.bookmarks
4545
},
46+
sidebar() {
47+
return this.$store.state.sidebar
48+
},
4649
},
4750
watch: {
4851
newBookmark() {
@@ -60,6 +63,11 @@ export default {
6063
itemWidth() {
6164
this.recalculateVisibleItems()
6265
},
66+
sidebar() {
67+
this.$nextTick(() => {
68+
this.onScroll()
69+
})
70+
},
6371
},
6472
mounted() {
6573
this.$nextTick(() => {
@@ -73,6 +81,8 @@ export default {
7381
},
7482
methods: {
7583
onViewModeChange() {
84+
this.viewport.width = this.$el.clientWidth
85+
this.viewport.height = this.$el.clientHeight
7686
if (this.viewMode === 'grid') {
7787
this.itemHeight = GRID_ITEM_HEIGHT
7888
this.itemWidth = GRID_ITEM_WIDTH
@@ -158,7 +168,7 @@ export default {
158168
style: {
159169
position: 'absolute',
160170
top: `${x * this.itemHeight}px`,
161-
left: `${y * this.itemWidth + 10}px`,
171+
left: `${y * this.itemWidth + (itemsPerRow === 1 ? 0 : 10)}px`,
162172
height: `${this.itemHeight}px`,
163173
width: `${this.itemWidth}px`,
164174
},

0 commit comments

Comments
 (0)