OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Implementation of a scrollbar for the custom scrolling behavior | 6 * Implementation of a scrollbar for the custom scrolling behavior |
7 * defined in [:Scroller:]. | 7 * defined in [:Scroller:]. |
8 */ | 8 */ |
9 class Scrollbar implements ScrollListener { | 9 class Scrollbar implements ScrollListener { |
10 /** | 10 /** |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bool _hovering = false; | 56 bool _hovering = false; |
57 | 57 |
58 Scrollbar(Scroller scroller, [displayOnHover = true]) : | 58 Scrollbar(Scroller scroller, [displayOnHover = true]) : |
59 _displayOnHover = displayOnHover, | 59 _displayOnHover = displayOnHover, |
60 _scroller = scroller, | 60 _scroller = scroller, |
61 _frame = scroller.getFrame(), | 61 _frame = scroller.getFrame(), |
62 _cachedSize = new Map<String, num>() { | 62 _cachedSize = new Map<String, num>() { |
63 _boundHideFn = () { _showScrollbars(false); }; | 63 _boundHideFn = () { _showScrollbars(false); }; |
64 } | 64 } |
65 | 65 |
66 bool get _scrollBarDragInProgress() => _scrollBarDragInProgressValue; | 66 bool get _scrollBarDragInProgress => _scrollBarDragInProgressValue; |
67 | 67 |
68 void set _scrollBarDragInProgress(bool value) { | 68 void set _scrollBarDragInProgress(bool value) { |
69 _scrollBarDragInProgressValue = value; | 69 _scrollBarDragInProgressValue = value; |
70 _toggleClass(_verticalElement, DRAG_CLASS_NAME, | 70 _toggleClass(_verticalElement, DRAG_CLASS_NAME, |
71 value && _currentScrollVertical); | 71 value && _currentScrollVertical); |
72 _toggleClass(_horizontalElement, DRAG_CLASS_NAME, | 72 _toggleClass(_horizontalElement, DRAG_CLASS_NAME, |
73 value && !_currentScrollVertical); | 73 value && !_currentScrollVertical); |
74 } | 74 } |
75 | 75 |
76 // TODO(jacobr): move this helper method into the DOM. | 76 // TODO(jacobr): move this helper method into the DOM. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 style.setProperty(cssPos, '${pos}px', ''); | 343 style.setProperty(cssPos, '${pos}px', ''); |
344 if (_cachedSize[cssSize] != size) { | 344 if (_cachedSize[cssSize] != size) { |
345 _cachedSize[cssSize] = size; | 345 _cachedSize[cssSize] = size; |
346 style.setProperty(cssSize, '${size}px', ''); | 346 style.setProperty(cssSize, '${size}px', ''); |
347 } | 347 } |
348 if (element.parent == null) { | 348 if (element.parent == null) { |
349 _frame.nodes.add(element); | 349 _frame.nodes.add(element); |
350 } | 350 } |
351 } | 351 } |
352 } | 352 } |
OLD | NEW |