library and toc navigation
Python CI / test (push) Successful in 4m30s

This commit is contained in:
2025-11-08 12:20:23 +01:00
parent 60426432a0
commit 284a6e3393
13 changed files with 2365 additions and 219 deletions
+24 -2
View File
@@ -24,6 +24,7 @@ This project serves as both a reference implementation and a ready-to-use ereade
- ⬅️➡️ **Navigation** - Smooth forward and backward page navigation
- 🔖 **Bookmarks** - Save and restore reading positions with persistence
- 📑 **Chapter Navigation** - Jump to chapters by title or index via TOC
- 📋 **TOC Overlay** - Interactive table of contents overlay with gesture support
- 📊 **Progress Tracking** - Real-time reading progress percentage
### Text Interaction
@@ -86,11 +87,16 @@ Here are animated demonstrations of the key features:
</td>
</tr>
<tr>
<td align="center" colspan="2">
<td align="center">
<b>Text Highlighting</b><br>
<img src="docs/images/ereader_highlighting.gif" width="300" alt="Highlighting"><br>
<em>Highlight words and selections with custom colors and notes</em>
</td>
<td align="center">
<b>TOC Overlay</b><br>
<img src="docs/images/toc_overlay_demo.gif" width="300" alt="TOC Overlay"><br>
<em>Interactive table of contents with gesture-based navigation</em>
</td>
</tr>
</table>
@@ -149,6 +155,11 @@ reader.jump_to_chapter(0) # By index
reader.get_chapters() # List all chapters
reader.get_current_chapter_info()
reader.get_reading_progress() # Returns 0.0 to 1.0
# TOC Overlay
overlay_image = reader.open_toc_overlay() # Returns composited image with TOC
reader.close_overlay()
reader.is_overlay_open()
```
### Styling & Display
@@ -207,7 +218,7 @@ reader.get_highlights_for_current_page()
### Gesture Handling
```python
from pyWebLayout.io.gesture import TouchEvent, GestureType
from dreader.gesture import TouchEvent, GestureType, ActionType
# Handle touch input
event = TouchEvent(GestureType.TAP, x=400, y=300)
@@ -218,6 +229,17 @@ if response.action == ActionType.PAGE_TURN:
print(f"Page turned: {response.data['direction']}")
elif response.action == ActionType.WORD_SELECTED:
print(f"Word selected: {response.data['word']}")
elif response.action == ActionType.CHAPTER_SELECTED:
print(f"Chapter selected: {response.data['chapter_title']}")
# Supported gestures:
# - TAP: Select words, activate links, navigate TOC
# - LONG_PRESS: Show definitions or context menu
# - SWIPE_LEFT/RIGHT: Page navigation
# - SWIPE_UP: Open TOC overlay (from bottom 20% of screen)
# - SWIPE_DOWN: Close overlay
# - PINCH_IN/OUT: Font size adjustment
# - DRAG: Text selection
```
### File Operations