@christianriedl/media 1.0.46 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "author": "Christian Riedl",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@christianriedl/utils": "^1.0.74",
21
+ "@christianriedl/utils": "^1.0.75",
22
22
  "@christianriedl/rest": "^1.0.47",
23
23
  "@christianriedl/epg": "^1.0.26"
24
24
  },
@@ -29,6 +29,7 @@
29
29
  const downloadFolder = ref<IMediaFolder | null>(null);
30
30
  const selectedYear = ref<number | undefined>(undefined);
31
31
  const selectedName = ref<string | undefined>(undefined);
32
+ const scrollElement = ref<any | null>(null);
32
33
 
33
34
  window.addEventListener('popstate', onPopState);
34
35
  function onPopState(event: any) {
@@ -57,7 +58,15 @@
57
58
  selectedYear.value = selected.selectedAlbum.Year;
58
59
  const expanded = selected.criteria == 'ye' || root.ItemType == EItemType.PictureCategory;
59
60
  setGrouped(folders, expanded, selectedYear.value);
60
- mediaService.log.trace('Photos start with ' + selected.selected.DLNAID);
61
+ const scrollTop = appState.scrollPosition.value;
62
+ if (scrollTop > 0 && scrollElement.value) {
63
+ nextTick(() => {
64
+ // Scoll to this position
65
+ const el = scrollElement.value?._?.vnode?.el;
66
+ el?.scrollTo(0, scrollTop);
67
+ });
68
+ }
69
+ mediaService.log.trace(`Photos start with ${selected.selected.DLNAID} scrollTop: ${scrollTop}`);
61
70
  })
62
71
  watch(appState.bodyHeight, () => computeListHeight());
63
72
  function computeListHeight() {
@@ -163,6 +172,10 @@
163
172
  function itemText(item: IMediaFolder) : string {
164
173
  return `${item.Name} (${item.ChildCount})`
165
174
  }
175
+ function onScroll(ev: Event) {
176
+ const scrollTop = (ev.target as Element).scrollTop;
177
+ appState.scrollPosition.value = scrollTop;
178
+ }
166
179
  </script>
167
180
  <template>
168
181
  <v-card ref="listhead" class="bg-media">
@@ -185,7 +198,7 @@
185
198
  </v-card-actions>
186
199
  </v-card>
187
200
  <file-upload v-if="uploadVisible"></file-upload>
188
- <v-card :max-height="listHeight" class="overflow-y-auto">
201
+ <v-card :max-height="listHeight" class="overflow-y-auto" ref="scrollElement" v-scroll.self="onScroll">
189
202
  <v-list v-if="!grouped" class="bg-media">
190
203
  <v-list-item-group v-model="itemIndex" color="primary">
191
204
  <v-list-item v-for="item in items" :key="item.DLNAID" :title="itemText(item)" :value="itemText(item)" density="compact" @click.stop="listItem(item)">