iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
600 stars 210 forks source link

AccuDraw dialog/widget is not working correctly in polar mode. #6478

Closed YashodipD closed 6 months ago

YashodipD commented 6 months ago

Describe the bug

AccuDraw have 2 modes - rectangular and polar. It works correctly for rectangular mode. Works correctly means - input fields are auto focused as per current position of mouse pointer relative to compass axis. If mouse pointer is on Y - axis of accudraw compass, it focuses on y input fields. If pointer moves to another direction i.e x, automatically input focus goes on x input field.

same thing does not happen for polar mode. When I activated arc tool from editor package from iTwin core.

Note- while testing all the tools are used from here - https://github.com/iTwin/itwinjs-core/tree/master/editor

To Reproduce

Prerequisite - import tools from editor package - https://github.com/iTwin/itwinjs-core/tree/master/editor To produce the incorrect behavior of AccuDraw widget/dialog in below are the steps.

  1. From the sketch tools activate the Create Arc tool. (should work with any editor tool)

  2. click on viewport for 2 times to radius of the arc. this is current state of accudraw compass and input fields image

  3. user manually needs to go to input and activate the compass focus and enter the values which is wrong. image

Expected Behavior

Like it happens in rectangular mode of AccuDraw.

Respective input fields should be activated based on current position of cursor in polar mode.

Screenshots

No response

Desktop (please complete the applicable information)

Version: 1.0.16 (a9f230f) Build: iTwin Desktop Platform (Mango) 2024.02.06-1 iTwin.js: 4.4.0-dev.10 iTwinUI: 3.2.3 AppUI: 4.6.1 React: 17.0.2 Node.js: 18.16.1 Electron: 26.6.1 Build Tools Commit: 60d5287

DrawingProduction: 0.0.0 - our app name

Additional context

No response

bbastings commented 6 months ago

There is a valid enhancement request here once the focus bug is addressed. Should add a method to AccuDrawHintBuilder so that a tool that knows it's defining an angle instead of a distance can move focus to the appropriate input field. Historically a user that wanted to enter an angle would manually focus the input field using a shortcut ("AA" or Tab to move focus from distance field). Unlike the automatic X/Y focus switching based on the cursor location when neither is locked, there is no such clear answer for distance and angle, only the tool knows.

GerardasB commented 6 months ago

I think the proper way to address this will be to add a method to AccuDrawHintBuilder so that a tool that knows it's defining an angle instead of a distance can move focus to the appropriate input field. Historically a user than wanted to enter an angle would manually focus the input field using a shortcut. In the case of iTwin and the angle field that would be "AA". Unlike the automatic X/Y focus switching based on the cursor location when neither is locked, there is no such clear answer for distance and angle.

Seems like the UI components are listening to the focus notifications i.e. AccuDraw.newFocus & AccuDraw.setFocusItem coming from @itwin/core-frontend correctly. Reassigning to @bbastings since as mentioned, this will be solved at a Tool level.

Josh-Schifter commented 6 months ago

At least in our experiments, there is a difference between the itwin editor tools and MicroStation.

  1. Start Arc Tool using 'Start, Center' mode
  2. Enter first point. Now compass shows 'active' in rectangular mode and focus auto hops between X and Y (good)
  3. Enter second point. Now compass shows 'inactive' in polar mode. Focus is on NEITHER distance nor angle field. (bad)

In MicroStation, accudraw stays 'active' after the second point and focus goes to the distance field. I can switch to angle using . In itwin, I need to use my mouse to put focus into one of the accudraw input fields before I can use .

bbastings commented 6 months ago

3. Focus is on NEITHER distance nor angle field. (bad)

This is definitely wrong, @GerardasB can you take a look? I mentioned on teams that I thought it was wrong that AccuDraw was grey in the 1st picture since that should indicate that shortcuts won't work.

Is it maybe losing focus when switching from rectangle to polar because the text fields contents are changing? AccuDraw needs to re-grab focus then on whatever the "active" input field is...it does not need to specifically set focus to either distance or angle...can maybe just call FrameworkAccuDraw.grabInputFocus after the mode change?

EDIT: @Josh-Schifter just did a demo for me, this is definitely what is happening. The enhancement for tools to specify focus will still be good to add, but the loss of focus is a real issue here that needs to be addressed first, assigning back to you @GerardasB