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

Implement InputEventGesture (incl. Pan and Magnify) for all platforms #13139

Open
1 of 8 tasks
akien-mga opened this issue Nov 21, 2017 · 27 comments · May be fixed by #39055
Open
1 of 8 tasks

Implement InputEventGesture (incl. Pan and Magnify) for all platforms #13139

akien-mga opened this issue Nov 21, 2017 · 27 comments · May be fixed by #39055

Comments

@akien-mga
Copy link
Member

akien-mga commented Nov 21, 2017

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Current master (5a23136).

Issue description:
InputEventGesture was added to core in #12573, together with InputEventPanGesture and InputEventMagnifyGesture, but they're only implemented for macOS so far.

They should also be implemented for all platforms where they are relevant. I guess they would make sense on all platforms since gestures can be done on touchscreens as well as touchpads, so the list would be:

See #12573 for the base API and its implementation on macOS.

If more types of gestures are wanted, they should likely be discussed in their own issue, let's keep this one focused on pan and magnify.

@raymoo
Copy link
Contributor

raymoo commented Nov 21, 2017

Poor BSD, it doesn't even get its own checkbox.

@akien-mga
Copy link
Member Author

Poor BSD, it doesn't even get its own checkbox.

Poor Linux, it has to share its checkbox.. All X11 platforms share the same code, so they can share the same checkbox.

@nathanfranke
Copy link
Contributor

#25474 Merged, check Android box?

@Calinou
Copy link
Member

Calinou commented Nov 21, 2019

@nathanwfranke Done.

@akien-mga
Copy link
Member Author

#25474 Merged, check Android box?

And reverted.

@Federico-Ciuffardi
Copy link

Hi, I made a gdscript (Github, Asset Library) that kind of solves this issue. I wanted to know if it's possible to integrate this gdscript to the engine.

@nathanfranke
Copy link
Contributor

Hi, I made a gdscript (Github, Asset Library) that kind of solves this issue. I wanted to know if it's possible to integrate this gdscript to the engine.

You can't integrate GDScript into the engine per se, you would have to translate the code to be the same format and workflow. However, since you were able to make the library you should be able to learn the engine without much issues.

@Federico-Ciuffardi
Copy link

I made some progress on translating my code to the engine (Federico-Ciuffardi@296fbc8), but I'm having issues to convert my library's InputEventPinch to the InputEventMagnifyGesture as the InputEventMagnifyGesture has less attributes (factor and position) than my InputEventPinch (distance, relative, position, speed).

I don't know if here is the correct place to ask this but how would be the best way to solve this?

@nathanfranke
Copy link
Contributor

@Federico-Ciuffardi For whatever implementations are implemented already for iOS, those should be deleted in my opinion. Feel free to add/remove those fields as you want since Godot 4.0 is already broken for compatibility

@Federico-Ciuffardi
Copy link

Ok!

Another question, what is the pan gesture exactly?

@nathanfranke
Copy link
Contributor

I believe it is general for the drags. So like if I drag 1 finger or 20 fingers to the left that would be a pan to the left. Basically you should be able to hook them all up to a Camera2D and it would be completely functional.

@Federico-Ciuffardi
Copy link

It's ok if I implement the InputEvents from my library :

  • InputEventPinchGesture instead of InputEventMagnifyGesture.
  • InputEventMultiScreenDrag (or maybe InputEventScreenMultiDrag) instead of InputEventPanGesture.
  • And even add a InputEventTwistGesture.
    I think this could be better since it allows me to make a more direct translation. And also I think the names make more sense (not all pinch gestures have to magnify for example).

@nathanfranke
Copy link
Contributor

Instead of MultiScreenDrag do pan. That way if they drag with 2 fingers that would be a pan and it wouldn't be 2x faster

@Federico-Ciuffardi
Copy link

Federico-Ciuffardi commented Mar 9, 2020

My implementation of MultiScreenDrag does not cause that, so the pan gesture would be the same as combining ScreenDrag when it's just a finger and otherwise MultiScreenDrag (I do that when I use my library).

@Federico-Ciuffardi
Copy link

Federico-Ciuffardi commented Mar 9, 2020

I implemented:

  • InputEventPinchGesture
  • InputEventMultiScreenDrag
  • InputEventTwistGesture

https://github.com/Federico-Ciuffardi/godot/tree/3.2-GDTIM

I tested this on a project that used the library modified to work without the library (using the new built-in InputEvents):
https://github.com/Federico-Ciuffardi/GestureControlledCamera2D/tree/built-in
And it is working!

I don't know how to proceed to make a pull request I would need some help with that 😞

@nathanfranke
Copy link
Contributor

@Federico-Ciuffardi first, backup everything you have done on the engine a few times. It would be terrible to lose your progress. Next I would recommend following this tutorial to help you get started with git (using a tool called GitKraken)

@Federico-Ciuffardi
Copy link

So I just branch out form the current master branch make the changes there, and do the PR for this branch? I do not need prior approval?

@akien-mga akien-mga modified the milestones: 4.0, 4.x Feb 22, 2023
@Riteo
Copy link
Contributor

Riteo commented Oct 27, 2023

Uh I didn't notice that this tracker included Wayland!

For the record, the Wayland PR (#57025) supports both InputPanGesture and InputMagnifyGesture ;)

@Nolkaloid
Copy link
Contributor

I'm considering implementing this for X11 using the XInput extension (see https://gitlab.freedesktop.org/xorg/lib/libxi/-/merge_requests/5). Is it worth the shot given the existence of #39055 ?

@eobet
Copy link
Contributor

eobet commented Jun 29, 2024

For the record, the Wayland PR (#57025) supports both InputPanGesture and InputMagnifyGesture ;)

It says that #86180 is merged, but in 4.3 beta 2 I'm still seeing the problematic behavior from #73371. Why is that?

@Riteo
Copy link
Contributor

Riteo commented Jun 30, 2024

@eobet are you running the editor with prefer_wayland enabled in the editor settings?

@eobet
Copy link
Contributor

eobet commented Jun 30, 2024

@eobet are you running the editor with prefer_wayland enabled in the editor settings?

Ah, right! Thank you I wasn't aware of it. Boy that made a difference in font rendering! But now I think I'm experiencing #49873 instead... 😅

@Riteo
Copy link
Contributor

Riteo commented Jun 30, 2024

Ah, right! Thank you I wasn't aware of it. Boy that made a difference in font rendering!

Awesome! You're welcome :D

But now I think I'm experiencing #49873 instead... 😅

Yeah that's a generic issue unfortunately AFAIK. The relative UI controls ought to be fixed directly.

@eobet
Copy link
Contributor

eobet commented Jun 30, 2024

Yeah that's a generic issue unfortunately AFAIK. The relative UI controls ought to be fixed directly.

That's unfortunate but thanks for the info. One thing I did notice, though is that middle mouse button panning in the shader editor is not 1:1 using "prefer wayland". Are you aware of such an issue?

@Riteo
Copy link
Contributor

Riteo commented Jun 30, 2024

Are you aware of such an issue?

No, feel free to open up another ticket :D

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