ScrollImpl class
Implementation of scrolling behavior.
class ScrollImpl {
static ScrollImpl impl;
/**
* Get the singleton instance of {@link ScrollImpl}.
*/
static ScrollImpl get() {
if (impl == null) {
impl = new ScrollImpl();
}
return impl;
}
/**
* Get the maximum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the maximum scroll position
*/
int getMaximumHorizontalScrollPosition(dart_html.Element scrollable) {
return isRtl(scrollable) ? 0 : scrollable.scrollWidth - scrollable.client.width;
}
/**
* Get the minimum horizontal scroll position.
*
* @param scrollable the scrollable element
* @return the minimum scroll position
*/
int getMinimumHorizontalScrollPosition(dart_html.Element scrollable) {
return isRtl(scrollable) ? scrollable.client.width - scrollable.scrollWidth : 0;
}
/**
* Initialize a scrollable element.
*
* @param scrollable the scrollable element
* @param container the container
*/
void initialize(dart_html.Element scrollable, dart_html.Element container) {
// Overridden by ScrollImplTrident.
}
/**
* Check if the specified element has an RTL direction. We can't base this on
* the current locale because the user can modify the direction at the DOM
* level.
*
* @param scrollable the scrollable element
* @return true if the direction is RTL, false if LTR
*/
bool isRtl(dart_html.Element scrollable) {
// var computedStyle = $doc.defaultView.getComputedStyle(scrollable, null);
// return computedStyle.getPropertyValue('direction') == 'rtl';
return false;
}
}
Static Properties
ScrollImpl impl #
static ScrollImpl impl
Static Methods
ScrollImpl get() #
Get the singleton instance of {@link ScrollImpl}.
static ScrollImpl get() {
if (impl == null) {
impl = new ScrollImpl();
}
return impl;
}
Methods
int getMaximumHorizontalScrollPosition(Element scrollable) #
Get the maximum horizontal scroll position.
@param scrollable the scrollable element @return the maximum scroll position
int getMaximumHorizontalScrollPosition(dart_html.Element scrollable) {
return isRtl(scrollable) ? 0 : scrollable.scrollWidth - scrollable.client.width;
}
int getMinimumHorizontalScrollPosition(Element scrollable) #
Get the minimum horizontal scroll position.
@param scrollable the scrollable element @return the minimum scroll position
int getMinimumHorizontalScrollPosition(dart_html.Element scrollable) {
return isRtl(scrollable) ? scrollable.client.width - scrollable.scrollWidth : 0;
}
void initialize(Element scrollable, Element container) #
Initialize a scrollable element.
@param scrollable the scrollable element @param container the container
void initialize(dart_html.Element scrollable, dart_html.Element container) {
// Overridden by ScrollImplTrident.
}
bool isRtl(Element scrollable) #
Check if the specified element has an RTL direction. We can't base this on the current locale because the user can modify the direction at the DOM level.
@param scrollable the scrollable element @return true if the direction is RTL, false if LTR
bool isRtl(dart_html.Element scrollable) {
// var computedStyle = $doc.defaultView.getComputedStyle(scrollable, null);
// return computedStyle.getPropertyValue('direction') == 'rtl';
return false;
}