Merge pull request #477 from fredj/overviewmap-title
Add new maximizeDivTitle and minimizeDivTitle options to Control.OverviewMap
This commit is contained in:
@@ -80,7 +80,9 @@
|
|||||||
|
|
||||||
// create an overview map control with the default options
|
// create an overview map control with the default options
|
||||||
var overview1 = new OpenLayers.Control.OverviewMap({
|
var overview1 = new OpenLayers.Control.OverviewMap({
|
||||||
maximized: true
|
maximized: true,
|
||||||
|
maximizeTitle: 'Show the overview map',
|
||||||
|
minimizeTitle: 'Hide the overview map'
|
||||||
});
|
});
|
||||||
map1.addControl(overview1);
|
map1.addControl(overview1);
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,20 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
*/
|
*/
|
||||||
maximized: false,
|
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
|
* Constructor: OpenLayers.Control.OverviewMap
|
||||||
* Create a new overview map
|
* Create a new overview map
|
||||||
@@ -247,6 +261,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
'absolute');
|
'absolute');
|
||||||
this.maximizeDiv.style.display = 'none';
|
this.maximizeDiv.style.display = 'none';
|
||||||
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
|
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
|
||||||
|
if (this.maximizeTitle) {
|
||||||
|
this.maximizeDiv.title = this.maximizeTitle;
|
||||||
|
}
|
||||||
this.div.appendChild(this.maximizeDiv);
|
this.div.appendChild(this.maximizeDiv);
|
||||||
|
|
||||||
// minimize button div
|
// minimize button div
|
||||||
@@ -259,6 +276,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
'absolute');
|
'absolute');
|
||||||
this.minimizeDiv.style.display = 'none';
|
this.minimizeDiv.style.display = 'none';
|
||||||
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
|
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
|
||||||
|
if (this.minimizeTitle) {
|
||||||
|
this.minimizeDiv.title = this.minimizeTitle;
|
||||||
|
}
|
||||||
this.div.appendChild(this.minimizeDiv);
|
this.div.appendChild(this.minimizeDiv);
|
||||||
this.minimizeControl();
|
this.minimizeControl();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -14,6 +14,23 @@
|
|||||||
"olControlOverviewMap", "displayClass is correct" );
|
"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) {
|
function test_setMap(t) {
|
||||||
t.plan(4);
|
t.plan(4);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user