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

Unified Diff: client/touch/ScrollWatcher.dart

Issue 9382027: Move client/{base, observable, layout, touch, util, view} to samples/ui_lib . (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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 | « client/touch/Momentum.dart ('k') | client/touch/Scrollbar.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/touch/ScrollWatcher.dart
===================================================================
--- client/touch/ScrollWatcher.dart (revision 4144)
+++ client/touch/ScrollWatcher.dart (working copy)
@@ -1,63 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-interface ScrollListener {
- /**
- * The callback invoked for a scroll event.
- * [decelerating] specifies whether or not the content is moving due
- * to deceleration. It should be false if the content is moving because the
- * user is dragging the content.
- */
- void onScrollerMoved(double scrollX, double scrollY, bool decelerating);
-}
-
-/**
- * The scroll watcher is intended to provide a single way to
- * listen for scroll events from instances of Scroller.
- * TODO(jacobr): this class is obsolete.
- */
-class ScrollWatcher {
- Scroller _scroller;
-
- List<ScrollListener> _listeners;
-
- Element _scrollerEl;
-
- ScrollWatcher(Scroller scroller)
- : _scroller = scroller, _listeners = new List<ScrollListener>() {
- }
-
- void addListener(ScrollListener listener) {
- _listeners.add(listener);
- }
-
- /**
- * Send the scroll event to all listeners.
- * [decelerating] is true if the offset is changing because of deceleration.
- */
- void _dispatchScroll(num scrollX, num scrollY,
- [bool decelerating = false]) {
- for (final listener in _listeners) {
- listener.onScrollerMoved(scrollX, scrollY, decelerating);
- }
- }
-
- /**
- * Initializes elements and event handlers. Must be called after construction
- * and before usage.
- */
- void initialize() {
- _scrollerEl = _scroller.getElement();
- _scroller.onContentMoved.add((e) { _onContentMoved(e); });
- }
-
- /**
- * This callback is invoked any time the scroller content offset changes.
- */
- void _onContentMoved(Event e) {
- num scrollX = _scroller.getHorizontalOffset();
- num scrollY = _scroller.getVerticalOffset();
- _dispatchScroll(scrollX, scrollY);
- }
-}
« no previous file with comments | « client/touch/Momentum.dart ('k') | client/touch/Scrollbar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698