improved demo

This commit is contained in:
Duncan Tourolle 2025-11-08 18:53:26 +01:00
parent 1993b0bf48
commit 531d02735c
2 changed files with 44 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -361,6 +361,49 @@ def main():
else:
print(" Skipping - button not found")
# Get current overlay state for word spacing section
current_overlay3 = reader.get_current_page()
# Frame W: Tap on word spacing increase button
print("Frame W: Tap on word spacing increase...")
if 'setting:word_spacing_increase' in link_positions:
tap_x4, tap_y4 = link_positions['setting:word_spacing_increase']
print(f" Using coordinates: ({tap_x4}, {tap_y4})")
tap_visual4 = add_tap_indicator(current_overlay3, tap_x4, tap_y4, "Increase")
annotated_ws_tap = add_gesture_annotation(tap_visual4, "Tap to increase word spacing", "bottom")
frames.append(annotated_ws_tap)
frame_duration.append(1500) # 1.5 seconds
# Frames W+1 to W+5: Word spacing increased (live preview) - show each tap individually
print("Frames W+1 to W+5: Word spacing increased with live preview (5 taps, showing each)...")
for i in range(5):
event_tap_word = TouchEvent(gesture=GestureType.TAP, x=tap_x4, y=tap_y4)
response = reader.handle_touch(event_tap_word)
print(f" Tap {i+1}: {response.action} - Word spacing: {response.data.get('word_spacing', 'N/A')}")
# Get updated overlay image after each tap
updated_overlay4 = reader.get_current_page()
annotated = add_gesture_annotation(
updated_overlay4,
f"Word Spacing: {reader.page_style.word_spacing}px (tap {i+1}/5)",
"top"
)
frames.append(annotated)
frame_duration.append(800) # 0.8 seconds per tap
# Hold on final word spacing for a bit longer
final_word_overlay = reader.get_current_page()
annotated_final_ws = add_gesture_annotation(
final_word_overlay,
f"Word Spacing: {reader.page_style.word_spacing}px (complete)",
"top"
)
frames.append(annotated_final_ws)
frame_duration.append(1500) # 1.5 seconds to see the final result
else:
print(" Skipping - button not found")
# Frame Z: Tap outside to close
print("Frame Z: Close overlay...")
final_overlay_state = reader.get_current_page()
@ -378,7 +421,7 @@ def main():
final_page = reader.get_current_page()
annotated_final = add_gesture_annotation(
final_page,
f"Settings Applied: {int(reader.base_font_scale * 100)}% font, {reader.page_style.line_spacing}px line, {reader.page_style.inter_block_spacing}px para",
f"Settings Applied: {int(reader.base_font_scale * 100)}% font, {reader.page_style.line_spacing}px line, {reader.page_style.inter_block_spacing}px para, {reader.page_style.word_spacing}px word",
"top"
)
frames.append(annotated_final)