FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
19.74k stars 4.05k forks source link

[Sketcher] Regression: on entering Edit Mode with TouchPad Nav Style, holding Shift key and the slightest mouse movement makes the object jump in X positive, Y negative #16523

Closed Syres916 closed 1 month ago

Syres916 commented 1 month ago

Is there an existing issue for this?

Problem description

On starting FreeCAD, click on the PartDesignExample file to load it, select Face6 and in Sketcher click the New Sketch icon and confirm Plane Face and click OK. As a Touchpad Nav Style user, my default method for aligning the origin is to hold the left Shift key and move the mouse usually a small amount to align to the centre of the window.

Having completed a Git Bisect, ~this commit which seems quite bizarre~ is the cause of the significant jump of the origin to the most lower right corner of the window with the most minimal mouse movement. The latest AppImage doesn't have this behaviour but of course is packaged very differently to my self compiled build.

It seems to me that there doesn't appear to be any reason why the change couldn't have a # ifdef FC_OS_MACOSX condition applied to it, @shaise your input would be appreciated.

Full version info

OS: Linux Mint 22 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38739 (Git)
Build type: Release
Branch: main
Hash: f09dfa72d0f40568150d8f5ffb6223a416f0e6ab
Python 3.12.3, Qt 5.15.13, Coin 4.0.2, Vtk 9.1.0, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
Stylesheet/Theme/QtStyle: unset/unset/Qt default
Installed mods: 
  * FreeCAD-themes 2024.9.14
  * Silk 0.1.5
  * sheetmetal 0.4.24
  * Behave-Dark-Colors 0.1.1
  * CfdOF 1.27.5
  * freecad.gears 1.2.0
  * Curves 0.6.45

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

Syres916 commented 1 month ago

I'm going to carry out a second Git Bisect, see https://github.com/FreeCAD/FreeCAD/issues/16223#issuecomment-2350069333 as there seems to be some similarities to the strange behaviour.

maxwxyz commented 1 month ago

@Rexbas FYI

Syres916 commented 1 month ago

It's certainly an issue around camera focal distance etc, I can stop the issue by removing the viewer->setCameraOrientation(rot); from https://github.com/FreeCAD/FreeCAD/blob/main/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp#L3466-L3483 obviously I'm then left will working at whatever camera angle was before going into Edit Mode. If I put the code back as is in main then even using the View Fit All shortcut doesn't stop the misbehaviour.

From a debugging point of view I get a focal distance output of 87.0 and a dist of 102.969948

In 0.21 branch the same variables (working as expected) are: focal distance output of 94.684029 and a dist of 59.686089

@Rexbas I hope this feedback is of use.

OS: Linux Mint 22 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38740 (Git)
Build type: Release
Branch: main
Hash: b4923d1c584a4dce794d91a4b090a5293569223a
Python 3.12.3, Qt 5.15.13, Coin 4.0.2, Vtk 9.1.0, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
Stylesheet/Theme/QtStyle: Behave-dark.qss/Behave-dark/Qt default
Installed mods: 
  * FreeCAD-themes 2024.9.14
  * Silk 0.1.5
  * sheetmetal 0.4.24
  * Behave-Dark-Colors 0.1.1
  * CfdOF 1.27.5
  * freecad.gears 1.2.0
  * Curves 0.6.45
  * A2plus 0.4.67
OS: Linux Mint 22 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.2.33839 (Git)
Build type: Release
Branch: releases/FreeCAD-0-21
Hash: 1380323d8562578487d03091d3e2f572ac1d20ef
Python 3.12.3, Qt 5.15.13, Coin 4.0.2, Vtk 9.1.0, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * FreeCAD-themes 2024.9.14
  * Silk 0.1.5
  * sheetmetal 0.4.24
  * Behave-Dark-Colors 0.1.1
  * CfdOF 1.27.5
  * freecad.gears 1.2.0
  * Curves 0.6.45
  * A2plus 0.4.67
Rexbas commented 1 month ago

I cannot reproduce it

OS: Fedora Linux 40 (KDE Plasma) (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38740 (Git)
Build type: Release
Branch: main
Hash: b4923d1c584a4dce794d91a4b090a5293569223a
Python 3.11.0, Qt 5.15.8, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: OpenDark.qss/OpenDark/Qt default
Installed mods: 
  * OpenTheme 2024.9.1
  * OpticsWorkbench 1.0.21
Syres916 commented 1 month ago

I cannot reproduce it

Sorry to read that, I'll have a try at compiling Coin 4.0.3 tomorrow and if successful then compile FC against it to see whether there's any difference but I'm certainly not expecting any. Otherwise I'll be backporting lots of commits to my 0.21.x branch, it can't be a dependency because both are built on exactly the same libraries of the same system.

Syres916 commented 1 month ago

No different using Coin 4.0.3 compiled into a brand new folder specifically for this test:

OS: Linux Mint 22 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38740 (Git)
Build type: Release
Branch: main
Hash: b4923d1c584a4dce794d91a4b090a5293569223a
Python 3.12.3, Qt 5.15.13, Coin 4.0.3, Vtk 9.1.0, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
Stylesheet/Theme/QtStyle: Behave-dark.qss/Behave-dark/Qt default
Installed mods: 
  * FreeCAD-themes 2024.9.14
  * Silk 0.1.5
  * sheetmetal 0.4.24
  * Behave-Dark-Colors 0.1.1
  * CfdOF 1.27.5
  * freecad.gears 1.2.0
  * Curves 0.6.45
  * A2plus 0.4.67

I am investigating the quadrant that the mouse cursor is in after confirming Plane Face message box and clicking OK Under the old Start Wb the PartDesignExample appears in Sketch Edit Mode like:

021_PD_Example

whereas under the new Start module:

Dev_PD_Example

and to prove that the Overlay/Theme/Stylesheet is not the culprit, here's the same with completely clean configs:

Dev_PD_Example_Clean_Configs

why is the object/origin not more central like it used to be????

Rexbas commented 1 month ago

I can reproduce it now. It only happens when the mouse is in the 3D view and has not yet moved after entering edit mode. If I enter edit mode, then move my mouse, and then press shift, it doesn't happen. Also, it looks like the object is moving more when the mouse is closer to the center before entering editing mode.

luzpaz commented 1 month ago

Any fix in sight ?

Rexbas commented 1 month ago

I am working on it.

Rexbas commented 1 month ago

This regression was introduced in 22a98d81. I made a fix that waits for the second mouse movement after panning started so big jumps are prevented.