| Index: LayoutTests/touchadjustment/resources/touchadjustment.js
|
| ===================================================================
|
| --- LayoutTests/touchadjustment/resources/touchadjustment.js (revision 129420)
|
| +++ LayoutTests/touchadjustment/resources/touchadjustment.js (working copy)
|
| @@ -96,12 +96,15 @@
|
| {
|
| if (!radiusY)
|
| radiusY = radiusX;
|
| - var touchpoint = new Object();
|
| - touchpoint.left = x - radiusX;
|
| - touchpoint.top = y - radiusY;
|
| - touchpoint.width = radiusX * 2;
|
| - touchpoint.height = radiusY * 2;
|
| - return touchpoint;
|
| +
|
| + return {
|
| + left: x - radiusX,
|
| + top: y - radiusY,
|
| + width: radiusX * 2,
|
| + height: radiusY * 2,
|
| + get x() { return this.left + this.width/2; },
|
| + get y() { return this.top + this.height/2; }
|
| + };
|
| }
|
|
|
| function offsetTouchPoint(bounds, relativePosition, touchOffset, touchRadiusX, touchRadiusY)
|
| @@ -109,9 +112,10 @@
|
| if (!touchRadiusY)
|
| touchRadiusY = touchRadiusX;
|
|
|
| - var touchpoint = {left : bounds.left, top: bounds.top };
|
| + // Start with the center of the touch at the top-left of the bounds.
|
| + var touchpoint = touchPoint(bounds.left, bounds.top, touchRadiusX, touchRadiusY);
|
|
|
| - // Set center point for touch.
|
| + // Adjust the touch point as requested.
|
| switch (relativePosition) {
|
| case 'center':
|
| touchpoint.left += bounds.width / 2;
|
| @@ -149,12 +153,6 @@
|
| touchpoint.left += bounds.width / 2;
|
| touchpoint.top += bounds.height + touchOffset;
|
| }
|
| - // Adjust from touch center to top-left corner.
|
| - touchpoint.left -= touchRadiusX;
|
| - touchpoint.top -= touchRadiusY;
|
|
|
| - touchpoint.width = 2 * touchRadiusX;
|
| - touchpoint.height = 2 * touchRadiusY;
|
| -
|
| return touchpoint;
|
| }
|
|
|