Index: samples-dev/swarm/swarm_ui_lib/touch/FxUtil.dart |
diff --git a/samples-dev/swarm/swarm_ui_lib/touch/FxUtil.dart b/samples-dev/swarm/swarm_ui_lib/touch/FxUtil.dart |
index 82d0a54f41010c63e3a118fb3254ae17ffe2a045..aa084e88adb901956bb3af5ae494fa0115bc6f7c 100644 |
--- a/samples-dev/swarm/swarm_ui_lib/touch/FxUtil.dart |
+++ b/samples-dev/swarm/swarm_ui_lib/touch/FxUtil.dart |
@@ -68,11 +68,18 @@ class FxUtil { |
*/ |
static Coordinate computeRelativePosition(Element element, Element target) { |
final testPoint = new Point(0, 0); |
+ /* |
final pagePoint = |
window.convertPointFromNodeToPage(element, testPoint); |
final pointRelativeToTarget = |
window.convertPointFromPageToNode(target, pagePoint); |
return new Coordinate(pointRelativeToTarget.x, pointRelativeToTarget.y); |
+ */ |
+ // TODO(sra): Test this version that avoids the nonstandard |
+ // `convertPointFromPageToNode`. |
+ var eRect = element.getBoundingClientRect(); |
+ var tRect = target.getBoundingClientRect(); |
+ return new Coordinate(eRect.left - tRect.left, eRect.top - tRect.top); |
} |
/** Clear a -webkit-transform from an element. */ |