Index: samples/dartcombat/views.dart |
diff --git a/samples/dartcombat/views.dart b/samples/dartcombat/views.dart |
index 691d34163f8f12b9389181008b9c2c7bc631dd05..f0c1d4be5fddb34565e1bb04edf17040aa1536ec 100644 |
--- a/samples/dartcombat/views.dart |
+++ b/samples/dartcombat/views.dart |
@@ -279,9 +279,9 @@ class ViewUtil { |
/** Extract the position of a mouse event in a containing 500x500 grid. */ |
static Future<List<int>> positionFromEvent(Element gridNode, MouseEvent e) { |
final completer = new Completer<List<int>>(); |
- gridNode.rect.then((ElementRect rect) { |
- int x = (e.pageX - rect.offset.left) ~/ 50; |
- int y = (e.pageY - rect.offset.top) ~/ 50; |
+ window.requestLayoutFrame(() { |
+ int x = (e.pageX - gridNode.offsetLeft) ~/ 50; |
+ int y = (e.pageY - gridNode.offsetTop) ~/ 50; |
completer.complete([x, y]); |
}); |
return completer.future; |