OpenLayers OpenLayers

Ticket #494: popup_calcRelPos.patch

File popup_calcRelPos.patch, 2.7 kB (added by crschmidt, 1 year ago)
  • tests/Popup/test_Anchored.html

    old new  
     1<html> 
     2<head> 
     3  <script src="../../lib/OpenLayers.js"></script> 
     4  <script type="text/javascript"> 
     5 
     6    var popup; 
     7 
     8    function test_01_Popup_Anchored_default_constructor(t) { 
     9        t.plan( 4 ); 
     10 
     11        popup = new OpenLayers.Popup.Anchored(); 
     12 
     13        t.ok( popup instanceof OpenLayers.Popup.Anchored, "new OpenLayers.Popup.Anchored returns Popup.Anchored object" ); 
     14        t.ok(popup.id.startsWith("OpenLayers.Popup.Anchored"), "valid default popupid"); 
     15        var firstID = popup.id; 
     16        t.eq(popup.contentHTML, "", "good default popup.contentHTML"); 
     17 
     18         
     19        popup = new OpenLayers.Popup.Anchored(); 
     20        var newID = popup.id; 
     21        t.ok(newID != firstID, "default id generator creating unique ids"); 
     22    } 
     23    function test_Popup_Anchored_updateRelPos(t) {  
     24        t.plan(1); 
     25        var popup = new OpenLayers.Popup.Anchored(); 
     26        popup.calculateNewPx = function () {} 
     27        popup.calculateRelativePosition = function() { 
     28            t.ok(true, "update relative position is called on moveTo"); 
     29        } 
     30        popup.moveTo(new OpenLayers.Pixel(0,0)); 
     31   }  
     32 
     33  </script> 
     34</head> 
     35<body> 
     36</body> 
     37</html> 
  • tests/list-tests.html

    old new  
    3131    <li>test_Marker.html</li> 
    3232    <li>Marker/test_Box.html</li> 
    3333    <li>test_Popup.html</li> 
     34    <li>Popup/test_Anchored.html</li> 
    3435    <li>test_Feature.html</li> 
    3536    <li>Feature/test_Vector.html</li> 
    3637    <li>test_Events.html</li> 
  • lib/OpenLayers/Popup/AnchoredBubble.js

    old new  
    6161        return this.div; 
    6262    }, 
    6363 
     64    moveTo: function(px) { 
     65        OpenLayers.Popup.Anchored.prototype.moveTo.apply(this, arguments); 
     66        this.setRicoCorners(!this.rounded); 
     67        this.rounded = true; 
     68    }, 
     69 
    6470    /** 
    6571     * APIMethod: setSize 
    6672     *  
  • lib/OpenLayers/Popup/Anchored.js

    old new  
    9999    */ 
    100100    moveTo: function(px) { 
    101101         
     102        this.relativePosition = this.calculateRelativePosition(px); 
    102103        var newPx = this.calculateNewPx(px); 
    103104         
    104105        var newArguments = new Array(newPx);