Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pen Button Events #290

Closed
gked opened this issue Jun 25, 2019 · 8 comments
Closed

Pen Button Events #290

gked opened this issue Jun 25, 2019 · 8 comments

Comments

@gked
Copy link

gked commented Jun 25, 2019

Today, it is impossible for a web app to detect when an user presses the top button on a surface pen. Native apps like PowerPoint can register for pen button events to, for example, advance a slide show. Web PowerPoint should be able to do the same.

Is there any opposition to standardizing events such as "penbuttonclick", "penbuttondblclick", "penbuttonpressandhold" to enable such scenarios? Are there standards already being discussed that are applicable?

@NavidZ
Copy link
Member

NavidZ commented Jun 26, 2019

What is the code of that button? Is that specified in this set:
https://w3c.github.io/pointerevents/#the-button-property

I assumed it was the barrel button. Is it not?

@patrickhlauke
Copy link
Member

the button on the shaft/barrel is, unsurprisingly, the barrel button (if you press the button and THEN touch the digitizer, buttons registers as 2 - it appears though that it doesn't register for a hovering stylus, nor does it register if you've already started touching the screen with the stylus, with buttons registering 1 regardless of whether or not you're then pressing the barrel button).

turning the stylus and touching the screen registers as buttons value of 32 for the pen eraser.

now, what @gked is referring to, is that the eraser can also be pressed fully as a button (it requires far more pressure to click this than the simple eraser action). you'd typically do this with your thumb. and that currently doesn't seem to fire any pointer events and consequently doesn't register as any button.

now, in answer to the original question...i personally don't think this should be part of pointer events per se, mainly because (unless i've misunderstood its purpose or potential) that button doesn't actually work in conjunction with the position/coordinates of where the pen currently is. it's essentially a shortcut button that just happens to be on the stylus. so it feels more like it should be some UIEvent that it fires, rather than a pointer event per se?

@patrickhlauke
Copy link
Member

randomly, this made me finally dust off my old https://patrickhlauke.github.io/touch/tracker/multi-touch-tracker-pointer-hud.html demo to verify, so i'm hoping my results above weren't somehow tainted by my primitive coding on that ;)

@NavidZ
Copy link
Member

NavidZ commented Jun 26, 2019

I might still be a little confused what the problem is referring to. But this issue #134 might also be related. I feel like I might get the problem more during the call when we discuss this issue.

However as a side node, Assuming we go with eraser button route in #134, the way it seems it should work is that when you are hovering and pressing the eraser button it should send a pointerdown with eraser button and then if you touch the screen, should send a pointermove this time with button=left and buttons=eraser | left. I guess this is because we agreed that stylus touching the screen is the left button. This is under the assumption that we are getting the eraser button change while hovering on the platform. If we don't then when the stylus touches the screen while the eraser button is depressed we need to send a pointerdown but the question remains about button and what we should set it to. As essentially in this case we have both left (i.e. touching the screen) and eraser button changed at the same time from the UA perspective on a platform that doesn't support hover. The same scenario happens more or less for an inverted stylus.

Regardless, what I'm suggesting is to not based any decision on what Chromium does today. It might just be a bug or a scenario that we didn't think about it before. I know it might not very well thought and we have all these cases like the ones above that we just implemented something that sounded right but not yet fully decided and clear in the spec.

@patrickhlauke
Copy link
Member

the confusion probably due to the fact that the surface stylus' eraser has, effectively, dual functionality. when you gently touch it to the screen, it registers as a pointer with button value 2. but when you hold the stylus in the air and just gently touch the eraser, it doesn't register (believe this is hardware-based limitation). however, that same eraser when pressed hard with the thumb actually has a proper "switch/click" to it that some native apps can detect (e.g. to fire up OneNote). this is separate/different from the eraser functionality. and i would class it more as an extra button/shortcut key than anything else. not something directly related to the pointer itself.

@patrickhlauke
Copy link
Member

patrickhlauke commented Jun 26, 2019

If we don't then when the stylus touches the screen while the eraser button is depressed we need to send a pointerdown but the question remains about button and what we should set it to.

currently, when the eraser is touched to the screen, pointer events (pointerdown etc) are being generated, and the buttons indicates 32 [sorry, typo...originally wrote 2 but it IS 32 i just checked]

@gked
Copy link
Author

gked commented Jun 26, 2019

Yes, the scenario I am referring to is mainly about pressing the eraser button when the pen is not touching the screen nor it is hovering in the near proximity of the screen. I can definitely move this into UIEvents spec and let @garykac to weigh-in on this if it feels like just another input modality.

@gked
Copy link
Author

gked commented Jul 3, 2019

I created another issue on UI Events repo - w3c/uievents#237. Hence, closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants