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

Side by Side Diff: samples/swarm/swarm_ui_lib/touch/Scrollbar.dart

Issue 12493003: Exposing Point & Rect types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sync to ToT Created 7 years, 9 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
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 part of touch; 5 part of touch;
6 6
7 /** 7 /**
8 * Implementation of a scrollbar for the custom scrolling behavior 8 * Implementation of a scrollbar for the custom scrolling behavior
9 * defined in [:Scroller:]. 9 * defined in [:Scroller:].
10 */ 10 */
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 }); 154 });
155 } 155 }
156 } 156 }
157 157
158 void _onStart(UIEvent e) { 158 void _onStart(UIEvent e) {
159 Element elementOver = e.target; 159 Element elementOver = e.target;
160 if (elementOver == _verticalElement || 160 if (elementOver == _verticalElement ||
161 elementOver == _horizontalElement) { 161 elementOver == _horizontalElement) {
162 _currentScrollVertical = elementOver == _verticalElement; 162 _currentScrollVertical = elementOver == _verticalElement;
163 if (_currentScrollVertical) { 163 if (_currentScrollVertical) {
164 _currentScrollStartMouse = e.pageY; 164 _currentScrollStartMouse = e.page.y;
165 _currentScrollStartOffset = _scroller.getVerticalOffset(); 165 _currentScrollStartOffset = _scroller.getVerticalOffset();
166 } else { 166 } else {
167 _currentScrollStartMouse = e.pageX; 167 _currentScrollStartMouse = e.page.x;
168 _currentScrollStartOffset = _scroller.getHorizontalOffset(); 168 _currentScrollStartOffset = _scroller.getHorizontalOffset();
169 } 169 }
170 _refreshScrollRatio(); 170 _refreshScrollRatio();
171 _scrollBarDragInProgress = true; 171 _scrollBarDragInProgress = true;
172 _scroller._momentum.abort(); 172 _scroller._momentum.abort();
173 e.stopPropagation(); 173 e.stopPropagation();
174 } 174 }
175 } 175 }
176 176
177 void _refreshScrollRatio() { 177 void _refreshScrollRatio() {
(...skipping 16 matching lines...) Expand all
194 } else { 194 } else {
195 _currentScrollRatio = (contentSize - frameSize) / frameTravelDistance; 195 _currentScrollRatio = (contentSize - frameSize) / frameTravelDistance;
196 } 196 }
197 } 197 }
198 198
199 void _onMove(UIEvent e) { 199 void _onMove(UIEvent e) {
200 if (!_scrollBarDragInProgress) { 200 if (!_scrollBarDragInProgress) {
201 return; 201 return;
202 } 202 }
203 _refreshScrollRatio(); 203 _refreshScrollRatio();
204 int coordinate = _currentScrollVertical ? e.pageY : e.pageX; 204 int coordinate = _currentScrollVertical ? e.page.y : e.page.x;
205 num delta = (coordinate - _currentScrollStartMouse) * _currentScrollRatio; 205 num delta = (coordinate - _currentScrollStartMouse) * _currentScrollRatio;
206 if (delta != 0) { 206 if (delta != 0) {
207 num x; 207 num x;
208 num y; 208 num y;
209 _currentScrollStartOffset -= delta; 209 _currentScrollStartOffset -= delta;
210 if (_currentScrollVertical) { 210 if (_currentScrollVertical) {
211 x = _scroller.getHorizontalOffset(); 211 x = _scroller.getHorizontalOffset();
212 y = _currentScrollStartOffset.toInt(); 212 y = _currentScrollStartOffset.toInt();
213 } else { 213 } else {
214 x = _currentScrollStartOffset.toInt(); 214 x = _currentScrollStartOffset.toInt();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 style.setProperty(cssPos, '${pos}px', ''); 346 style.setProperty(cssPos, '${pos}px', '');
347 if (_cachedSize[cssSize] != size) { 347 if (_cachedSize[cssSize] != size) {
348 _cachedSize[cssSize] = size; 348 _cachedSize[cssSize] = size;
349 style.setProperty(cssSize, '${size}px', ''); 349 style.setProperty(cssSize, '${size}px', '');
350 } 350 }
351 if (element.parent == null) { 351 if (element.parent == null) {
352 _frame.nodes.add(element); 352 _frame.nodes.add(element);
353 } 353 }
354 } 354 }
355 } 355 }
OLDNEW
« no previous file with comments | « samples/swarm/swarm_ui_lib/touch/Geometry.dart ('k') | samples/swarm/swarm_ui_lib/touch/TouchHandler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698