Changeset 5910
- Timestamp:
- 01/27/08 09:44:16 (1 year ago)
- Files:
-
- trunk/openlayers/examples/panel.html (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Control.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Control/Panel.js (modified) (1 diff)
- trunk/openlayers/tests/Control/test_Panel.html (modified) (1 diff)
- trunk/openlayers/tests/test_Control.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/examples/panel.html
r5362 r5910 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); trunk/openlayers/lib/OpenLayers/Control.js
r5614 r5910 85 85 */ 86 86 displayClass: "", 87 88 /** 89 * Property: title 90 * {string} This property is used for showing a tooltip over the 91 * Control. 92 */ 93 title: "", 87 94 88 95 /** … … 173 180 this.div = OpenLayers.Util.createDiv(this.id); 174 181 this.div.className = this.displayClass; 182 if (this.title != "") { 183 this.div.title = this.title; 184 } 175 185 } 176 186 if (px != null) { trunk/openlayers/lib/OpenLayers/Control/Panel.js
r5631 r5910 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])); trunk/openlayers/tests/Control/test_Panel.html
r5532 r5910 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 trunk/openlayers/tests/test_Control.html
r4676 r5910 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);
