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

add the pixels-per-scroll-step init argument #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rfindler
Copy link
Member

@rfindler rfindler commented Feb 5, 2024

thanks to @alex-hhh for the actual implementation

thanks to @alex-hhh for the actual implementation
@racket-discourse-github-bot

This pull request has been mentioned on Racket Discourse. There might be relevant details there:

https://racket.discourse.group/t/putting-a-large-pict-in-a-text-scroll-bar-problems/2700/5

benknoble added a commit to benknoble/frosthaven-manager that referenced this pull request Feb 5, 2024
See also racket/pict-snip#4 and connected
discussion. The example program in the discussion is gone, but was
trivial.
@@ -18,9 +19,15 @@
}

@defclass[pict-snip% snip% ()]{
@defconstructor[([pict pict?])]{
@defconstructor[([pict pict?]
[pixels-per-scroll-step (or/c #f natural?) #f])]{
Copy link
Sponsor

Choose a reason for hiding this comment

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

Is the default value #f for backwards compatibility? Everyone who wants the different behavior (I suspect most people) will now have to specify the init argument explicitly for each snip they create. This requires writing more code, and I don't think the user would want different scroll steps for different snips in their application.

I think that pixels-per-scroll-step would better be a parameter outside the snip class. This way, we could keep the default of #f, but the user could put a single (pict-snip-pixels-per-scroll-step 1) call at the beginning of their program and switch to smooth scrolling for their application.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the default was just the same behavior as before. I'm happy to change it, tho. (It seems legitimate to consider this a bugfix!)

As for the parameter, I'd prefer to just set the default to something we think will work well for people. But do you think there will be situations where two different values will be best and also where setting things globally like that will be useful?

Choose a reason for hiding this comment

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

I'll note that in my case 1 was smoother but 10 meant less scrolling (on my trackpad) to actually see the image. So I stuck with 10 for now.

Copy link
Sponsor

Choose a reason for hiding this comment

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

Yes, I think it is better to consider this a bugfix. While it looks like different values for the scroll step might be needed for different applications, I don't think the previous behavior of not being able to scroll would have legitimate use cases.

@benknoble , I wonder if the text% (or editor-canvas%) implementation need to implement accelerated scrolling?

Choose a reason for hiding this comment

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

Happy to try accelerated scrolling / help implement and test.

Copy link
Member Author

Choose a reason for hiding this comment

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

There was some work back in 2019 that @Bogdanp and @mflatt did to improve scrolling and also some work in 2018. I forget when it was exactly but there was a big improvement at some point around that era where scrolling got some serious effort and got a lot better.

That said, there is definitely a lot more that can be done but poking around in the mred directory in gui-lib might turn up some code that you'd be able to spot improvements for!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants