Add new maximizeTitle and minimizeTitle options to Control.OverviewMap

This commit is contained in:
Frederic Junod
2012-05-21 08:44:38 +02:00
parent 5c42aa6fce
commit c696b34a84
3 changed files with 40 additions and 1 deletions

View File

@@ -80,7 +80,9 @@
// create an overview map control with the default options
var overview1 = new OpenLayers.Control.OverviewMap({
maximized: true
maximized: true,
maximizeTitle: 'Show the overview map',
minimizeTitle: 'Hide the overview map'
});
map1.addControl(overview1);

View File

@@ -127,6 +127,20 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
*/
maximized: false,
/**
* APIProperty: maximizeTitle
* {String} This property is used for showing a tooltip over the
* maximize div. Defaults to "" (no title).
*/
maximizeTitle: "",
/**
* APIProperty: minimizeTitle
* {String} This property is used for showing a tooltip over the
* minimize div. Defaults to "" (no title).
*/
minimizeTitle: "",
/**
* Constructor: OpenLayers.Control.OverviewMap
* Create a new overview map
@@ -247,6 +261,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
'absolute');
this.maximizeDiv.style.display = 'none';
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
if (this.maximizeTitle) {
this.maximizeDiv.title = this.maximizeTitle;
}
this.div.appendChild(this.maximizeDiv);
// minimize button div
@@ -259,6 +276,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
'absolute');
this.minimizeDiv.style.display = 'none';
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
if (this.minimizeTitle) {
this.minimizeDiv.title = this.minimizeTitle;
}
this.div.appendChild(this.minimizeDiv);
this.minimizeControl();
} else {

View File

@@ -14,6 +14,23 @@
"olControlOverviewMap", "displayClass is correct" );
}
function test_divs_title(t) {
t.plan(2);
control = new OpenLayers.Control.OverviewMap({
maximizeTitle: "maximize title",
minimizeTitle: "minimize title"
});
map = new OpenLayers.Map('map', {
layers: [new OpenLayers.Layer("layer", {isBaseLayer: true})],
controls: [control]
});
map.zoomToMaxExtent();
t.eq(control.maximizeDiv.title, "maximize title", "maximizeDiv.title is correct");
t.eq(control.minimizeDiv.title, "minimize title", "minimizeDiv.title is correct");
map.destroy();
}
function test_setMap(t) {
t.plan(4);