Ticket #1031: icon.seturl.patch
| File icon.seturl.patch, 2.3 kB (added by crschmidt, 1 year ago) |
|---|
-
tests/test_Marker.html
old new 73 73 t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works"); 74 74 map.destroy(); 75 75 } 76 77 function test_03_Marker_setUrl(t) { 78 t.plan( 2 ); 79 80 var map = new OpenLayers.Map("map"); 76 81 82 var url = "http://octo.metacarta.com/cgi-bin/mapserv"; 83 layer = new OpenLayers.Layer.WMS(name, url); 84 85 map.addLayer(layer); 86 87 mlayer = new OpenLayers.Layer.Markers('Test Layer'); 88 map.addLayer(mlayer); 89 90 map.zoomToExtent(new OpenLayers.Bounds(-50,-50,50,50)); 91 92 //onscreen marker 93 var ll = new OpenLayers.LonLat(0,0); 94 var marker = new OpenLayers.Marker(ll); 95 mlayer.addMarker(marker); 96 97 t.ok(marker.icon.imageDiv.firstChild.src.contains("img/marker.png"), "Marker.png is default URL"); 98 99 marker.setUrl("http://example.com/broken.png"); 100 t.eq(marker.icon.imageDiv.firstChild.src, "http://example.com/broken.png", "image source changes correctly."); 101 102 map.destroy(); 103 } 104 77 105 function test_04_Marker_moveTo(t) { 78 106 t.plan( 6 ); 79 107 -
lib/OpenLayers/Marker.js
old new 171 171 this.icon.setOpacity(opacity); 172 172 }, 173 173 174 /** 175 * Method: setUrl 176 * Change URL of the Icon Image. 177 * 178 * url - {String} 179 */ 180 setUrl: function(url) { 181 this.icon.setUrl(url); 182 }, 183 174 184 /** 175 185 * Method: display 176 186 * Hide or show the icon -
lib/OpenLayers/Icon.js
old new 106 106 } 107 107 this.draw(); 108 108 }, 109 110 /** 111 * Method: setUrl 112 * 113 * url - {String} 114 */ 115 setUrl: function(url) { 116 if (url != null) { 117 this.url = url; 118 } 119 this.draw(); 120 }, 109 121 110 122 /** 111 123 * Method: draw
