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

Reimplement/fix/complete implementation of scrollbars #554

Merged
merged 14 commits into from
Aug 26, 2024
Merged

Conversation

rock3r
Copy link
Collaborator

@rock3r rock3r commented Aug 20, 2024

This PR overhauls how scrollbars are implemented, fixing all known issues and implementing the features that were forgotten/missing.

  • As before, scrollbars have:
    • Two visibility styles:
      • AlwaysVisible, where the scrollbars are always visible and have always the same thickness. This is the most similar to Win/Linux behavior on macOS but doesn't 100% match it.
      • WhenScrolling, scrollbars are only visible while scrolling
    • Two track click behaviors:
      • NextPage, clicking moves the viewport by a whole page, but not more
      • JumpToSpot, moves the viewport to the point that was clicked (may be more than a page)
  • In standalone, the scrollbars use the defaults for each platform (macOS: WhenScrolling + JumpToPoint, Win/Linux: AlwaysVisible + JumpToPoint)
  • In the bridge, we have lifted some platform logic in ScrollbarHelper to react to macOS system prefs changes, like Swing does. On Win/Linux it's always using the defaults, like in standalone.
  • TabStrip scrollbars require a lot of special handling, we'll take care of them separately (Improve scrollbars in tabstrips #553)
  • Scrollbars remain "active"/"visible" as long as the mouse moves over the content, like in Swing, if you set it up correctly
  • ScrollableContainer API makes it all super easy for you, and handles overlaying or not the scroll bars over the scrollable content, like Swing does
  • The scrollbarContentSafePadding function provides an optional padding to apply to scrollable content important parts to avoid them being overlapped by WhenScrolling scrollbars.

TODO

@rock3r rock3r added feature New feature or request consistency Our UI presentation is not consistent with IJ labels Aug 20, 2024
@rock3r rock3r requested review from hamen and devkanro August 20, 2024 16:56
@rock3r rock3r self-assigned this Aug 20, 2024
@rock3r rock3r force-pushed the scrollbar-behaviour branch 2 times, most recently from 44ced54 to cc5cfe4 Compare August 21, 2024 12:16
rock3r and others added 13 commits August 23, 2024 18:28
* Implement TrackClickBehaviors correctly
* Fix macOS scrollbar styling
* Provide ScrollableContainers for a simple, turn-key scrollbar API
* Make expanded scrollbar not hide while the mouse moves over the
  scrollable composable
* Fix the expanding behaviour and animation on macOS
* Fix the visibility logic on macOS
* Resolve a number of inconsistencies with Swing implementations
* Simplify and consolidate internal implementation
* Separate tabStrip scrollbar styling
* Fix thumb colour fade in AlwaysVisible mode
* Move sample border to Outside so it doesn't overlap the scrollbar
* Rework layout/draw logic to finally align with Swing, in dark mode too
* Switch to custom drawing for the thumb for more control
* Cleanup code
* Update API definitions
* Make bridge compile
* Fix styling in bridge
* Update bridge samples
* Fix TextArea scrollbars
* Fix bug in ScrollableContainer
* Improve ReleasesSampleCompose
* Rewrite MacScrollbarHelper to avoid native crashes
* Add decorationModifier to TextArea API (useful e.g., for padding when
  there are scrollbars)
* Fix ScrollableContainerImpl layout logic and bugs
* Fix one HorizontallyScrollableContainer using vScroll by mistake
* Use HorizontallyScrollableContainer in Markdown block renderer
* Update standalone sample Markdown with new APIs
* Add mouse move linger behaviour to all ScrollableContainers
* Add horizontal scrolling example to standalone sample
* Fix ScrollableContainerImpl layout bug with WhenScrolling
* Remove debug bg from Scrollbars sample
* Fix thumb appearing/disappearing animation
* Fix colour animations
* Keep AlwaysVisible thumb "hovered" while dragging
* Fix styling in the bridge
* Fix InputField ignoring provided scrollbar style
* Remove useless KDocs from TextArea/TextField
* Clean up code
* Mark non-state-based TextArea/TextField as scheduled for removal
* Fix native crash when TextField/TextArea don't have a fixed width
* Redo the entire BTF2-based InputField implementation, better
* Expose all the new parameters that BTF2-based InputField has to the
  users of TextField and TextArea
* Fix TextArea decoration and scrollbars
* Fix scrollbars on Windows and Linux
* Fix TextArea end padding to account for scrollbar
* Clean up code
* Add scrollbar to undecorated TextAreas
@rock3r rock3r marked this pull request as ready for review August 23, 2024 16:55
@rock3r
Copy link
Collaborator Author

rock3r commented Aug 23, 2024

@hamen @devkanro I am sorry this ended up being huge, I had to rewrite ~95% of everything scrollbars as the previous implementation was simply not working well, and/or not flexible enough.

Once this is merged we can ship 0.23.0, finally!

PS: there are some minor inconsistencies with Swing tracked in the linked issues in the description — they're all P2/P3 for what I am concerned, though.

@hamen
Copy link
Collaborator

hamen commented Aug 24, 2024

No worries. We will take care of it on Monday 🙏🏻

@rock3r rock3r merged commit d1c0567 into main Aug 26, 2024
3 checks passed
@rock3r rock3r deleted the scrollbar-behaviour branch August 26, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consistency Our UI presentation is not consistent with IJ feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants