| Index: ui/file_manager/file_manager/foreground/js/ui/scrollbar.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/ui/scrollbar.js b/ui/file_manager/file_manager/foreground/js/ui/scrollbar.js
|
| index 479c8cc72f0dd98e0a3ee89e781e91198270b1c1..a5f389869f3d1d1a00d2e6a50891558a73325fd4 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/ui/scrollbar.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/ui/scrollbar.js
|
| @@ -51,6 +51,7 @@ ScrollBar.prototype.decorate = function() {
|
|
|
| this.button_.addEventListener('mousedown',
|
| this.onButtonPressed_.bind(this));
|
| + this.button_.addEventListener('wheel', this.onWheel_.bind(this));
|
| window.addEventListener('mouseup', this.onMouseUp_.bind(this));
|
| window.addEventListener('mousemove', this.onMouseMove_.bind(this));
|
| };
|
| @@ -86,6 +87,27 @@ ScrollBar.prototype.attachToView = function(view) {
|
| };
|
|
|
| /**
|
| + * Handles scroll by a mouse wheel.
|
| + *
|
| + * @param {Event} event Mouse event.
|
| + * @private
|
| + */
|
| +ScrollBar.prototype.onWheel_ = function(event) {
|
| + var scrollPosition = this.view_.scrollTop + event.deltaY;
|
| + // Ensure the scrollbar is in the view.
|
| + var scrollBottom =
|
| + Math.max(this.view_.scrollHeight - this.view_.clientHeight, 0);
|
| + scrollPosition = Math.max(Math.min(scrollPosition, scrollBottom), 0);
|
| +
|
| + // TODO(yamaguchi): Invoke native scroll instead of setting scrollTop.
|
| + // This implementation will bypass the smooth scroll animation seen with
|
| + // native scroll.
|
| + this.scrollTop_ = scrollPosition;
|
| + this.view_.scrollTop = scrollPosition;
|
| + this.redraw_();
|
| +}
|
| +
|
| +/**
|
| * Scroll handler.
|
| * @private
|
| */
|
|
|