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

Add touchpad pinch zooming support (2.1) #9117

Closed
wants to merge 1 commit into from

Conversation

pixelpicosean
Copy link
Contributor

Designed for touchpad users, make it possible to pinch zoom 2D canvas item editor.

A new button index constant is added to input event: GESTURE_MAGNIFY.

Designed for touchpad users, make it possible to pinch zoom 2D canvas item editor.

A new button index constant is added to input event: GESTURE_MAGNIFY.
@toger5
Copy link
Contributor

toger5 commented Jun 10, 2017

You introduced a nice pattern with using a negative value of the factor to use one case: GESTURE_MAGNIFY for magnifying in + magnifying out.
Maybe this concept could be also used for Mouse wheel?

BUTTON_MOUSE_WHEEL_HORIZONTAL
BUTTON_MOUSE_WHEEL_VERTICAL

Thoughts?

@@ -1035,6 +1035,29 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent &p_event) {

const InputEventMouseButton &b = p_event.mouse_button;

if (b.button_index == GESTURE_MAGNIFY) {

if (zoom < MIN_ZOOM) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The code form here on is really similar than:

b.button_index == BUTTON_WHEEL_DOWN
b.button_index == BUTTON_WHEEL_UP

would it be worth it to make a zoom inline function?
we could remove redundant code. and it would be easier to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep it's totally worth to make a zoom function and replace all the duplicated lines. And your idea about the button wheel events are great, which is also worth implement :D

Copy link
Contributor

Choose a reason for hiding this comment

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

It has to be documented really well though. It's not obvious that you have to use the factor property to find out if the user scrolls up or down.

Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think about renaming factor to: direction_value ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I will try to add gesture and wheel events again, hope to get it done this time. And direction_value is a good name.

@toger5
Copy link
Contributor

toger5 commented Jun 10, 2017

Same for the PR on master #9115

@akien-mga
Copy link
Member

I would still see implementations of the same feature for other platforms before I can think of merging this one - having such a feature only supported in one OS would not be very useful.

@akien-mga
Copy link
Member

Closing for the same reasons as #9115, see #1319 for follow-up discussions on this feature.

@akien-mga akien-mga closed this Aug 30, 2017
@pixelpicosean pixelpicosean deleted the pinch-zoom-2.1 branch November 21, 2017 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants