Cursor position affects zoom speed when zooming with Ctrl-MMB in 3D view #92221

Open
opened 2021-10-14 19:14:54 +02:00 by Martin · 6 comments

System Information
Operating system: macOS-11.5.2-x86_64-i386-64bit 64 Bits
Graphics card: Apple M1 Apple 4.1 Metal - 71.7.1

Blender Version
Broken: version: 2.93.5, branch: master, commit date: 2021-10-05 12:04, hash: a791bdabd0
Broken: version: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash: d0dd92834a08

Short description of error

When zooming 3D View by dragging with Ctrl-MMB (or Ctrl + trackpad scroll), the zoom speed depends on the cursor position.

The "Preferences" > "Navigation" > "Zoom to Mouse Position" is disabled by default.
Disabling the "Zoom to Mouse Position" option in the keymap makes the speed consistent.

Exact steps for others to reproduce the error

With the factory default preferences.

Place the cursor at the top of the 3D View, zoom by dragging up/down with Ctrl-MMB, the speed will be high.
Place the cursor at the bottom of the 3D View, zoom by dragging with Ctrl-MMB, speed is slow.

Change the Zoom Axis setting to Horizontal, now left/right mouse movement near the left edge of the 3D View produces low zooming, and near the right edge zoom speed is high.


original report

Short description of error
Zoom axis should just set the direction to move the mouse to zoom the view. It also seems to set the zoom speed of the trackpad pinch zoom based on where the cursor is in the 3D view (eg when set to vertical, zoom is faster at the top of the view). This does not affect mousewheel zooming or 2D views. It happens whether zoom to mouse position is on or off.

Disabling this option in the keymap makes the speed consistent, but unfortunately also breaks the "Zoom to Mouse Position" option in the navigation preferences:

Exact steps for others to reproduce the error
Set zoom axis to horizontal and try zooming with trackpad pinch with cursor on both the left or right side of 3D viewport.
Set zoom axis to vertical and try zooming with trackpad pinch with cursor on either the bottom or top of the 3D viewport.

Attached video is of trackpad pinch-zooming with default settings:

zooming.mp4
zoomingperspective480.mov

