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

Auto scroll when moving pattern piece is now independent from the piece's size #1156

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

Onetchou
Copy link
Contributor

@Onetchou Onetchou commented Jul 25, 2024

Addresses issue #1152

In piece mode, the view starts to pan automatically with a different threshold depending on if the moved pattern piece is visible in its entirety or if we are zoomed on it. This causes the auto-pan sensibility to be quite random: it's easy to move a pattern piece very far away by mistake. And since the current auto-pan behavior depends on the size of the pattern piece moved, the auto-pan is much more sensible when moving pieces that are big on the screen than it is with small pieces.

The modification I propose here modifies this behavior so that the auto-pan threshold is independent from the pattern piece moved and only depends on the position of the mouse on the screen, like in other softwares.

Copy link

what-the-diff bot commented Jul 25, 2024

PR Summary 🚀

  • Improved Cursor Visibility 😎
    In the file named 'pattern_piece_tool.cpp', there's a section of code that controls how a small space around your cursor is viewed. The magic has been reworked to make this experience smoother. Now, you can engage more easily with items on your screen, no matter their size compared to the viewable area. This change is all about improving your user experience by keeping more control in your hands (or should we say, at your cursor tip!). It's time to navigate with more efficiency and precision! 🖱

Copy link
Contributor

@DSCaskey DSCaskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not see any appreciable difference in behavior, but I am approving this, if not for any other reason than to remove code that does not perform a useful function.

@DSCaskey DSCaskey merged commit e27901a into develop Jul 25, 2024
10 checks passed
@DSCaskey DSCaskey deleted the piece-auto-scroll branch July 25, 2024 20:38
@Onetchou
Copy link
Contributor Author

Onetchou commented Jul 25, 2024

I did not see any appreciable difference in behavior, but I am approving this, if not for any other reason than to remove code that does not perform a useful function.

In the screenshot below, with the old behavior, if I grab the pattern piece with the mouse where the red cross is, it will start to pan automatically to the right as soon as I'll start to move my mouse since the right side of the pattern piece is close to the right side of the screen, even if my mouse is near the middle of the screen:
image

and if I want to move the pattern piece to the right I'll go to the right with my mouse, going way beyond the place where the auto-pan starts, making it go very fast.

With the new behavior, the auto pan will only start when my mouse is near the right side of the screen: it's predictable and I'll not likely go far beyond the auto-pan threshold, because I don't have much space to do so, preventing the pan to be too fast😊

@DSCaskey
Copy link
Contributor

DSCaskey commented Jul 30, 2024

With the new behavior, the auto pan will only start when my mouse is near the right side of the screen: it's predictable and I'll not likely go far beyond the auto-pan threshold, because I don't have much space to do so, preventing the pan to be too fast

It's not making the scrolling go any slower... it's just not happening as soon. I think though - as your change points out - that it's unatural to most users to autoscroll by the boundries of the item moved... as we are more conditioned to the position of the mouse hitting the scroll area boundries. I checked a lot of different apps, and they all seem to autoscroll by the mouse position, and not the edges of the moving object. I get the idea of keeping the graphic item completey visible, but the fact the size of the items are different it's probably a bit disconcerting to the brain... so by the time you realize you've hit the scroll area edge - you've already zipped off.

That being said... it's a timing issue with the ensureVisible() method... I have made a fix to address the issue, where a delay is added between calling ensureVisible()'s so as to be able to control the speed of the autoscroll. More specifically I added 2 preferences... 1) Autoscroll checkbox to be able to turn the scrolling off completely 2) A speed setting - which gets inversely converted to a delay in mSleep(). I also made the changes to all the other tools such as the point labels as per Grace's request. I also added the autoscoll changes to the image tool.

@Onetchou
Copy link
Contributor Author

It's not making the scrolling go any slower... it's just not happening as soon.

In a way it does make the scrolling slower, since with the old behavior it was possible to hold a pattern piece by its center and to move the mouse near the edge of the screen, thus having a big amount of the image out of the screen, forcing the ensureVisible() method to slide the view by a big amount each time to put back the image inside the view. With the box around the mouse, it's only possible, at maximum, to put half of the box out of the view.

But of course this was only a first quick fix to address the issue, your fix with the delay does fully solve the issue, thx! 😉

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.

2 participants