Skip to content

Commit

Permalink
Add new maximizeTitle and minimizeTitle options to Control.OverviewMap
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed May 29, 2012
1 parent 5c42aa6 commit c696b34
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/overviewmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ <h1 id="title">Overview Map</h1>

// 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);

Expand Down
20 changes: 20 additions & 0 deletions lib/OpenLayers/Control/OverviewMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
17 changes: 17 additions & 0 deletions tests/Control/OverviewMap.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c696b34

Please sign in to comment.