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

Side by Side Diff: samples/ui_lib/touch/Scroller.dart

Issue 10969073: Fixing up WheelEvent to follow W3C standards and work on all platforms. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporating review feedback Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/html/templates/html/interface/interface_WheelEvent.darttemplate ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 custom scrolling behavior. 6 * Implementation of a custom scrolling behavior.
7 * This behavior overrides native scrolling for an area. This area can be a 7 * This behavior overrides native scrolling for an area. This area can be a
8 * single defined part of a page, the entire page, or several different parts 8 * single defined part of a page, the entire page, or several different parts
9 * of a page. 9 * of a page.
10 * 10 *
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 _touchHandler = new TouchHandler(this, scrollableElem.parent); 154 _touchHandler = new TouchHandler(this, scrollableElem.parent);
155 _momentum = new Momentum(this, defaultDecelerationFactor); 155 _momentum = new Momentum(this, defaultDecelerationFactor);
156 156
157 Element parentElem = scrollableElem.parent; 157 Element parentElem = scrollableElem.parent;
158 assert(parentElem != null); 158 assert(parentElem != null);
159 _setOffsetFunction = _getOffsetFunction(_scrollTechnique); 159 _setOffsetFunction = _getOffsetFunction(_scrollTechnique);
160 _touchHandler.setDraggable(this); 160 _touchHandler.setDraggable(this);
161 _touchHandler.enable(capture); 161 _touchHandler.enable(capture);
162 162
163 _frame.on.mouseWheel.add((e) { 163 _frame.on.mouseWheel.add((e) {
164 if (e.wheelDeltaY != 0 && verticalEnabled || 164 if (e.deltaY != 0 && verticalEnabled ||
165 e.wheelDeltaX != 0 && horizontalEnabled) { 165 e.deltaX != 0 && horizontalEnabled) {
166 num x = horizontalEnabled ? e.wheelDeltaX : 0; 166 num x = horizontalEnabled ? e.deltaX : 0;
167 num y = verticalEnabled ? e.wheelDeltaY : 0; 167 num y = verticalEnabled ? e.deltaY : 0;
168 throwDelta(x, y, FAST_SNAP_DECELERATION_FACTOR); 168 throwDelta(x, y, FAST_SNAP_DECELERATION_FACTOR);
169 e.preventDefault(); 169 e.preventDefault();
170 } 170 }
171 }); 171 });
172 172
173 _frame.on.keyDown.add((KeyboardEvent e) { 173 _frame.on.keyDown.add((KeyboardEvent e) {
174 bool handled = false; 174 bool handled = false;
175 // We ignore key events where further scrolling in that direction 175 // We ignore key events where further scrolling in that direction
176 // would have no impact which matches default browser behavior with 176 // would have no impact which matches default browser behavior with
177 // nested scrollable areas. 177 // nested scrollable areas.
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 for (EventListener listener in _listeners) { 722 for (EventListener listener in _listeners) {
723 listener(evt); 723 listener(evt);
724 } 724 }
725 } 725 }
726 } 726 }
727 727
728 class ScrollerScrollTechnique { 728 class ScrollerScrollTechnique {
729 static const TRANSFORM_3D = 1; 729 static const TRANSFORM_3D = 1;
730 static const RELATIVE_POSITIONING = 2; 730 static const RELATIVE_POSITIONING = 2;
731 } 731 }
OLDNEW
« no previous file with comments | « lib/html/templates/html/interface/interface_WheelEvent.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698