Ticket #822: 822.patch
| File 822.patch, 4.8 kB (added by penyaskito, 1 year ago) |
|---|
-
examples/panel.html
old new 60 60 var map, layer; 61 61 62 62 function init(){ 63 map = new OpenLayers.Map( 'map', { controls: [] } );63 map = new OpenLayers.Map( 'map', { controls: [], 'fallThrough':true } ); 64 64 layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 65 65 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 66 66 map.addLayer(layer); … … 69 69 map.addLayer(vlayer); 70 70 71 71 72 zb = new OpenLayers.Control.ZoomBox(); 72 zb = new OpenLayers.Control.ZoomBox( 73 {title:"Zoom box: Selecting it you can zoom on an area by clicking and dragging."}); 73 74 var panel = new OpenLayers.Control.Panel({defaultControl: zb}); 74 75 panel.addControls([ 75 new OpenLayers.Control.MouseDefaults(), 76 new OpenLayers.Control.MouseDefaults( 77 {title:'You can use the default mouse configuration'}), 76 78 zb, 77 new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path), 78 new OpenLayers.Control.ZoomToMaxExtent() 79 new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path, 80 {title:'Draw a feature'}), 81 new OpenLayers.Control.ZoomToMaxExtent({title:"Zoom to the max extent"}) 79 82 ]); 80 83 map.addControl(panel); 81 84 -
lib/OpenLayers/Control.js
old new 84 84 * Control. 85 85 */ 86 86 displayClass: "", 87 87 /** 88 * Property: title 89 * {string} This property is used for showing a tooltip over the 90 * Control. 91 */ 92 title: "", 88 93 /** 89 94 * Property: active 90 95 * {boolean} null … … 172 177 if (this.div == null) { 173 178 this.div = OpenLayers.Util.createDiv(this.id); 174 179 this.div.className = this.displayClass; 180 if (this.title != "") { 181 this.div.title = this.title; 182 } 175 183 } 176 184 if (px != null) { 177 185 this.position = px.clone(); -
lib/OpenLayers/Control/Panel.js
old new 172 172 var element = document.createElement("div"); 173 173 var textNode = document.createTextNode(" "); 174 174 controls[i].panel_div = element; 175 if (controls[i].title != "") { 176 controls[i].panel_div.title = controls[i].title; 177 } 175 178 OpenLayers.Event.observe(controls[i].panel_div, "click", 176 179 OpenLayers.Function.bind(this.onClick, this, controls[i])); 177 180 OpenLayers.Event.observe(controls[i].panel_div, "mousedown", -
tests/Control/test_Panel.html
old new 46 46 t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active, 47 47 "activated the other tool control, the first one is inactive and the toggle control still active."); 48 48 } 49 49 function test_02_Control_Panel_titles (t) { 50 t.plan(2); 51 var panel = new OpenLayers.Control.Panel(); 52 var toolControl = new OpenLayers.Control.ZoomBox({ 53 title:"Zoom box: Selecting it you can zoom on an area by clicking and dragging." 54 }); 55 panel.addControls([toolControl]); 56 t.eq(panel.controls.length, 1, "added a control to the panel"); 57 t.eq(panel.controls[0].title, toolControl.panel_div.title, "the title is correctly set"); 58 } 59 50 60 function test_Control_Panel_getBy(t) { 51 61 52 62 var panel = { -
tests/test_Control.html
old new 21 21 t.ok(control.map === map, "Control.map is set to the map object" ); 22 22 t.ok(map.controls[map.controls.length - 1] === control, "map.controls contains control"); 23 23 } 24 24 25 function test_Control_title(t) { 26 t.plan( 1 ); 27 var titleText = 'Title test'; 28 control = new OpenLayers.Control({title:titleText}); 29 t.eq( control.title, titleText, "control.title set correctly" ); 30 } 31 25 32 function test_Control_destroy(t) { 26 33 t.plan(3); 27 34
