Persist snapshot scroll position

This commit is contained in:
Abe Jellinek 2023-06-26 15:00:15 -04:00 committed by Dan Stillman
parent 60f8d11c2d
commit 1d89360765
2 changed files with 12 additions and 12 deletions

View file

@ -658,9 +658,8 @@ class ReaderInstance {
else if (this._type === 'epub') {
item.setAttachmentLastPageIndex(state.cfi);
}
// snapshot
else {
// setAttachmentSomeProperty(state.someProperty);
else if (this._type === 'snapshot') {
item.setAttachmentLastPageIndex(state.scrollYPercent);
}
let file = Zotero.Attachments.getStorageDirectory(item);
if (!await OS.File.exists(file.path)) {
@ -725,14 +724,15 @@ class ReaderInstance {
return { cfi };
}
}
// snapshot
else {
// let someProperty = item.getAttachmentSomeProperty();
// if (state) {
// state.someProperty = someProperty;
// return state;
// }
// return { someProperty };
else if (this._type === 'snapshot') {
let scrollYPercent = item.getAttachmentLastPageIndex();
if (state) {
state.scrollYPercent = scrollYPercent;
return state;
}
else {
return { scrollYPercent };
}
}
return null;
}

@ -1 +1 @@
Subproject commit 4d674215617933746c8d5b3fce2cc85b67e3006e
Subproject commit f73f0ef3fad04f70f525199eaa6a0eab3f8d67aa