Fix #117185: Zooming out is slow on Windows precision touchpad #117341

Open
Andrii wants to merge 1 commits from pembem22/blender:precision-touchpad-zoom-out-speed into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

Map the scale value, so the resulting change value would be equal in both direction. This is required for consistent zoom speed when zooming out relative to the starting position.

For example, zooming in from 1.0 to 2.0 results in 2.0 change value, and zooming out from 1.0 to 0.5 now results in an opposite -2.0 change value.

Tested on Windows, don't know if this issue exists on macOS.

Map the scale value, so the resulting change value would be equal in both direction. This is required for consistent zoom speed when zooming out relative to the starting position. For example, zooming in from 1.0 to 2.0 results in 2.0 change value, and zooming out from 1.0 to 0.5 now results in an opposite -2.0 change value. Tested on Windows, don't know if this issue exists on macOS.
Andrii requested review from Nicholas Rishel 2024-01-19 17:14:01 +01:00
Nicholas Rishel force-pushed precision-touchpad-zoom-out-speed from 1bbce9a6ea to 83457b33c4 2024-01-20 08:07:16 +01:00 Compare

@blender-bot build windows

@blender-bot build windows

Ack, wrong command.
@blender-bot package windows

Ack, wrong command. @blender-bot package windows
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR117341) when ready.

Manually testing this seems to have reversed the problem, zooming out moves more than zooming in?

Manually testing this seems to have reversed the problem, zooming out moves more than zooming in?
Author
First-time contributor

Zooming in to a certain amount, then lifting fingers to reset the gesture and zooming out by repeating the first gesture in reverse now brings zoom level to the starting position, which is not the case without this PR.

What you experience is probably the fact, that you can zoom out more using one gesture than zooming in. If I print the scale value reported by Windows, the minimum and maximum values I can get using one gesture are 0.1 and 7.0, which corresponds to 10x zoom out and 7x zoom in.

Zooming in to a certain amount, then lifting fingers to reset the gesture and zooming out by repeating the first gesture in reverse now brings zoom level to the starting position, which is not the case without this PR. What you experience is probably the fact, that you can zoom out more using one gesture than zooming in. If I print the scale value reported by Windows, the minimum and maximum values I can get using one gesture are 0.1 and 7.0, which corresponds to 10x zoom out and 7x zoom in.
First-time contributor

Hello!
I can confirm that on my end #117185 does not happen anymore.
Thanks a lot for this!

Hello! I can confirm that on my end [#117185](https://projects.blender.org/blender/blender/issues/117185#issuecomment-1108789) does not happen anymore. Thanks a lot for this!

The correct solution is to use the pinch/zoom factor directly instead of converting it to pan and then back to zoom factor in the operator. You can find my old patch for this here: #110852.

Also note that there are a lot of issues in the way operators themselves work with trackpad events.

I don't remember all the details anymore, but it's all here: #82006.

The correct solution is to use the pinch/zoom factor directly instead of converting it to pan and then back to zoom factor in the operator. You can find my old patch for this here: https://projects.blender.org/blender/blender/issues/110852. Also note that there are a lot of issues in the way operators themselves work with trackpad events. I don't remember all the details anymore, but it's all here: https://projects.blender.org/blender/blender/issues/82006.

What you experience is probably the fact, that you can zoom out more using one gesture than zooming in. If I print the scale value reported by Windows, the minimum and maximum values I can get using one gesture are 0.1 and 7.0, which corresponds to 10x zoom out and 7x zoom in.

0.1 probably being DIRECTMANIPULATION_MINIMUM_ZOOM, but I wonder why 7.0 as the max? I can verify the same preference toward zooming out in Firefox too.

Maddeningly 1.0/(DIRECTMANIPULATION_MINIMUM_ZOOM * sqrt(2)) would give us a number close to 7.0 scale factor, sqrt(2) coming from sqrt(x^2 + y^2) where x=y (because Direct Manipulation populates x and y scale values as the same). My rusty understanding of linear algebra is that 1/x and 1/y should be the correct way to invert scale but maybe Windows is populating the transformation matrix incorrectly (or I'm not reasoning through this correctly?).

@jenkm Not sure what you're referring to, we're using the touchpad matrix's scale field directly in Windows.

> What you experience is probably the fact, that you can zoom out more using one gesture than zooming in. If I print the scale value reported by Windows, the minimum and maximum values I can get using one gesture are 0.1 and 7.0, which corresponds to 10x zoom out and 7x zoom in. 0.1 probably being [`DIRECTMANIPULATION_MINIMUM_ZOOM`](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/directmanipulation/direct-manipulation-constants), but I wonder why 7.0 as the max? I can verify the same preference toward zooming out in Firefox too. Maddeningly 1.0/(`DIRECTMANIPULATION_MINIMUM_ZOOM` * sqrt(2)) would give us a number close to 7.0 scale factor, sqrt(2) coming from sqrt(x^2 + y^2) where x=y (because Direct Manipulation populates x and y scale values as the same). My rusty understanding of linear algebra is that 1/x and 1/y should be the correct way to invert scale but maybe Windows is populating the transformation matrix incorrectly (or I'm not reasoning through this correctly?). @jenkm Not sure what you're referring to, we're using the touchpad matrix's scale field directly in Windows.

Not sure what you're referring to, we're using the touchpad matrix's scale field directly in Windows.

In the GHOST you have dx/dy scrolling value and the zoom factor. But in WM, only dx/dy. So the scale factor is converted to scrolling delta. And then in the operators back to some scale factor.

I just wanted to say that on Mac also zooming is slow and bad and the problem is where I pointed out. I mean, it's a broader issue.

> Not sure what you're referring to, we're using the touchpad matrix's scale field directly in Windows. In the GHOST you have dx/dy scrolling value and the zoom factor. But in WM, only dx/dy. So the scale factor is converted to scrolling delta. And then in the operators back to some scale factor. I just wanted to say that on Mac also zooming is slow and bad and the problem is where I pointed out. I mean, it's a broader issue.
Member

I just wanted to say that on Mac also zooming is slow and bad and the problem is where I pointed out. I mean, it's a broader issue.

Something to fix in interface_handler or view3d_xxx_zoom files then?

> I just wanted to say that on Mac also zooming is slow and bad and the problem is where I pointed out. I mean, it's a broader issue. Something to fix in `interface_handler` or `view3d_xxx_zoom` files then?

Something to fix in interface_handler or view3d_xxx_zoom files then?

Yes, you need to fix the operators first, and then tweak what you're doing here. You send some scale-factor value from GHOST but it is not used correctly afterwards.

And again, all the patches are already there, links in the comment above.

> Something to fix in `interface_handler` or `view3d_xxx_zoom` files then? Yes, you need to fix the operators first, and then tweak what you're doing here. You send some scale-factor value from GHOST but it is not used correctly afterwards. And again, all the patches are already there, links in the comment above.

const float scale = transform[0]; — this is the scale factor you need in zoom operators.

This PINCH_SCALE_FACTOR is some random number and is not used in operators for back conversion.

Don't forget to compare zoom on a hiDPI and lowDPI monitor (in the current implementation it could be different).

And of course I hope you test zoom in all editors, 3D view, Image/Clip, Node editor, UI panels zooming.


Oh, and don't forget that trackpad-zooming is basically broken — #111141

`const float scale = transform[0];` — this is the scale factor you need in zoom operators. This `PINCH_SCALE_FACTOR` is some random number and is not used in operators for back conversion. Don't forget to compare zoom on a hiDPI and lowDPI monitor (in the current implementation it could be different). And of course I hope you test zoom in all editors, 3D view, Image/Clip, Node editor, UI panels zooming. *** Oh, and don't forget that trackpad-zooming is basically broken — https://projects.blender.org/blender/blender/pulls/111141
First-time contributor

Hi! Not the author here, but I was wondering if this commit can be merged in main or are further fixed needed?

Hi! Not the author here, but I was wondering if this commit can be merged in main or are further fixed needed?
Member

@scopelma hi, some changes are still required in operator's code (@jenkm pointed them already in previous comments)

@scopelma hi, some changes are still required in operator's code (@jenkm pointed them already in previous comments)
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u precision-touchpad-zoom-out-speed:pembem22-precision-touchpad-zoom-out-speed
git checkout pembem22-precision-touchpad-zoom-out-speed
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117341
No description provided.