FashionFreedom / Seamly2D

Open source patternmaking software to democratize fashion.
https://seamly.io
GNU General Public License v3.0
616 stars 111 forks source link

feature: add disable & speed control to auto scrolling #1159

Closed DSCaskey closed 3 days ago

DSCaskey commented 3 months ago

This PR does 2 main things. Gives an option to disable auto scrolling completely and adds a delay to control the speed of the auto scrolling.

1) New preferences.

Screenshot 2024-07-28 210212

2) Removes the behavior of auto scrolling by an object's bounding rect (+ margin) for all the tools that auto scroll.

3) Adds the auto scroll behavior to the image tool.

This closes issue #1152

what-the-diff[bot] commented 3 months ago

🚀 Pull Request Summary

Hello amazing team, it's a great day for an update! Here is a quick rundown of the changes in our codebase. Remember, your hard work is like pixels on a screen, every bit contributes to the beautiful big picture! 🎨

Autoscroll Feature Enhancements

Boosting Image Item Functionality

Better Understanding With Comments

Splat! New Functions in vtoolsplinepath.cpp

Upkeeping our information

On a Visible Mission

Less Unused Code

Continue being spectacular! Remember, in this code universe, every star (or dev) counts! 🌟

Onetchou commented 3 months ago

image

I'm not sure why, but the "Autoscroll" font seems to be different from the one used for "show scrollbars". It's also the case in the screenshot you shared upper.

Onetchou commented 3 months ago

Mmmm, on my computer this PR creates huge freezes of the software when I use the middle mouse button to pan...

DSCaskey commented 3 months ago

I'm not sure why, but the "Autoscroll" font seems to be different from the one used for "show scrollbars". It's also the case in the screenshot you shared upper.

Discovered another quirk in Creator. Here's the 2 checkboxes in Creator.

Screenshot 2024-07-31 210414 Screenshot 2024-07-31 210403

If you look you will see that both are set to 9 point... but are they? Nope. Only the Show Scrollbars that displays Point Size in BOLD. Here's the quirky part... you can't just hit return in the Point Size field after the 9... you have to change it to something else.. THEN change it back to 9, at which point Point Size is then displayed in BOLD. The other quirky part is why does Creator display a size of 9, when in fact no font size is written in the ui form... it should display nothing you would thin? BTW... somewhere the default font size is set to 8 point.

Onetchou commented 3 months ago

In image_item.cpp :

image

If I'm not mistaken, as a bitwise AND, buttons() & LeftButton will be true if LeftButton is pressed, even if other buttons are also pressed at the same time whereas buttons() == LeftButton will only be true if LeftButton is the only one pressed, which may be problematic since right clicking meanwhile moving an object would stop it from moving while the right click is pressed... 😊

DSCaskey commented 3 months ago

If I'm not mistaken (I've not tested it), as a bitwise AND, buttons() & LeftButton will be true if LeftButton is pressed, even if other buttons are also pressed at the same time whereas buttons() == LeftButton

Look closer... it's button()... not buttons(). No "s". It does the same thing. I changed it to button() == Qt::LeftButton to be consistent with the rest of the code. In fact button() == Qt::LeftButton is used in resize_handle.cpp. I have no preference one way or the other - I can read either way... I just prefer it to be, one way or the other, not both. :)

Onetchou commented 3 months ago

If I'm not mistaken (I've not tested it), as a bitwise AND, buttons() & LeftButton will be true if LeftButton is pressed, even if other buttons are also pressed at the same time whereas buttons() == LeftButton

Look closer... it's button()... not buttons(). No "s". It does the same thing. I changed it to button() == Qt::LeftButton to be consistent with the rest of the code. In fact button() == Qt::LeftButton is used in resize_handle.cpp. I have no preference one way or the other - I can read either way... I just prefer it to be, one way or the other, not both. :)

Oops, I didn't see the "s", I should have read this more carefully 😂

slspencer commented 3 months ago

The commit that makes this out-of-date is just a link in the README to the Doxygen docs, you can merge it without risk.

Onetchou commented 3 months ago

@DSCaskey I'm not sure if this is the best way to slow down the auto-scrolling.

The issue using ensureRectVisible is that when you want the view to auto-scroll, you will put your mouse ouf of the screen, and it will jump to put back your mouse in the view, then wait a little bit and do it again: it's not smooth at all, it seems very very laggy. The auto-scrolling is a succession of sudden jumps...

I think we have to modify this behavior so it's like in other softwares: we should not use the ensureVisible function but simply pan the view with a speed proportional to the distance between the cursor and the edge of the view. This way it will start auto-scrolling slowly but smoothly when the mouse is out of the view, and get quicker and quicker when the mouse is far away, but without jumping. 😊

Onetchou commented 3 months ago

In other words, I think we need to move the view 1 pixel at a time, faster and faster as the mouse is far away from the edge of the view.

Onetchou commented 2 months ago

As this PR still needs some modifications to make the scrolling smooth, I'm putting it in Draft Mode so we can put it aside for a moment 😉