mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-07 08:07:40 +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) {
|
std::string ProgressMapper::generateXPath(int spineIndex, int pageNumber, int totalPages) {
|
||||||
// KOReader uses 1-based DocFragment indices
|
// KOReader uses 1-based DocFragment indices
|
||||||
// Estimate paragraph number based on page position
|
// Use a simple xpath pointing to the DocFragment - KOReader will use the percentage for fine positioning
|
||||||
// Assume ~3 paragraphs per page on average for e-reader screens
|
// Avoid specifying paragraph numbers as they may not exist in the target document
|
||||||
constexpr int paragraphsPerPage = 3;
|
return "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body";
|
||||||
const int estimatedParagraph = (pageNumber * paragraphsPerPage) + 1; // 1-based
|
|
||||||
|
|
||||||
return "/body/DocFragment[" + std::to_string(spineIndex + 1) + "]/body/p[" + std::to_string(estimatedParagraph) + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProgressMapper::parseDocFragmentIndex(const std::string& xpath) {
|
int ProgressMapper::parseDocFragmentIndex(const std::string& xpath) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user