mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 07:07:38 +03:00
fixes pushes progress
This commit is contained in:
parent
77bb97339d
commit
a382341ac5
@ -94,12 +94,9 @@ CrossPointPosition ProgressMapper::toCrossPoint(const std::shared_ptr<Epub>& epu
|
||||
|
||||
std::string ProgressMapper::generateXPath(int spineIndex, int pageNumber, int totalPages) {
|
||||
// KOReader uses 1-based DocFragment indices
|
||||
// Estimate paragraph number based on page position
|
||||
// Assume ~3 paragraphs per page on average for e-reader screens
|
||||
constexpr int paragraphsPerPage = 3;
|
||||
const int estimatedParagraph = (pageNumber * paragraphsPerPage) + 1; // 1-based
|
||||
|
||||
return "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body/p[" + std::to_string(estimatedParagraph) + "]";
|
||||
// Use a simple xpath pointing to the DocFragment - KOReader will use the percentage for fine positioning
|
||||
// Avoid specifying paragraph numbers as they may not exist in the target document
|
||||
return "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body";
|
||||
}
|
||||
|
||||
int ProgressMapper::parseDocFragmentIndex(const std::string& xpath) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user