mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-26 02:58:32 -06:00
The form field editors and the Edit text paragraph editor are drawn over the pages, outside the page pointer, and close on a click away. With a finger, or a pen on Windows (winit reports it as touch), they closed on taps inside them: - A tap on a combo box opened its list and closed it in the same frame, so a choice could not be picked by touch. - A tap on a list box row picked it, but the list lost focus, so the arrow keys no longer moved the choice. - A tap on a date field's calendar arrows closed the field. - With a paragraph open in Edit text, a tap on a Format text control that only opens a list, such as Line spacing, applied and closed the paragraph, and the list went with it. Two things were wrong. The combo and list boxes judged the click by hover_pos, and the paragraph's "outside the document" by latest_pos. Both are None on the frame egui reports a tap, since egui-winit sends PointerGone with every touch release. They now read interact_pos, which keeps the tap's position on that frame (egui's own clicked_elsewhere does the same). And egui 0.36 reports a lost focus for two frames. The text field editor and the paragraph editor judged their exceptions again on the second frame, when a tap has no position left and a mouse may have moved on. They now judge a loss once, on its own frame (edit_text_ui::lost_focus_once, with a flag kept per editor). A focus taken later in a frame is still seen on the next one, as before. Tests: tests/it/editor_taps.rs taps with support::input::touch_tap, which sends the release and PointerGone in one frame as egui-winit does, and pairs each tap with a mouse click as the control. That click leaves the pointer in the window: kittest's drop_at sends PointerGone a frame later, which the second-frame judging also turned into a click away. With the source reverted, the four tap tests fail at their bug assertion and the controls pass. Reverting one part at a time fails only its own tests: hover_pos in the combo and list check, egui's lost_focus in the field editor (the calendar) or in the paragraph editor, and latest_pos for the paragraph's outside. A tap inside an open text field already worked and has a guard test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>