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

Initial touch support #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nk-coding
Copy link

Adds initial touch support

  • TouchTool similar to MouseTool
  • Touch support for canvas scroll / zoom

Open questions

  • I did not yet add the IMouseListener as discussed in Mobile / touch support #462
    • If you want I can do so, however this would likely result in a breaking change, as I would need to change the signature of MouseTool
  • I added no decorate method to ITouchListener, as if the TouchTool would call it an a class both extends MouseListener and ITouchListener, it would be called twice
    • I could add it and only call it if the ITouchListener is not a MouseListener, however this sounds hacky
  • I slightly changed the signature of some of the methods of ScrollMouseListener (e.g. moveScrollBar) to also accept a Touch as the event (as this provides the touch coordinates similar to the MouseEvent
    • technically, this is a breaking change
    • alternative options: implement touch scroll in separete class (and duplicate some code)
    • add new internal methods to ScrollMouseListener which basically are the current ones with the new signature, and make the current one call these new ones
  • Currently, there is no touch support for moving elements
    • thus, currently the canvas scroll works even when touching a movable element
    • I can add support for moving elements, however I'm not sure if this is even desired
    • the point above (minor breaking changes vs duplicate code or internal wrapper method) applies here too

Closes #462

Signed-off-by: Niklas Krieger <[email protected]>
@nk-coding nk-coding marked this pull request as ready for review December 14, 2024 18:11
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great contribution, thanks a lot!

There are a few linter errors, please have a look.

I think it's ok to handle the interface extraction from MouseListener separately. Could you create a new issue for that and described the necessary steps to clean up the code?

One thing I noticed on my MacBook is that the pinch gesture for zooming feels a bit slow.

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

Successfully merging this pull request may close these issues.

Mobile / touch support
2 participants