Class: SC.ScrollerView


Extends SC.View.

Displays a horizontal or vertical scroller. You will not usually need to work with scroller views directly, but you may override this class to implement your own custom scrollers.

Because the scroller uses the dimensions of its constituent elements to calculate layout, you may need to override the default display metrics.

You can either create a subclass of ScrollerView with the new values, or provide your own in your theme:

SC.ScrollerView = SC.ScrollerView.extend({
  scrollbarThickness: 14,
  capLength: 18,
  capOverlap: 14,
  buttonOverlap: 11,
  buttonLength: 41
});

You can change whether scroll buttons are displayed by setting the hasButtons property.

By default, SC.ScrollerView has a persistent gutter. If you would like a gutterless scroller that supports fading, see SC.OverlayScrollerView.

Defined in: scroller.js

Since:
SproutCore 1.0

Field Summary

Instance Methods

Field Detail

buttonLength Number

The width or height of the up/down or left/right arrow buttons. If the scroller is not displaying arrows, this is the width or height of the end cap.

buttonOverlap Number

The amount by which the thumb overlaps the arrow buttons. If the scroller is not displaying arrows, this is the amount by which the thumb overlaps the end cap.

Default value:
9
capLength Number
The width or height of the cap that encloses the track.
Default value:
18
capOverlap Number
The amount by which the thumb overlaps the cap.
Default value:
14
hasButtons Boolean
Whether or not the scroller should display scroll buttons
Default value:
YES
isEnabled Boolean

YES to enable scrollbar, NO to disable it. Scrollbars will automatically disable if the maximum scroll width does not exceed their capacity.

Default value:
YES
layoutDirection String

Determine the layout direction. Determines whether the scrollbar should appear horizontal or vertical. This must be set when the view is created. Changing this once the view has been created will have no effect. Possible values:

  • SC.LAYOUT_VERTICAL
  • SC.LAYOUT_HORIZONTAL
Default value:
SC.LAYOUT_VERTICAL
maximum Number

The maximum offset value for the scroller. This will be used to calculate the internal height/width of the scroller itself.

When set less than the height of the scroller, the scroller is disabled.

Default value:
0
minimum Number

The minimum offset value for the scroller. This will be used to calculate the internal height/width of the scroller itself.

Default value:
0
minimumThumbLength Number

The minimium length that the thumb will be, regardless of how much content is in the scroll view.

Default value:
20
proportion Number

The portion of the track that the thumb should fill. Usually the proportion will be the ratio of the size of the scroll view's content view to the size of the scroll view.

Should be specified as a value between 0.0 (minimal size) and 1.0 (fills the slot). Note that if the proportion is 1.0 then the control will be disabled.

Default value:
0.0
scrollbarThickness Number

The width (if vertical scroller) or height (if horizontal scroller) of the scrollbar.

Default value:
14
shouldScrollToClick Boolean

If YES, a click on the track will cause the scrollbar to scroll to that position. Otherwise, a click on the track will cause a page down.

In either case, alt-clicks will perform the opposite behavior.

Default value:
NO
value Number

The value of the scroller.

The value represents the position of the scroller's thumb.

Default value:
null

Instance Method Detail

displayValue()

The displayed value of the scroller.

This is the value of the scroller constrained within the minimum and maximum values.

renderButtons(context, hasButtons)
Parameters:
context
hasButtons
renderThumb(context, layoutDirection, thumbLength, thumbPosition)
Parameters:
context
layoutDirection
thumbLength
thumbPosition
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)