Gesture navigation style updates (may 2019)

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
User avatar
DeepSOIC
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Gesture navigation style updates (may 2019)

Postby DeepSOIC » Tue May 14, 2019 6:35 pm

since 0.19.16748

I have rewritten the navigation style, in order to fix slight model rotation when pinch-zooming and two-finger panning, that was driving me bananaz. In the process, I introduced a few changes.

* tap-and-hold then drag to pan now works with mouse and touchpad. Should work on all platforms.

* new mouse-only gestures:
** click LMB while holding RMB to invoke "Back" gesture.
** click RMB while holding LMB to invoke "Forward" gesture.
These gestures were modeled after Opera browser.
By default, nothing is bound to these gestures. As of now, the only way to bind commands to these gestures is with parameter editor. Or with Py console. Here is a snippet to bind these gestures to undo and redo:

Code: Select all

App.ParamGet("User parameter:BaseApp/Preferences/View").SetString("GestureRollFwdCommand", "Std_Redo")
App.ParamGet("User parameter:BaseApp/Preferences/View").SetString("GestureRollBackCommand", "Std_Undo")
Unfortunately, I don't have time now to make GUI for adjusting these.

Additional hidden parameters:

Code: Select all

# set sensitivity to cursor motion (distance in px). This is the distance to drag for rotation/panning to begin.
App.ParamGet("User parameter:BaseApp/Preferences/View").SetInt("GestureMoveThreshold", 5)

# set tap-and-hold detection time (in milliseconds). Set it to something stupid high to effectively disable tap-and-hold.
# Really only affects mouse/touchpad. 
# On windows+touchscreen, set this equal (or smaller) to system setting; setting higher than system time causes erratic behavior.
App.ParamGet("User parameter:BaseApp/Preferences/View").GetInt("GestureTapHoldTimeout", 700)
Please let me know if you have any troubles with the new style. There may be regressions.

I have only tested it on Windosws. I would always welcome input on how it behaves on other platforms. I don't expect any problems with mouse part, but with touchscreen, problems are very likely.
chrisb
Posts: 18914
Joined: Tue Mar 17, 2015 9:14 am

Re: Gesture navigation style updates (may 2019)

Postby chrisb » Tue May 21, 2019 5:56 pm

On the Mac the zooming with the track pad shows the following unpleasant behaviour:
- create a cube in Part WB,
Bildschirmfoto 2019-05-21 um 19.48.38.png
Bildschirmfoto 2019-05-21 um 19.48.38.png (28.46 KiB) Viewed 906 times
- zoom fit
- place mouse in the middle of 3D window
- zoom out -> Zooming works perfect while holding the fingers on the trackpad
- when taking fingers off, the cube jumps to the lower right corner of 3D window.
Bildschirmfoto 2019-05-21 um 19.48.54.png
Bildschirmfoto 2019-05-21 um 19.48.54.png (24.6 KiB) Viewed 906 times
OS: macOS 10.13
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16790 (Git)
Build type: Release
Branch: master
Hash: 15f440525e59c3caf89f847a490981abf5a45f8f
Python version: 3.7.3
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
User avatar
DeepSOIC
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Gesture navigation style updates (may 2019)

Postby DeepSOIC » Tue May 21, 2019 6:35 pm

chrisb wrote:
Tue May 21, 2019 5:56 pm
- when taking fingers off, the cube jumps to the lower right corner of 3D window.
Can you build FreeCAD? If yes, I would kindly ask you to revert git commit 24e45023aa0410ac2ea6566f408b7cef53811cc5, build it, do zooming, and post content of report view here.
chrisb
Posts: 18914
Joined: Tue Mar 17, 2015 9:14 am

Re: Gesture navigation style updates (may 2019)

Postby chrisb » Tue May 21, 2019 6:54 pm

I'm sorry, I have not setup a compiling environment. Anything else I can do?
User avatar
DeepSOIC
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Gesture navigation style updates (may 2019)

Postby DeepSOIC » Tue May 21, 2019 7:04 pm

chrisb wrote:
Tue May 21, 2019 6:54 pm
Anything else I can do?
I guess, not yet. I wanted to leave the logging to be enabled by a setting in parameters, but I couldn't do it easily, so I abandoned it. It's worth reconsidering.
chrisb
Posts: 18914
Joined: Tue Mar 17, 2015 9:14 am

Re: Gesture navigation style updates (may 2019)

Postby chrisb » Tue May 21, 2019 7:46 pm

Thanks anyway for looking at this.
User avatar
DeepSOIC
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Gesture navigation style updates (may 2019)

Postby DeepSOIC » Mon May 27, 2019 4:47 pm

