Changeset 847
- Timestamp:
- 06/30/06 22:41:21 (2 years ago)
- Files:
-
- trunk/openlayers/examples/controls.html (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Control/Permalink.js (modified) (2 diffs)
- trunk/openlayers/tests/test_Control_Permalink.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/examples/controls.html
r846 r847 35 35 map.addControl(new OpenLayers.Control.MouseToolbar()); 36 36 map.addControl(new OpenLayers.Control.LayerSwitcher()); 37 map.addControl(new OpenLayers.Control.Permalink()); 37 38 map.addControl(new OpenLayers.Control.Permalink($('permalink'))); 38 // map.setCenter(new OpenLayers.LonLat(0, 0), 0);39 39 if (!map.getCenter()) map.zoomToMaxExtent(); 40 40 } … … 44 44 <body onload="init()"> 45 45 <h1>OpenLayers Example</h1> 46 <a href="" id="permalink">Permalink</a><br />46 <a style="float:right" href="" id="permalink">Permalink</a> 47 47 <div id="map"></div> 48 48 </body> trunk/openlayers/lib/OpenLayers/Control/Permalink.js
r846 r847 18 18 19 19 draw: function() { 20 this.map.events.register( 'moveend', this, this.updateLink);20 OpenLayers.Control.prototype.draw.apply(this, arguments); 21 21 var args = this.getArgs(); 22 22 if (args.lat && args.lon) { … … 28 28 this.map.zoomTo(parseInt(args.zoom)); 29 29 } 30 if (!this.element) { 31 this.element = document.createElement("a"); 32 this.div.style.right = "3px"; 33 this.div.style.bottom = "3px"; 34 this.div.style.left = ""; 35 this.div.style.top = ""; 36 this.div.style.display = "block"; 37 this.div.style.position = "absolute"; 38 this.element.style.fontSize="smaller"; 39 this.element.innerHTML = "Permalink"; 40 this.element.href=""; 41 this.div.appendChild(this.element); 42 } 43 this.map.events.register( 'moveend', this, this.updateLink); 44 return this.div; 30 45 }, 31 46 trunk/openlayers/tests/test_Control_Permalink.html
r846 r847 37 37 t.eq($('permalink').href, $('edit_permalink').href, "Panning sets permalink with base"); 38 38 } 39 function test_03_Control_Permalink_noElement (t) { 40 t.plan( 2 ); 41 control = new OpenLayers.Control.Permalink( ); 42 t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" ); 43 map = new OpenLayers.Map($('map')); 44 map.addControl(control); 45 t.eq(map.controls[2].div.firstChild.nodeName, "A", "Permalink control creates div with 'a' inside." ); 46 } 39 47 // --> 40 48 </script>