**System Information** Operating system: macOS-11.5.2-x86_64-i386-64bit 64 Bits Graphics card: Apple M1 Apple 4.1 Metal - 71.7.1 **Blender Version** Broken: version: 2.93.5, branch: master, commit date: 2021-10-05 12:04, hash: `a791bdabd0` Broken: version: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash: `d0dd92834a08` **Short description of error** When zooming 3D View by dragging with Ctrl-MMB (or Ctrl + trackpad scroll), the zoom speed depends on the cursor position. The "Preferences" > "Navigation" > "Zoom to Mouse Position" is **disabled** by default. Disabling the "Zoom to Mouse Position" option in the **keymap** makes the speed consistent. **Exact steps for others to reproduce the error** With the factory default preferences. Place the cursor at the top of the 3D View, zoom by dragging up/down with Ctrl-MMB, the speed will be high. Place the cursor at the bottom of the 3D View, zoom by dragging with Ctrl-MMB, speed is slow. Change the Zoom Axis setting to Horizontal, now left/right mouse movement near the left edge of the 3D View produces low zooming, and near the right edge zoom speed is high. *** <details> <summary>original report</summary> **Short description of error** Zoom axis should just set the direction to move the mouse to zoom the view. It also seems to set the zoom speed of the trackpad pinch zoom based on where the cursor is in the 3D view (eg when set to vertical, zoom is faster at the top of the view). This does not affect mousewheel zooming or 2D views. It happens whether zoom to mouse position is on or off. Disabling this option in the keymap makes the speed consistent, but unfortunately also breaks the "Zoom to Mouse Position" option in the navigation preferences: **Exact steps for others to reproduce the error** Set zoom axis to horizontal and try zooming with trackpad pinch with cursor on both the left or right side of 3D viewport. Set zoom axis to vertical and try zooming with trackpad pinch with cursor on either the bottom or top of the 3D viewport. </details> Attached video is of trackpad pinch-zooming with default settings: [zooming.mp4](https://archive.blender.org/developer/F11103469/zooming.mp4) [zoomingperspective480.mov](https://archive.blender.org/developer/F11105064/zoomingperspective480.mov)
Author

Disabling this option in the keymap makes the speed consistent, but unfortunately also breaks the "Zoom to Mouse Position" option in the navigation preferences:

Screen Shot 2021-10-14 at 2.04.10 PM.png

Disabling this option in the keymap makes the speed consistent, but unfortunately also breaks the "Zoom to Mouse Position" option in the navigation preferences: ![Screen Shot 2021-10-14 at 2.04.10 PM.png](https://archive.blender.org/developer/F11105572/Screen_Shot_2021-10-14_at_2.04.10_PM.png)
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:23:08 +01:00
Author

Just a note that this is still an issue despite fixes having been submitted.

Just a note that this is still an issue despite fixes having been submitted.
Yevgeny Makarov changed title from Zoom axis affects trackpad zoom speed to Cursor position affects zoom speed when zooming with Ctrl-MMB in 3D view 2024-02-07 13:02:44 +01:00

@PratikPB2123 - I've updated the report, it doesn't seem to be Mac specific, check again.

@PratikPB2123 - I've updated the report, it doesn't seem to be Mac specific, check again.
Member

@jenkm , indeed. Can confirm on Windows. Wrong zoom factor in negative axis?

@jenkm , indeed. Can confirm on Windows. Wrong zoom factor in negative axis?
Pratik Borhade removed the
Platform
macOS
label 2024-02-14 06:26:50 +01:00

@PratikPB2123 First, check how the flags are set. (No, that's not the point, never mind.)

For example, this looks correct:
static int viewzoom_exec() {
  const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
  const bool do_zoom_to_mouse_pos = (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));

but this one doesn't seem to be working right:

static void viewzoom_apply() {
  const bool zoom_to_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0;

this VIEWOPS_FLAG_ZOOM_TO_MOUSE flag is set depending on one option:

const bool use_zoom_to_mouse = (U.uiflag & USER_ZOOM_TO_MOUSEPOS) != 0;
if (use_zoom_to_mouse) {
  flag |= VIEWOPS_FLAG_ZOOM_TO_MOUSE;
}

but removed depending on another option:

bool use_cursor_init = false;
if (PropertyRNA *prop = RNA_struct_find_property(ptr, "use_cursor_init")) {
  use_cursor_init = RNA_property_boolean_get(ptr, prop);
}
if (!use_cursor_init) {
  viewops_flag &= ~(VIEWOPS_FLAG_DEPTH_NAVIGATE | VIEWOPS_FLAG_ZOOM_TO_MOUSE);
}

but "use_cursor_init" = true in our case, maybe that's where the problem lies.

@PratikPB2123 ~~First, check how the flags are set.~~ (No, that's not the point, never mind.) <details> For example, this looks correct: ```cpp static int viewzoom_exec() { const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init"); const bool do_zoom_to_mouse_pos = (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)); ``` but this one doesn't seem to be working right: ```cpp static void viewzoom_apply() { const bool zoom_to_pos = (vod->viewops_flag & VIEWOPS_FLAG_ZOOM_TO_MOUSE) != 0; ``` this `VIEWOPS_FLAG_ZOOM_TO_MOUSE` flag is set depending on one option: ```cpp const bool use_zoom_to_mouse = (U.uiflag & USER_ZOOM_TO_MOUSEPOS) != 0; if (use_zoom_to_mouse) { flag |= VIEWOPS_FLAG_ZOOM_TO_MOUSE; } ``` but removed depending on another option: ```cpp bool use_cursor_init = false; if (PropertyRNA *prop = RNA_struct_find_property(ptr, "use_cursor_init")) { use_cursor_init = RNA_property_boolean_get(ptr, prop); } if (!use_cursor_init) { viewops_flag &= ~(VIEWOPS_FLAG_DEPTH_NAVIGATE | VIEWOPS_FLAG_ZOOM_TO_MOUSE); } ``` but `"use_cursor_init"` = `true` in our case, maybe that's where the problem lies. </details>
Member

@jenkm , thanks for the investigation. I'll check the code during weekend (don't have time right now :/ )

@jenkm , thanks for the investigation. I'll check the code during weekend (don't have time right now :/ )
Sign in to join this conversation.
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
3 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#92221
No description provided.