Ticket #494: popup_calcRelPos.2.patch
| File popup_calcRelPos.2.patch, 3.4 kB (added by euzuro, 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 31 31 <li>test_Marker.html</li> 32 32 <li>Marker/test_Box.html</li> 33 33 <li>test_Popup.html</li> 34 <li>Popup/test_Anchored.html</li> 34 35 <li>test_Feature.html</li> 35 36 <li>Feature/test_Vector.html</li> 36 37 <li>test_Events.html</li> -
lib/OpenLayers/Popup/AnchoredBubble.js
old new 52 52 53 53 this.setContentHTML(); 54 54 55 this.setRicoCorners(!this.rounded);56 this.rounded = true;57 58 55 //set the popup color and opacity 59 56 this.setBackgroundColor(); 60 57 this.setOpacity(); … … 63 60 }, 64 61 65 62 /** 63 * Method: moveTo 64 * The popup may have been moved to a new relative location, in which case 65 * we will want to re-do the rico corners. 66 * 67 * Parameters: 68 * px - {<OpenLayers.Pixel>} 69 */ 70 moveTo: function(px) { 71 OpenLayers.Popup.Anchored.prototype.moveTo.apply(this, arguments); 72 this.setRicoCorners(!this.rounded); 73 this.rounded = true; 74 }, 75 76 /** 66 77 * APIMethod: setSize 67 78 * 68 79 * Parameters: -
lib/OpenLayers/Popup/Anchored.js
old new 91 91 92 92 /** 93 93 * Method: moveTo 94 * Since the popup is moving to a new px, it might need also to be moved 95 * relative to where the marker is. 94 96 * 95 97 * Parameters: 96 98 * px - {<OpenLayers.Pixel>} 97 99 */ 98 100 moveTo: function(px) { 101 this.relativePosition = this.calculateRelativePosition(px); 99 102 var newPx = this.calculateNewPx(px); 100 103 101 104 var newArguments = new Array(newPx);
