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
- buttonLength
- buttonOverlap
- capLength
- capOverlap
- hasButtons
- isEnabled
- layoutDirection
- maximum
- minimum
- minimumThumbLength
- proportion
- scrollbarThickness
- shouldScrollToClick
- value
- Fields borrowed from SC.View:
- acceptsFirstResponder, acceptsMultitouch, ariaHidden, ariaRole, attributeBindings, autoMixins, backgroundColor, childViewLayout, childViewLayoutOptions, childViews, childViewsNeedLayout, classNameBindings, classNames, concatenatedProperties, createdByParent, designMode, displayProperties, enabledState, firstKeyView, hasLayout, hasTouch, hasVisibility, isBuildingIn, isBuildingOut, isChildViewLayoutLive, isFixedHeight, isFixedPosition, isFixedSize, isFixedWidth, isKeyResponder, isTextSelectable, isView, isVisible, lastKeyView, layerLocationNeedsUpdate, layerNeedsUpdate, layout, modeAdjust, nextKeyView, page, pane, parentView, previousKeyView, renderDelegateName, shouldInheritCursor, shouldInheritEnabled, tagName, themeName, toolTip, touchBoundary, transitionAdjust, transitionAdjustOptions, transitionHide, transitionHideOptions, transitionIn, transitionInOptions, transitionOut, transitionOutOptions, transitionShow, transitionShowOptions, useStaticLayout
- Fields borrowed from SC.Responder:
- hasFirstResponder, isFirstResponder, responderContext
- Fields borrowed from SC.Object:
- isDestroyed, isObject, nextProperty, object, property, target, toInvalidate
- Fields borrowed from SC.Observable:
- isObservable
Instance Methods
- displayValue()
- renderButtons(context, hasButtons)
- renderThumb(context, layoutDirection, thumbLength, thumbPosition)
Field Detail
buttonLength NumberThe 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.
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
- Default value:
- 18
- Default value:
- 14
- Default value:
- YES
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
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
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
The minimum offset value for the scroller. This will be used to calculate the internal height/width of the scroller itself.
- Default value:
- 0
The minimium length that the thumb will be, regardless of how much content is in the scroll view.
- Default value:
- 20
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
The width (if vertical scroller) or height (if horizontal scroller) of the scrollbar.
- Default value:
- 14
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
The value of the scroller.
The value represents the position of the scroller's thumb.
- Default value:
- null
Instance Method Detail
The displayed value of the scroller.
This is the value of the scroller constrained within the minimum and maximum values.
- Parameters:
- context
- hasButtons
- Parameters:
- context
- layoutDirection
- thumbLength
- thumbPosition