chrisb wrote:
Tue May 21, 2019 6:54 pm
...
PR #2216 to allow to enable logging.

After it's merged, and builds update, you should be able to enable logging with:

Code: Select all

App.ParamGet("User parameter:BaseApp/Preferences/View").SetBool("NavigationDebug",True)
Also, switch the nav style back and forth for the change of settings to be detected.
chrisb
Posts: 18914
Joined: Tue Mar 17, 2015 9:14 am

Re: Gesture navigation style updates (may 2019)

Postby chrisb » Tue May 28, 2019 8:42 am

That's great, I didn't know how often I use the gesture zoom. And I have worked too long with gesture to get accustomed to another mouse model.
It seems that updates are built weekly so it probably has to wait until next weekend.
chrisb
Posts: 18914
Joined: Tue Mar 17, 2015 9:14 am

Re: Gesture navigation style updates (may 2019)

Postby chrisb » Fri Jun 14, 2019 10:04 pm

DeepSOIC wrote:
Mon May 27, 2019 4:47 pm
After it's merged, and builds update, you should be able to enable logging with:

Code: Select all

App.ParamGet("User parameter:BaseApp/Preferences/View").SetBool("NavigationDebug",True)
Also, switch the nav style back and forth for the change of settings to be detected.
Switching back and forth was not sufficient, I had to restart FreeCAD. Aftr doing so I see in report view while zooming many identical messages

Code: Select all

leaving gesture state by mouse-click (fail-safe)
leaving gesture state by mouse-click (fail-safe)
leaving gesture state by mouse-click (fail-safe)
leaving gesture state by mouse-click (fail-safe)
...
User avatar
DeepSOIC
Posts: 7051
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Gesture navigation style updates (may 2019)

Postby DeepSOIC » Fri Jun 14, 2019 10:18 pm

chrisb wrote:
Fri Jun 14, 2019 10:04 pm
Switching back and forth was not sufficient, I had to restart FreeCAD
IDK, should have worked. Either it's still not enabled, or you have logging output disabled in report view. Right-click the report view and make sure Options->Logging context menu item is ticked.
When enabled, you should see stuff like this:

Code: Select all

button1 press 100(886,681)
postponed: button1 press 100(886,681)
 -> AwaitingMoveState
Gesture start SoGesturePinchEvent(698,424)
 -> GestureState
Gesture start SoGesturePinchEvent(698,424)
Gesture data SoGesturePinchEvent(695,421)
Gesture data SoGesturePinchEvent(694,421)
Gesture data SoGesturePinchEvent(695,422)
Gesture data SoGesturePinchEvent(694,422)
Gesture data SoGesturePinchEvent(694,421)
Gesture data SoGesturePinchEvent(693,419)
Gesture data SoGesturePinchEvent(693,419)
Gesture data SoGesturePinchEvent(692,419)
Gesture data SoGesturePinchEvent(692,419)
Gesture data SoGesturePinchEvent(691,418)
Gesture data SoGesturePinchEvent(691,417)
Gesture data SoGesturePinchEvent(690,417)
Gesture data SoGesturePinchEvent(689,416)
Gesture start SoGesturePanEvent(24,0)
Gesture data SoGesturePinchEvent(687,413)
Gesture data SoGesturePinchEvent(687,412)
Gesture data SoGesturePinchEvent(685,410)
Gesture data SoGesturePinchEvent(685,409)
Gesture data SoGesturePinchEvent(685,408)
Gesture data SoGesturePinchEvent(684,407)
Gesture data SoGesturePinchEvent(684,406)
Gesture data SoGesturePinchEvent(683,405)
Gesture data SoGesturePinchEvent(683,404)
Gesture data SoGesturePinchEvent(683,404)
Gesture data SoGesturePinchEvent(682,402)
Gesture data SoGesturePinchEvent(682,401)
Gesture data SoGesturePinchEvent(681,401)
Gesture data SoGesturePinchEvent(681,400)
Gesture data SoGesturePinchEvent(680,399)
Gesture data SoGesturePinchEvent(680,398)
Gesture data SoGesturePinchEvent(680,398)
Gesture data SoGesturePinchEvent(680,397)
Gesture data SoGesturePinchEvent(679,397)
Gesture data SoGesturePinchEvent(679,397)
Gesture data SoGesturePinchEvent(679,396)
Gesture data SoGesturePinchEvent(679,396)
Gesture data SoGesturePinchEvent(678,396)
Gesture data SoGesturePinchEvent(678,395)
Gesture data SoGesturePinchEvent(678,395)
Gesture data SoGesturePinchEvent(678,395)
Gesture end SoGesturePinchEvent(678,395)
 -> IdleState