OpenLayers OpenLayers

Changeset 3998

Show
Ignore:
Timestamp:
08/23/07 13:16:00 (1 year ago)
Author:
tschaub
Message:

#915 geometry manipulations need to call clearBounds

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Geometry/Point.js

    r3984 r3998  
    129129        this.x = this.x + x; 
    130130        this.y = this.y + y; 
     131        this.clearBounds(); 
    131132    }, 
    132133 
     
    145146        this.x = origin.x + (radius * Math.cos(theta)); 
    146147        this.y = origin.y + (radius * Math.sin(theta)); 
     148        this.clearBounds(); 
    147149    }, 
    148150 
     
    161163    resize: function(scale, origin) { 
    162164        this.x = origin.x + (scale * (this.x - origin.x)); 
     165         
    163166        this.y = origin.y + (scale * (this.y - origin.y)); 
     167        this.clearBounds(); 
    164168    }, 
    165169 
  • trunk/openlayers/tests/Geometry/test_Point.html

    r3991 r3998  
    6666     
    6767    function test_06_Point_move(t) { 
    68         t.plan(2); 
     68        t.plan(3); 
    6969         
    7070        var x = 10; 
     
    7777        t.eq(point.x, x + dx, "move() correctly modifies x"); 
    7878        t.eq(point.y, y + dy, "move() correctly modifies y"); 
     79         
     80        t.ok(point.bounds == null, "bounds is cleared after a move()"); 
    7981    } 
    8082 
    8183    function test_Point_rotate(t) { 
    82         t.plan(4); 
     84        t.plan(5); 
    8385         
    8486        var tolerance = 1e-10; 
     
    9395             "rotate by 2 * Math.PI returns to the same y"); 
    9496        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()"); 
    96100         
    97101        // rotate an 1/8 turn 
     
    100104             "rotate 1/8 turn correctly"); 
    101105        t.ok(((point.y - 20.606601717798213) / 20.606601717798213) < tolerance, 
    102              "rotate 1/8 turn correctly") 
     106             "rotate 1/8 turn correctly"); 
    103107    } 
    104108 
    105109    function test_Point_resize(t) { 
    106         t.plan(2); 
     110        t.plan(3); 
    107111         
    108112        var tolerance = 1e-10; 
     
    110114        var y = 100 * Math.random(); 
    111115        var point = new OpenLayers.Geometry.Point(x, y); 
     116        var bounds = point.getBounds(); 
    112117         
    113118        var i = 100 * Math.random(); 
     
    124129             "resize leaves the origin untouched"); 
    125130        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         
    127135    } 
    128136