allow controls to live outside the map viewport - with changes to the overview map to handle this (#465)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2135 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -147,8 +147,7 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
|
|
||||||
// Optionally add min/max buttons if the control will go in the
|
// Optionally add min/max buttons if the control will go in the
|
||||||
// map viewport.
|
// map viewport.
|
||||||
if(!this.div.parentNode ||
|
if(!this.outsideViewport) {
|
||||||
(this.div.parentNode.className == 'olMapViewport')) {
|
|
||||||
this.div.className = 'olControlOverviewMapContainer';
|
this.div.className = 'olControlOverviewMapContainer';
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
var imgLocation = OpenLayers.Util.getImagesLocation();
|
||||||
// maximize button div
|
// maximize button div
|
||||||
|
|||||||
@@ -480,13 +480,13 @@ OpenLayers.Map.prototype = {
|
|||||||
* @param {OpenLayers.Pixel} px
|
* @param {OpenLayers.Pixel} px
|
||||||
*/
|
*/
|
||||||
addControlToMap: function (control, px) {
|
addControlToMap: function (control, px) {
|
||||||
|
// If a control doesn't have a div at this point, it belongs in the
|
||||||
|
// viewport.
|
||||||
|
control.outsideViewport = (control.div != null);
|
||||||
control.setMap(this);
|
control.setMap(this);
|
||||||
var div = control.draw(px);
|
var div = control.draw(px);
|
||||||
if (div) {
|
if (div) {
|
||||||
// Only elements without parents should be appended to the viewport.
|
if(!control.outsideViewport) {
|
||||||
// In IE, even elements without parents are given a parent node
|
|
||||||
// of type 11 (DOCUMENT_FRAGMENT_NODE).
|
|
||||||
if(!div.parentNode || (div.parentNode.nodeType == 11)) {
|
|
||||||
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
|
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
|
||||||
this.controls.length;
|
this.controls.length;
|
||||||
this.viewPortDiv.appendChild( div );
|
this.viewPortDiv.appendChild( div );
|
||||||
|
|||||||
Reference in New Issue
Block a user