Skip to content

Comments

Improved html/epub apple pencil usage#1212

Draft
michalrentka wants to merge 2 commits intozotero:masterfrom
michalrentka:reader_improvements
Draft

Improved html/epub apple pencil usage#1212
michalrentka wants to merge 2 commits intozotero:masterfrom
michalrentka:reader_improvements

Conversation

@michalrentka
Copy link
Contributor

No description provided.

@michalrentka
Copy link
Contributor Author

@mvasilak since you have the new apple pencil, can you test it here? It should be close to PDF functionality now

@mvasilak
Copy link
Contributor

mvasilak commented Dec 4, 2025

@michalrentka when highlight/underline tool is active, both pencil and finger annotate as expected when the movement starts over text, while if the movement starts on the page, e.g. on the margins, both result in a navigation gesture.
When the tool is inactive, text selection works as expected with finger, but it is not always that smooth with pencil. Either it also starts a navigation gesture detection, or the selection shows after you have lifted the pencil. Double-tapping a word with a pencil though does work as expected, selecting the word and showing the selection changes while dragging.

@michalrentka
Copy link
Contributor Author

michalrentka commented Dec 5, 2025

@michalrentka when highlight/underline tool is active, both pencil and finger annotate as expected when the movement starts over text, while if the movement starts on the page, e.g. on the margins, both result in a navigation gesture. When the tool is inactive, text selection works as expected with finger, but it is not always that smooth with pencil. Either it also starts a navigation gesture detection, or the selection shows after you have lifted the pencil. Double-tapping a word with a pencil though does work as expected, selecting the word and showing the selection changes while dragging.

@AbeJellinek is this something you'd be able to fix?

@AbeJellinek
Copy link
Member

I think so... let me see if I can reproduce without an actual pencil.

@michalrentka
Copy link
Contributor Author

@mvasilak I updated the reader, can you re-check whether there are improvements?

@mvasilak
Copy link
Contributor

@michalrentka @AbeJellinek it seems to me now that selection with a finger is a bit worse, as there are cases that I start over text and I get navigation gesture detection. Pencil interactions seem the same to me.

Furthermore, changing setting UIPencilInteraction.prefersPencilOnlyDrawing value in setPenExclusive doesn't seem to affect the UX, I can still highlight/underline with a finger in both cases.

@AbeJellinek
Copy link
Member

selection with a finger is a bit worse, as there are cases that I start over text and I get navigation gesture detection

Are you able to come up with a set of steps/gestures to reliably reproduce this? I'm not seeing it in a simulator iPad. In fact, it shouldn't be possible to navigate via touch at all while there's a selection.

setPenExclusive doesn't seem to affect the UX, I can still highlight/underline with a finger in both cases.

Yeah, I wasn't completely sure how to handle this because it turns out we can't detect whether the pencil is connected, and nothing in this PR is calling setPenConnected(), which the current implementation needs. I seem to remember we discussed treating it as connected until some timeout period after the last pencil interaction (a half an hour?). @michalrentka, is that correct? If so, I can implement.

@michalrentka
Copy link
Contributor Author

michalrentka commented Feb 13, 2026

setPenExclusive doesn't seem to affect the UX, I can still highlight/underline with a finger in both cases.

Yeah, I wasn't completely sure how to handle this because it turns out we can't detect whether the pencil is connected, and nothing in this PR is calling setPenConnected(), which the current implementation needs. I seem to remember we discussed treating it as connected until some timeout period after the last pencil interaction (a half an hour?). @michalrentka, is that correct? If so, I can implement.

Sorry @AbeJellinek I missed this comment.

Yes, we can't really detect if the pencil dies / disconnects or is just out of range. I'd probably give it shorter timeout, like 5 - 10 minutes. So if a pencil touch happens while annotating, finger navigation is enabled. If the user doesn't touch the document with a pencil for ~5 minutes, annotations with fingers are enabled.

Or we can just do longer timeout and if the pencil dies, the user will have to disable and re-enable annotations to enable annotating with fingers, which might honestly be better, because if you're actually using the pencil, it'll probably be near the iPad and charged most of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants