Changeset 3998
- Timestamp:
- 08/23/07 13:16:00 (1 year ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Geometry/Point.js (modified) (3 diffs)
- trunk/openlayers/tests/Geometry/test_Point.html (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Geometry/Point.js
r3984 r3998 129 129 this.x = this.x + x; 130 130 this.y = this.y + y; 131 this.clearBounds(); 131 132 }, 132 133 … … 145 146 this.x = origin.x + (radius * Math.cos(theta)); 146 147 this.y = origin.y + (radius * Math.sin(theta)); 148 this.clearBounds(); 147 149 }, 148 150 … … 161 163 resize: function(scale, origin) { 162 164 this.x = origin.x + (scale * (this.x - origin.x)); 165 163 166 this.y = origin.y + (scale * (this.y - origin.y)); 167 this.clearBounds(); 164 168 }, 165 169 trunk/openlayers/tests/Geometry/test_Point.html
r3991 r3998 66 66 67 67 function test_06_Point_move(t) { 68 t.plan( 2);68 t.plan(3); 69 69 70 70 var x = 10; … … 77 77 t.eq(point.x, x + dx, "move() correctly modifies x"); 78 78 t.eq(point.y, y + dy, "move() correctly modifies y"); 79 80 t.ok(point.bounds == null, "bounds is cleared after a move()"); 79 81 } 80 82 81 83 function test_Point_rotate(t) { 82 t.plan( 4);84 t.plan(5); 83 85 84 86 var tolerance = 1e-10; … … 93 95 "rotate by 2 * Math.PI returns to the same y"); 94 96 t.ok(((point.y - y) / y) < tolerance, 95 "rotate by 2 * Math.PI returns to the same y") 97 "rotate by 2 * Math.PI returns to the same y"); 98 99 t.ok(point.bounds == null, "bounds is cleared after a rotate()"); 96 100 97 101 // rotate an 1/8 turn … … 100 104 "rotate 1/8 turn correctly"); 101 105 t.ok(((point.y - 20.606601717798213) / 20.606601717798213) < tolerance, 102 "rotate 1/8 turn correctly") 106 "rotate 1/8 turn correctly"); 103 107 } 104 108 105 109 function test_Point_resize(t) { 106 t.plan( 2);110 t.plan(3); 107 111 108 112 var tolerance = 1e-10; … … 110 114 var y = 100 * Math.random(); 111 115 var point = new OpenLayers.Geometry.Point(x, y); 116 var bounds = point.getBounds(); 112 117 113 118 var i = 100 * Math.random(); … … 124 129 "resize leaves the origin untouched"); 125 130 t.ok((((newDistance / oldDistance) - scale) / scale) < tolerance, 126 "resize moves points the correct distance from the origin") 131 "resize moves points the correct distance from the origin"); 132 133 t.ok(point.bounds == null, "bounds is correctly cleared after a resize()"); 134 127 135 } 128 136
