Git Product home page Git Product logo

Comments (2)

fredkiefer avatar fredkiefer commented on June 20, 2024

It would really help, if somebody could detail the behaviour of these settings on macOS and more specifically on different versions of macOS. How do these two values (plus verticalScroller) relate to each other, when an NSScrollView gets resized?
With autohidesScrollers being NO, things should be easy the scrollers get controlled manually. But with that value being YES things might get complicated. Our expectation is that this not only hides scrollers but also displays them when needed.
If you read through the documentation by Apple you will see that they are rather unspecific on what happens.

from libs-gui.

optimisme avatar optimisme commented on June 20, 2024

The behavior of macOS is complex, and it depends on whether a magic mouse or a trackpad is available, or if only a traditional mouse is being used.

If only a traditional mouse is available, the scroll bars are displayed if they are configured and necessary:

In this example (ScrollBar-Mouse00), only the vertical bar is visible with this configuration:

hasVerticalScroller = YES;
hasHorizontalScroller = NO;
autohidesScrollers = YES;
ScrollBar-Mouse00

In this example (ScrollBar-Mouse01), both are shown, with this configuration because the horizontal is necessary:

hasVerticalScroller = YES;
hasHorizontalScroller = YES;
autohidesScrollers = YES;
ScrollBar-Mouse01

However, with the same configuration, when the horizontal is not necessary, it is not displayed (ScrollBar-Mouse02):

hasVerticalScroller = YES;
hasHorizontalScroller = YES;
autohidesScrollers = YES;
ScrollBar-Mouse02

When the value of autohidesScrollers is changed to NO, the space for the bar is still drawn, but the scrollbar is only visible if necessary (ScrollBar-Mouse03):

self.hasVerticalScroller = YES;
self.hasHorizontalScroller = YES;
self.autohidesScrollers = NO;
ScrollBar-Mouse03

However, the above configurations are not very common, as most users have a trackpad or a magic mouse. In that case, the scroll bars behave like this:

autohidesScrollers seems not to affect the behavior or the display, the bars always automatically hide and are shown when dragging the content or changing the size of the available space (usually when resizing the window)

even if the bars are configured with hasVerticalScroller/hasHorizontalScroller to NO, the scrolls are not drawn but the content can be moved with the trackpad as if they were active. (ScrollBar-Trackpad04):

self.hasVerticalScroller = NO;
self.hasHorizontalScroller = NO;
self.autohidesScrollers = NO;
ScrollBar-Trackpad04.mov

Leaving NO to the vertical scroll, or horizontal the behavior is the same as the previous one, but the scroll configured as visible is drawn, and also, you can interact with the mouse and the trackpad. (ScrollBar-Trackpad05):

self.hasVerticalScroller = YES;
self.hasHorizontalScroller = NO;
self.autohidesScrollers = NO;
ScrollBar-Trackpad05.mov

The next example shows the behavior when resizing the available space (ScrollBar-Trackpad06):

self.hasVerticalScroller = YES;
self.hasHorizontalScroller = YES;
self.autohidesScrollers = NO;
ScrollBar-Trackpad06.mov

It is important to note, that in the case of the trackpad/magic-mouse there are two visualizations, the one that shows only the scroll bar which is thinner and has a transparent background and the one that is shown while interacting which is thicker and shows the background bar as when only a traditional mouse is available (ScrollBar-Trackpad07)

ScrollBar-Trackpad07.mov

Finally, remember that all these configurations, it seems that they are only possible with the implementation of Layers and CoreAnimation.

Perhaps it would be fantastic to have a theme configuration, type:

NSScrollViewInterfaceStyle = NSWindows95InterfaceStyle;
NSScrollerInterfaceStyle = NSWindows95InterfaceStyle;

But adapted to the behaviors and captures described above, something like:

NSScrollViewInterfaceStyle = NSMacOSInterfaceStyle;
NSScrollerInterfaceStyle = NSMacOSInterfaceStyle;

from libs-gui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.