Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(998)

Unified Diff: samples/swarm/swarm_ui_lib/touch/Scrollbar.dart

Issue 12253011: Reapply remove setInterval. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/swarm/swarm_ui_lib/base/base.dart ('k') | samples/swarm/swarm_ui_lib/view/ConveyorView.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/swarm/swarm_ui_lib/touch/Scrollbar.dart
diff --git a/samples/swarm/swarm_ui_lib/touch/Scrollbar.dart b/samples/swarm/swarm_ui_lib/touch/Scrollbar.dart
index de8d13c579efed4a873f3123847c2dda8902e98f..ac6a8755ab9aa2a16a13ced0af005b502dff4c4e 100644
--- a/samples/swarm/swarm_ui_lib/touch/Scrollbar.dart
+++ b/samples/swarm/swarm_ui_lib/touch/Scrollbar.dart
@@ -52,7 +52,7 @@ class Scrollbar implements ScrollListener {
num _currentScrollStartOffset;
bool _currentScrollVertical;
num _currentScrollRatio;
- num _timerId;
+ Timer _timer;
bool _displayOnHover;
bool _hovering = false;
@@ -148,7 +148,7 @@ class Scrollbar implements ScrollListener {
// Start hiding immediately if we aren't
// scrolling or already in the process of
// hidng the scrollbar
- if (!_scrollInProgress && _timerId == null) {
+ if (!_scrollInProgress && _timer == null) {
_boundHideFn();
}
});
@@ -232,7 +232,8 @@ class Scrollbar implements ScrollListener {
*/
void _onScrollerEnd(Event e) {
_cancelTimeout();
- _timerId = window.setTimeout(_boundHideFn, _DISPLAY_TIME);
+ _timer = new Timer(const Duration(milliseconds: _DISPLAY_TIME),
+ _boundHideFn);
_scrollInProgress = false;
}
void onScrollerMoved(num scrollX, num scrollY, bool decelerating) {
@@ -281,9 +282,9 @@ class Scrollbar implements ScrollListener {
}
void _cancelTimeout() {
- if (_timerId != null) {
- window.clearTimeout(_timerId);
- _timerId = null;
+ if (_timer != null) {
+ _timer.cancel();
+ _timer = null;
}
}
« no previous file with comments | « samples/swarm/swarm_ui_lib/base/base.dart ('k') | samples/swarm/swarm_ui_lib/view/ConveyorView.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698