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

Side by Side Diff: samples/swarm/swarm_ui_lib/view/SliderMenu.dart

Issue 27441002: Removing setImmediate and hiding WindowTimers interface (take 2) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: The fix Created 7 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
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 view; 5 part of view;
6 6
7 typedef void SelectHandler(String menuText); 7 typedef void SelectHandler(String menuText);
8 8
9 /** 9 /**
10 * This implements a horizontal menu bar with a sliding triangle arrow 10 * This implements a horizontal menu bar with a sliding triangle arrow
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 selectItem(result, animate); 150 selectItem(result, animate);
151 } 151 }
152 } 152 }
153 153
154 /** 154 /**
155 * animate - if true, then animate the movement of the triangle slider 155 * animate - if true, then animate the movement of the triangle slider
156 */ 156 */
157 void updateIndicator(bool animate) { 157 void updateIndicator(bool animate) {
158 if (selectedItem != null) { 158 if (selectedItem != null) {
159 // calculate where we want to put the triangle 159 // calculate where we want to put the triangle
160 window.setImmediate(() { 160 scheduleMicrotask(() {
161 num x = selectedItem.offset.left + 161 num x = selectedItem.offset.left +
162 selectedItem.offset.width / 2 - TRIANGLE_WIDTH / 2; 162 selectedItem.offset.width / 2 - TRIANGLE_WIDTH / 2;
163 _moveIndicator(x, animate); 163 _moveIndicator(x, animate);
164 }); 164 });
165 } else { 165 } else {
166 _moveIndicator(0, animate); 166 _moveIndicator(0, animate);
167 } 167 }
168 } 168 }
169 169
170 void _moveIndicator(num x, bool animate) { 170 void _moveIndicator(num x, bool animate) {
171 // find the slider filler (the div element to the left of the 171 // find the slider filler (the div element to the left of the
172 // triangle) set its width the push the triangle to where we want it. 172 // triangle) set its width the push the triangle to where we want it.
173 String duration = animate ? '.3s' : '0s'; 173 String duration = animate ? '.3s' : '0s';
174 final triangle = node.query('.sm-triangle'); 174 final triangle = node.query('.sm-triangle');
175 triangle.style.transitionDuration = duration; 175 triangle.style.transitionDuration = duration;
176 FxUtil.setWebkitTransform(triangle, x, 0); 176 FxUtil.setWebkitTransform(triangle, x, 0);
177 } 177 }
178 } 178 }
OLDNEW
« no previous file with comments | « samples/swarm/swarm_ui_lib/view/PagedViews.dart ('k') | samples/swarm/swarm_ui_lib/view/view.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698