OpenBoard-org / OpenBoard

OpenBoard is a cross-platform interactive whiteboard application intended for use in a classroom setting.
https://openboard.ch/
GNU General Public License v3.0
2.35k stars 423 forks source link

[Bug] Cannot rotate a horizontal or vertical line #1105

Open letsfindaway opened 5 days ago

letsfindaway commented 5 days ago

Describe the bug

An nearly horizontal or vertical line is difficult to rotate using the rotate button on the delegate.

To Reproduce

  1. Draw a horizontal or vertical line using the Line tool.
  2. Switch to the Selector tool.
  3. Select the line
  4. Try to rotate the line using the rotate icon in the upper right corner of the line

Expected behavior

I would expect that you can rotate the line when you click while the rotate cursor is visible.

Actual behavior

It is at least very difficult to rotate the line. You have to click on the rotate button at the very upper left corner to actually hit it. Else you're hitting the resize handle and are resizing the line, even if the rotate cursor is shown. The rotate cursor remains active even if the resize function is actually executed.

Screenshots

Even if the rotate cursor is shown, when clicking at this position the resize function is executed. grafik

As you can see, the right resize handle, the resize handle at the bottom right corner and the rotate button are very close together. I would however expect that I get the function which is indicated by the cursor.

Context

MiltonBalaOfficial commented 4 days ago

In this case, a slight increase of width is not possible also. If you want to increase the width slightly, it is increased too much

letsfindaway commented 4 days ago

In this case, a slight increase of width is not possible also. If you want to increase the width slightly, it is increased too much

This is caused by some quite old code (from 2013) which does not resize below the double of the frame size. I do not know for what reason this is, but it was added intentionally. So we should know the intention.

letsfindaway commented 4 days ago

For my original problem I have a proposal for a solution. First of all what is the cause?

The handles are all created as QGraphicsSvgItem. The respective cursor to show when the mouse is over the item is set at each handle. So the OS automatically switches cursor when the mouse is moved over the handles. When multiple items overlap, then the topmost wins. The topmost is the one created last.

The code to determine the tool from the cursor position however

a) checks the bottom most item first, and b) uses the coordinates of the item instead of simply asking the item->isUnderMouse()

If we check the handles in reverse order, then the behavior is much better! Using isUnderMouse() would simplify the code and assure that the result matches the cursor shown.

letsfindaway commented 4 days ago

In this case, a slight increase of width is not possible also. If you want to increase the width slightly, it is increased too much

@MiltonBalaOfficial As I now know that these two things are not related, please create a new bug report for the resizing issue so that we can handle and discuss them independently.

Thanks!