|
@@ -127,7 +127,6 @@ export const useEpubStore = defineStore("epub", () => {
|
|
|
};
|
|
|
|
|
|
const clear = () => {
|
|
|
- console.log(rendition.value);
|
|
|
rendition.value?.clear();
|
|
|
rendition.value = null;
|
|
|
book.value = null;
|
|
@@ -168,10 +167,10 @@ export const useEpubStore = defineStore("epub", () => {
|
|
|
|
|
|
const refreshLocation = async () => {
|
|
|
const curLocation = rendition.value.currentLocation();
|
|
|
- const startCfi = curLocation.start.cfi;
|
|
|
+ const startCfi = curLocation.end.cfi;
|
|
|
const scrollLeft =
|
|
|
document.getElementsByClassName("epub-container")[0]?.scrollLeft;
|
|
|
- const page = Math.round(scrollLeft / rendition.value._layout.pageWidth);
|
|
|
+ const page = Math.floor(scrollLeft / rendition.value._layout.pageWidth);
|
|
|
|
|
|
localStorage.setItem(
|
|
|
`${EPUB_LOCATION}-${fileName.value}`,
|
|
@@ -231,9 +230,9 @@ export const useEpubStore = defineStore("epub", () => {
|
|
|
|
|
|
if (page) {
|
|
|
nextTick(() => {
|
|
|
- document.getElementsByClassName("epub-container")[0]?.scrollTo({
|
|
|
- left: Number(page) * rendition.value._layout.pageWidth,
|
|
|
- });
|
|
|
+ // document.getElementsByClassName("epub-container")[0]?.scrollTo({
|
|
|
+ // left: Number(page) * rendition.value._layout.pageWidth,
|
|
|
+ // });
|
|
|
!ghost && refreshLocation();
|
|
|
});
|
|
|
} else {
|