Hitting Escape while editing a Sketch

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Hitting Escape while editing a Sketch

Post by mlampert »

sliptonic's tongue in cheek video of the UI made me realise that at least some of those should be fixed. And I gotta admit the most annoying one for me personally is hitting Escape in the Sketcher and it closes the entire TaskPanel.

I started looking into it and noticed that it works the way I expect and want it to work - iff the mouse cursor is over the 3d view window.

If the mouse is over the CombiView widget itself and one hits Escape it will dismiss the entire TaskPanel - and it doesn't run through the logic in the ViewProviderSketch::keyPressed at all - which is what does the proper thing.

I remember running into this before and was wondering how this is meant to work.

Where should the logic of keyPressed go so the TaskPanel doesn't vanish on me just because the mouse is not over the correct widget?
User avatar
HarryGeier
Veteran
Posts: 1231
Joined: Mon Jul 10, 2017 12:36 pm
Location: Hof Germany

Re: Hitting Escape while editing a Sketch

Post by HarryGeier »

There is an ongoing discussion on this...

https://forum.freecadweb.org/viewtopic.php?f=34&t=30643
Kaum macht man´s richtig , gehts´s
My Video Tutorials on Youtube: https://www.youtube.com/channel/UCoe3B ... p8Q/videos
My FreeCAD Stuff on Hidrive: https://my.hidrive.com/share/qr3l1yddy6#$/
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Hitting Escape while editing a Sketch

Post by mlampert »

HarryGeier wrote: Fri Sep 07, 2018 5:39 am There is an ongoing discussion on this...

https://forum.freecadweb.org/viewtopic.php?f=34&t=30643
Great pointer, and a great discussion about what the behaviour of Escape should be.

Here I was more wondering about how a task panel implementation can provide consistent behaviour regardless of where the mouse pointer currently is when a state altering key gets pressed.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Hitting Escape while editing a Sketch

Post by wmayer »

Here I was more wondering about how a task panel implementation can provide consistent behaviour regardless of where the mouse pointer currently is when a state altering key gets pressed.
It doesn't depend on where the mouse cursor is but which widget has the focus. You can e.g. open the sketcher click into the 3d view to be sure it has the focus, move the cursor to the task panel and then click ESC. In this case it goes through ViewProvider::eventCallback.

Then you can test the opposite. Open the sketcher click on the task panel and move the cursor to the 3d view. If you now click ESC it goes through TaskView::reject.
sliptonic's tongue in cheek video of the UI made me realise that at least some of those should be fixed. And I gotta admit the most annoying one for me personally is hitting Escape in the Sketcher and it closes the entire TaskPanel.
IMO, the main point here is that when you clicked on one of the sketcher functions and press ESC it should only leave the function mode you are in but leave the sketcher open.
Btw, when you clicked on of the sketcher functions, right-clicked to leave it again and then restart this or another function pressing ESC only leaves this function mode again but doesn't close the sketcher. So, there must happen something on right-click that "heals" this logic.

However, when you opened the sketcher and don't use (or left) its functions then it's IMO correct to leave the sketcher. This way you're much more efficient because you don't have to move the mouse cursor over your whole screen in order to click on Close.
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Hitting Escape while editing a Sketch

Post by Jee-Bee »

wmayer wrote: Fri Sep 07, 2018 8:51 am However, when you opened the sketcher and don't use (or left) its functions then it's IMO correct to leave the sketcher. This way you're much more efficient because you don't have to move the mouse cursor over your whole screen in order to click on Close.
In the you stated situation the skecher should now it here is something changed after opening the sketcher and is more complex.. isn't it?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Hitting Escape while editing a Sketch

Post by wmayer »

Btw, when you clicked on of the sketcher functions, right-clicked to leave it again and then restart this or another function pressing ESC only leaves this function mode again but doesn't close the sketcher. So, there must happen something on right-click that "heals" this logic.
This behaviour depends on which widget has the focus. When you use a sketcher function, right click (which must happen inside the 3d view) it will get the focus and thus a press on ESC afterwards makes the system to go through ViewProviderSketch::keyPressed
In the you stated situation the skecher should now it here is something changed after opening the sketcher and is more complex.. isn't it?
:?:
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Hitting Escape while editing a Sketch

Post by Jee-Bee »

What i meant was. that it would be great if the sketcher nows (during runtime) if the sketch is changed. if nothing changed it could be a user fault and canceling is indeed faster with esc button. But if something is changed it or you go out of another function(and so probably as mistake to press esc) or you did it on purpose becouse you did something wrong and in that case i think it is better to do more mouse movement just to see the differnece
chrisb
Veteran
Posts: 53932
Joined: Tue Mar 17, 2015 9:14 am

Re: Hitting Escape while editing a Sketch

Post by chrisb »

I don't think it's a good idea to let keys behave (too) different depending on what has happened before.

- There should be a key ending the tools inside Skecher (Create line, ...). MacOS users need it, because the right mouse alternative zooms unintended.
- There might be a key closing sketcher.
- There seems to be consensus that these keys should not be the same, although for both ESC seems to be natural.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Hitting Escape while editing a Sketch

Post by mlampert »

wmayer wrote: Fri Sep 07, 2018 8:51 am It doesn't depend on where the mouse cursor is but which widget has the focus. You can e.g. open the sketcher click into the 3d view to be sure it has the focus, move the cursor to the task panel and then click ESC. In this case it goes through ViewProvider::eventCallback.
Ah, that makes perfect sense. When I hit a tool in the sketcher (like create a circle) and then hit ESC the focus would be on the task bar and not the 3dview.
kisolre
Veteran
Posts: 4164
Joined: Wed Nov 21, 2018 1:13 pm

Re: Hitting Escape while editing a Sketch

Post by kisolre »

Sorry to reopen this old discussion but today this bugged me enough to dig deeper.
In the wiki https://www.freecadweb.org/wiki/Sketcher_Workbench there is no mention to Esc exiting the Sketcher or RMB exiting the tools. It is mention in every tool page as the way to exit the tool (Esc or RMB).
So here is the problem: if a tool is selected the cursor changes to represent the active tool. But since all other windows remain active if the user makes something in them they take the focus and there is no visual feedback that this has happened. The cursor changes according to where the mouse is, you can perform tasks in the panels. But none of them except the Tasks panel have an action for the Esc key. So if you do something in it (scroll to see values of some out of view constraints for example) then go back over the sketch view and decide to exit the tool by some reason pressing Esc closes the whole sketch since the tasks panel is still active. This can be quite confusing at times especially with new users.
If the Tasks panel could check if any tool is selected and instead of exiting deactivates the tool and there is a visual indication of the tool selected other then just the cursor change (like raising/lowering of the toolbar button for example) this would be easy for the user.
Post Reply