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

Unified Diff: client/view/SliderMenu.dart

Issue 8363040: Implement measurement using futures (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to all comments Created 9 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 side-by-side diff with in-line comments
Download patch
Index: client/view/SliderMenu.dart
diff --git a/client/view/SliderMenu.dart b/client/view/SliderMenu.dart
index 19f3eb8f311a96ab76fcb93de06b7ede7e80195d..c10cb2ffe6d6fa9f8245433bc10d65966cc352fb 100644
--- a/client/view/SliderMenu.dart
+++ b/client/view/SliderMenu.dart
@@ -153,13 +153,19 @@ class SliderMenu extends View {
* animate - if true, then animate the movement of the triangle slider
*/
void updateIndicator(bool animate) {
- num x = 0;
if (selectedItem != null) {
// calculate where we want to put the triangle
- x = selectedItem.offsetLeft +
- selectedItem.offsetWidth / 2 - TRIANGLE_WIDTH / 2;
+ selectedItem.rect.then((ElementRect rect) {
+ num x = rect.offset.left +
+ rect.offset.width / 2 - TRIANGLE_WIDTH / 2;
+ _moveIndicator(x, animate);
+ });
+ } else {
+ _moveIndicator(0, animate);
}
+ }
+ void _moveIndicator(num x, bool animate) {
// find the slider filler (the div element to the left of the
// triangle) set its width the push the triangle to where we want it.
String duration = animate ? '.3s' : '0s';

Powered by Google App Engine
This is Rietveld 408576698