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

Unified Diff: client/view/SliderMenu.dart

Issue 9148015: Example showing alternate async measurement solution (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final version Created 8 years, 11 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 c10cb2ffe6d6fa9f8245433bc10d65966cc352fb..4901eef1ccbca3a31858f9c73cfa695659da3176 100644
--- a/client/view/SliderMenu.dart
+++ b/client/view/SliderMenu.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, 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.
@@ -155,10 +155,10 @@ class SliderMenu extends View {
void updateIndicator(bool animate) {
if (selectedItem != null) {
// calculate where we want to put the triangle
- selectedItem.rect.then((ElementRect rect) {
- num x = rect.offset.left +
- rect.offset.width / 2 - TRIANGLE_WIDTH / 2;
- _moveIndicator(x, animate);
+ window.requestMeasurementFrame(() {
+ final offsetRect = selectedItem.rect.offset;
+ num x = offsetRect.left + offsetRect.width / 2 - TRIANGLE_WIDTH / 2;
+ return () { _moveIndicator(x, animate); };
});
} else {
_moveIndicator(0, animate);

Powered by Google App Engine
This is Rietveld 408576698