Pen on graphical tablet not works correct in the new pdf-tool
Categories
(Firefox :: PDF Viewer, defect, P3)
Tracking
()
People
(Reporter: Hartmut.Mehnert, Assigned: calixte)
References
(Depends on 1 open bug)
Details
Attachments
(1 file)
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0
Steps to reproduce:
Enter a signature in a PDF document using a graphics tablet and the associated pen.
Actual results:
Unfortunately, my pen does not work properly with the graphics tablet when writing. If i writing, the document moves vertically and horizontally on the screen when the scrollbars are visible. Because of this, I can't write the way I want. This problem does not occur with the mouse and the left button pressed, the document does not move while writing.
In other programs and also PDF tools, I can draw and write perfectly with my tablet and the associated pen.
My tablet: Medion P82018 (MD86635)
My system: win 10 pro x64 22H2 19045.2486 with latest updates
Expected results:
The document must not move while writing with the pen.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::PDF Viewer' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Hy, thank you for the bug report!
I managed to reproduce this issue on Windows 10 x64 on:
- Firefox 109.0;
- Firefox 110.0b5;
- Nightly 111.0a1;
Scrollbar interferes with the Draw function whilst using a tablet. I used a XP PEN Artist 12. Could not reproduce on Ubuntu. Could not test on macOS due to the incompatibility of the tablet with the device.
Setting as NEW so that the developers can have a look.
For more details, please see this recording.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
The severity field is not set for this bug.
:calixte, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
I got a XP-PEN G640S V2
and I managed to reproduce the issue under Windows 11 and Windows 10.
It works as expected on mac 13.1 and on Fedora.
My feeling is that event propagation is not stopped and then the pointer event finally triggers a scroll.
The code we use to draw is:
https://github.com/mozilla/pdf.js/blob/master/src/display/editor/ink.js#L535-L563
:botond, could you have a look on this issue, please ?
Comment 5•2 years ago
|
||
stopPropagation()
will prevent other JS listeners (e.g. on ancestor elemens) from processing the event, but default browser behaviours will still happen. If the pen is producing touch events, the scrolling might be occurring as the default behaviour of the touch events.
Does calling preventDefault()
in addition to stopPropagation()
help?
Assignee | ||
Comment 6•2 years ago
|
||
It doesn't change anything.
It works correctly on Windows 11 when drawing on a touch screen.
Initially, I developed the pointer stuff in testing with a touch screen and I had to add:
https://github.com/mozilla/pdf.js/blob/534b22aec5eaa88d796a17b9732d82f3fcd25b3a/web/annotation_editor_layer_builder.css#L164
in order to something working correctly.
I just tested on the touch screen in removing the touch-action: none
and there is scrolling then I added some preventDefault
and the scrolling is still there. So the only way to prevent scrolling on the touch screen is to have touch-action: none
.
As far as I know there are no pen-action
in css.
I tested in Chrome with a pen (with a local server for serving pdf.js) and it works correctly. But if I remove touch-action: none
from the css it doesn't anymore even with preventDefault
.
Comment 7•2 years ago
|
||
(In reply to Calixte Denizet (:calixte) from comment #6)
I just tested on the touch screen in removing the
touch-action: none
and there is scrolling then I added somepreventDefault
and the scrolling is still there. So the only way to prevent scrolling on the touch screen is to havetouch-action: none
.
I realized what the reason for this might be: event listeners need to be passive: false
in order for preventDefault()
to be respected.
But that can't be the whole story here: touch-action: none
is considered to be a better way than a passive: false
event listener that calls preventDefault()
, for preventing scrolling caused by touch events. The fact that the canvas already uses touch-action: none
, and yet you are seeing scrolling, suggests that the pen is triggering something other than touch events.
Kagami, are you familiar with how pen input works? In particular, do you know what kind of events it generates at the platform level (i.e. Widget***Event
), and by what mechanism it causes scrolling?
Does setting dom.w3c_touch_events.enabled=1
fix your issue? If then it's bug 1755435.
Assignee | ||
Comment 9•2 years ago
|
||
Yes, it does fix the issue.
Thanks for the confirmation. The solution should be what's described in https://bugzilla.mozilla.org/show_bug.cgi?id=1755435#c11, but for now I have no such non-touch-but-only-pen Windows environment. It'll be very helpful if anyone with such device can take it, but if not I'll try at some point.
Assignee | ||
Comment 11•2 years ago
|
||
I just tested with this patch:
diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -1477,7 +1477,8 @@ nsresult WinUtils::WriteBitmap(nsIFile*
uint32_t WinUtils::IsTouchDeviceSupportPresent() {
int32_t touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
return (touchCapabilities & NID_READY) &&
- (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH));
+ (touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH |
+ NID_EXTERNAL_PEN | NID_INTEGRATED_PEN));
}
and it works as expected.
🎉🚀
Assignee | ||
Comment 13•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Comment 14•2 years ago
|
||
:saschanaz, I used this bug rather than bug 1755435, because if the patch fixes the issue described here, then it doesn't for the other one.
Comment 15•2 years ago
|
||
Comment 16•2 years ago
|
||
bugherder |
Comment 17•2 years ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit auto_nag documentation.
Comment 18•2 years ago
|
||
The patch landed in nightly and beta is affected.
:calixte, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox112
towontfix
.
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Assignee | ||
Comment 19•2 years ago
|
||
From a pdf.js point of view I'd be in favor of uplifting the patch in beta.
:saschanaz, what do you think ?
I'm all for it 👍
Assignee | ||
Comment 21•2 years ago
|
||
Comment on attachment 9324653 [details]
Bug 1811303 - Make a pen usable to draw on a pdf on Windows r=saschanaz
Beta/Release Uplift Approval Request
- User impact if declined: Windows users won't be able to draw on a pdf in using a pen.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: See https://bugzilla.mozilla.org/show_bug.cgi?id=1811303#c0
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Small change and limited to users using a pen.
- String changes made/needed:
- Is Android affected?: No
Assignee | ||
Updated•2 years ago
|
Windows users won't be able to draw on a pdf in using a pen.
(Only if their devices have no touchscreen, e.g. when using a digitizer tablet on a plain laptop. Touch-enabled devices are fine without it.)
Comment 23•2 years ago
|
||
Comment on attachment 9324653 [details]
Bug 1811303 - Make a pen usable to draw on a pdf on Windows r=saschanaz
Approved for 112.0b7
Comment 24•2 years ago
|
||
bugherder uplift |
Updated•2 years ago
|
Reproducible on a 2023-03-20 Nightly build on Windows 10 using XP-PEN Artist 12 graphical tablet.
Verified as fixed on Firefox 102.0b7(build ID: 20230326180212) and Nightly 113.0a1(build ID: 20230326214700) on Windows 10 and Windows 11.
Drawing with a pen and tablet using the 'Draw' function works properly now.
Description
•