Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 6 commits into from

Conversation

DSCaskey
Copy link
Contributor

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.
  • Adds a checkbox to enable Autoscroll.
  • Add a speed setting to the autoscroll.
  • Unchecking Autoscroll disables the speed setting.

Screenshot 2024-07-28 210212

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

  2. Adds the auto scroll behavior to the image tool.

This closes issue #1152

Copy link

what-the-diff bot commented Jul 30, 2024

🚀 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

  • You know our cool autoscroll feature? It just got cooler! Improvements have been added to better control its behavior and speed. Basically, it's now more responsive and adaptable due to updates made in preferencesgraphicsviewpage.cpp and vcommonsettings.cpp.

Boosting Image Item Functionality

  • We've sharpened our toolkit! The image_item.cpp file has some vital modifications to enhance how we handle image items. It's now got a better handle on clearing selections and moving items around.

Better Understanding With Comments

  • To help everyone on this journey, comments have been sprinkled generously in our code like helpful breadcrumbs! They're found in image_item.cpp, vtoolspline.cpp, vtoolsplinepath.cpp, vtoolbasepoint.cpp, pattern_piece_tool.cpp, and vcontrolpointspline.cpp.

Splat! New Functions in vtoolsplinepath.cpp

  • We've got an expansion pack! Our vtoolsplinepath.cpp file now has a heap of new functions to help us craft the optimal path for our splines and control visualization. It's like getting new superpowers! 💪

Upkeeping our information

  • Information is key, so we've updated our file headers that now sport new copyright info to shout out all our rockstar developers. This can be seen in vgraphicsimpletextitem.cpp and vmaingraphicsview.h.

On a Visible Mission

  • An essential new function has emerged on a mission! Taking the cloak off rectangles, the new ensureRectVisible function is here to make sure rectangles in our views never go undercover. Now everyone gets to see the amazing rectangles! 🟩

Less Unused Code

  • A diligent spring clean in the vtoolsplinepath.cpp file has helped us cut away some unused code. A easier and breezier file for everyone!

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

@DSCaskey DSCaskey linked an issue Jul 30, 2024 that may be closed by this pull request
@Onetchou
Copy link
Contributor

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
Copy link
Contributor

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

src/libs/vwidgets/vmaingraphicsview.cpp Outdated Show resolved Hide resolved
@DSCaskey
Copy link
Contributor Author

DSCaskey commented Aug 1, 2024

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
Copy link
Contributor

Onetchou commented Aug 13, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Collaborator

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
Copy link
Contributor

@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
Copy link
Contributor

Onetchou commented Aug 17, 2024

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.

slspencer
slspencer previously approved these changes Sep 17, 2024
src/libs/vwidgets/vmaingraphicsview.cpp Outdated Show resolved Hide resolved
@Onetchou Onetchou marked this pull request as draft September 17, 2024 17:29
@Onetchou
Copy link
Contributor

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 😉

@slspencer slspencer dismissed their stale review September 21, 2024 22:58

Apparently the change wasn't made

@slspencer slspencer closed this Nov 19, 2024
@slspencer slspencer deleted the fix-autoscroll-with-delay branch November 19, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Drag items slowly
3 participants