Merge pull request #357 from fredj/deprecated
mv AnchoredBubble to deprecated.js, rm LayerSwitcher.roundedCorner. r=bartvde
This commit is contained in:
@@ -379,7 +379,6 @@ Group: OpenLayers {
|
||||
|
||||
File: Popup (no auto-title, OpenLayers/Popup.js)
|
||||
File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js)
|
||||
File: AnchoredBubble (no auto-title, OpenLayers/Popup/AnchoredBubble.js)
|
||||
File: Framed (no auto-title, OpenLayers/Popup/Framed.js)
|
||||
File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js)
|
||||
} # Group: Popup
|
||||
|
||||
@@ -379,7 +379,6 @@ Group: OpenLayers {
|
||||
|
||||
File: Popup (no auto-title, OpenLayers/Popup.js)
|
||||
File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js)
|
||||
File: AnchoredBubble (no auto-title, OpenLayers/Popup/AnchoredBubble.js)
|
||||
File: Framed (no auto-title, OpenLayers/Popup/Framed.js)
|
||||
File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js)
|
||||
} # Group: Popup
|
||||
|
||||
@@ -144,8 +144,6 @@
|
||||
"OpenLayers/Console.js",
|
||||
"OpenLayers/Tween.js",
|
||||
"OpenLayers/Kinetic.js",
|
||||
"Rico/Corner.js",
|
||||
"Rico/Color.js",
|
||||
"OpenLayers/Events.js",
|
||||
"OpenLayers/Events/buttonclick.js",
|
||||
"OpenLayers/Request.js",
|
||||
@@ -191,7 +189,6 @@
|
||||
"OpenLayers/Layer/Zoomify.js",
|
||||
"OpenLayers/Layer/ArcGISCache.js",
|
||||
"OpenLayers/Popup/Anchored.js",
|
||||
"OpenLayers/Popup/AnchoredBubble.js",
|
||||
"OpenLayers/Popup/Framed.js",
|
||||
"OpenLayers/Popup/FramedCloud.js",
|
||||
"OpenLayers/Feature.js",
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
/**
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Lang.js
|
||||
* @requires OpenLayers/Console.js
|
||||
* @requires OpenLayers/Util.js
|
||||
* @requires OpenLayers/Events/buttonclick.js
|
||||
*/
|
||||
@@ -24,30 +23,11 @@
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Control>
|
||||
*/
|
||||
OpenLayers.Control.LayerSwitcher =
|
||||
OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.LayerSwitcher = OpenLayers.Class(OpenLayers.Control, {
|
||||
|
||||
/**
|
||||
* APIProperty: roundedCorner
|
||||
* {Boolean} If true the Rico library is used for rounding the corners
|
||||
* of the layer switcher div, defaults to false. *Deprecated*. Use
|
||||
* CSS3's border-radius instead. If this option is set to true the
|
||||
* Rico/Corner.js script must be loaded in the page, and therefore
|
||||
* listed in the build profile.
|
||||
*
|
||||
*/
|
||||
roundedCorner: false,
|
||||
|
||||
/**
|
||||
* APIProperty: roundedCornerColor
|
||||
* {String} The color of the rounded corners, only applies if roundedCorner
|
||||
* is true, defaults to "darkblue".
|
||||
*/
|
||||
roundedCornerColor: "darkblue",
|
||||
|
||||
/**
|
||||
* Property: layerStates
|
||||
* {Array(Object)} Basically a copy of the "state" of the map's layers
|
||||
/**
|
||||
* Property: layerStates
|
||||
* {Array(Object)} Basically a copy of the "state" of the map's layers
|
||||
* the last time the control was drawn. We have this in order to avoid
|
||||
* unnecessarily redrawing the control.
|
||||
*/
|
||||
@@ -120,10 +100,6 @@ OpenLayers.Control.LayerSwitcher =
|
||||
initialize: function(options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
this.layerStates = [];
|
||||
|
||||
if(this.roundedCorner) {
|
||||
OpenLayers.Console.warn('roundedCorner option is deprecated');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -514,16 +490,6 @@ OpenLayers.Control.LayerSwitcher =
|
||||
|
||||
this.div.appendChild(this.layersDiv);
|
||||
|
||||
if(this.roundedCorner) {
|
||||
OpenLayers.Rico.Corner.round(this.div, {
|
||||
corners: "tl bl",
|
||||
bgColor: "transparent",
|
||||
color: this.roundedCornerColor,
|
||||
blend: false
|
||||
});
|
||||
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
||||
}
|
||||
|
||||
// maximize button div
|
||||
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
|
||||
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||
* full list of contributors). Published under the 2-clause BSD license.
|
||||
* See license.txt in the OpenLayers distribution or repository for the
|
||||
* full text of the license. */
|
||||
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Popup/Anchored.js
|
||||
* @requires OpenLayers/Console.js
|
||||
* @requires Rico/Corner.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Popup.AnchoredBubble
|
||||
* This class is *deprecated*. Use {<OpenLayers.Popup.Anchored>} and
|
||||
* round corners using CSS3's border-radius property.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Popup.Anchored>
|
||||
*/
|
||||
OpenLayers.Popup.AnchoredBubble =
|
||||
OpenLayers.Class(OpenLayers.Popup.Anchored, {
|
||||
|
||||
/**
|
||||
* Property: rounded
|
||||
* {Boolean} Has the popup been rounded yet?
|
||||
*/
|
||||
rounded: false,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Popup.AnchoredBubble
|
||||
*
|
||||
* Parameters:
|
||||
* id - {String}
|
||||
* lonlat - {<OpenLayers.LonLat>}
|
||||
* contentSize - {<OpenLayers.Size>}
|
||||
* contentHTML - {String}
|
||||
* anchor - {Object} Object to which we'll anchor the popup. Must expose
|
||||
* a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>)
|
||||
* (Note that this is generally an <OpenLayers.Icon>).
|
||||
* closeBox - {Boolean}
|
||||
* closeBoxCallback - {Function} Function to be called on closeBox click.
|
||||
*/
|
||||
initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,
|
||||
closeBoxCallback) {
|
||||
|
||||
OpenLayers.Console.warn('AnchoredBubble is deprecated');
|
||||
|
||||
this.padding = new OpenLayers.Bounds(
|
||||
0, OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,
|
||||
0, OpenLayers.Popup.AnchoredBubble.CORNER_SIZE
|
||||
);
|
||||
OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
*
|
||||
* Parameters:
|
||||
* px - {<OpenLayers.Pixel>}
|
||||
*
|
||||
* Returns:
|
||||
* {DOMElement} Reference to a div that contains the drawn popup.
|
||||
*/
|
||||
draw: function(px) {
|
||||
|
||||
OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments);
|
||||
|
||||
this.setContentHTML();
|
||||
|
||||
//set the popup color and opacity
|
||||
this.setBackgroundColor();
|
||||
this.setOpacity();
|
||||
|
||||
return this.div;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: updateRelativePosition
|
||||
* The popup has been moved to a new relative location, in which case
|
||||
* we will want to re-do the rico corners.
|
||||
*/
|
||||
updateRelativePosition: function() {
|
||||
this.setRicoCorners();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setSize
|
||||
*
|
||||
* Parameters:
|
||||
* contentSize - {<OpenLayers.Size>} the new size for the popup's
|
||||
* contents div (in pixels).
|
||||
*/
|
||||
setSize:function(contentSize) {
|
||||
OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
|
||||
|
||||
this.setRicoCorners();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setBackgroundColor
|
||||
*
|
||||
* Parameters:
|
||||
* color - {String}
|
||||
*/
|
||||
setBackgroundColor:function(color) {
|
||||
if (color != undefined) {
|
||||
this.backgroundColor = color;
|
||||
}
|
||||
|
||||
if (this.div != null) {
|
||||
if (this.contentDiv != null) {
|
||||
this.div.style.background = "transparent";
|
||||
OpenLayers.Rico.Corner.changeColor(this.groupDiv,
|
||||
this.backgroundColor);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setOpacity
|
||||
*
|
||||
* Parameters:
|
||||
* opacity - {float}
|
||||
*/
|
||||
setOpacity:function(opacity) {
|
||||
OpenLayers.Popup.Anchored.prototype.setOpacity.call(this, opacity);
|
||||
|
||||
if (this.div != null) {
|
||||
if (this.groupDiv != null) {
|
||||
OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,
|
||||
this.opacity);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setBorder
|
||||
* Always sets border to 0. Bubble Popups can not have a border.
|
||||
*
|
||||
* Parameters:
|
||||
* border - {Integer}
|
||||
*/
|
||||
setBorder:function(border) {
|
||||
this.border = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setRicoCorners
|
||||
* Update RICO corners according to the popup's current relative postion.
|
||||
*/
|
||||
setRicoCorners:function() {
|
||||
|
||||
var corners = this.getCornersToRound(this.relativePosition);
|
||||
var options = {corners: corners,
|
||||
color: this.backgroundColor,
|
||||
bgColor: "transparent",
|
||||
blend: false};
|
||||
|
||||
if (!this.rounded) {
|
||||
OpenLayers.Rico.Corner.round(this.div, options);
|
||||
this.rounded = true;
|
||||
} else {
|
||||
OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
|
||||
//set the popup color and opacity
|
||||
this.setBackgroundColor();
|
||||
this.setOpacity();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getCornersToRound
|
||||
*
|
||||
* Returns:
|
||||
* {String} The proper corners string ("tr tl bl br") for rico to round.
|
||||
*/
|
||||
getCornersToRound:function() {
|
||||
|
||||
var corners = ['tl', 'tr', 'bl', 'br'];
|
||||
|
||||
//we want to round all the corners _except_ the opposite one.
|
||||
var corner = OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);
|
||||
OpenLayers.Util.removeItem(corners, corner);
|
||||
|
||||
return corners.join(" ");
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Popup.AnchoredBubble"
|
||||
});
|
||||
|
||||
/**
|
||||
* Constant: CORNER_SIZE
|
||||
* {Integer} 5. Border space for the RICO corners.
|
||||
*/
|
||||
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* @requires OpenLayers/Format/XML.js
|
||||
* @requires OpenLayers/Geometry.js
|
||||
* @requires OpenLayers/Renderer/Elements.js
|
||||
* @requires OpenLayers/Popup/Anchored.js
|
||||
* @requires Rico/Corner.js
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -5656,4 +5658,185 @@ OpenLayers.Renderer.SVG2.LABEL_VFACTOR = {
|
||||
*/
|
||||
OpenLayers.Renderer.SVG2.preventDefault = function(e) {
|
||||
e.preventDefault && e.preventDefault();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Popup.AnchoredBubble
|
||||
* This class is *deprecated*. Use {<OpenLayers.Popup.Anchored>} and
|
||||
* round corners using CSS3's border-radius property.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Popup.Anchored>
|
||||
*/
|
||||
OpenLayers.Popup.AnchoredBubble = OpenLayers.Class(OpenLayers.Popup.Anchored, {
|
||||
|
||||
/**
|
||||
* Property: rounded
|
||||
* {Boolean} Has the popup been rounded yet?
|
||||
*/
|
||||
rounded: false,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Popup.AnchoredBubble
|
||||
*
|
||||
* Parameters:
|
||||
* id - {String}
|
||||
* lonlat - {<OpenLayers.LonLat>}
|
||||
* contentSize - {<OpenLayers.Size>}
|
||||
* contentHTML - {String}
|
||||
* anchor - {Object} Object to which we'll anchor the popup. Must expose
|
||||
* a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>)
|
||||
* (Note that this is generally an <OpenLayers.Icon>).
|
||||
* closeBox - {Boolean}
|
||||
* closeBoxCallback - {Function} Function to be called on closeBox click.
|
||||
*/
|
||||
initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,
|
||||
closeBoxCallback) {
|
||||
|
||||
this.padding = new OpenLayers.Bounds(
|
||||
0, OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,
|
||||
0, OpenLayers.Popup.AnchoredBubble.CORNER_SIZE
|
||||
);
|
||||
OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
*
|
||||
* Parameters:
|
||||
* px - {<OpenLayers.Pixel>}
|
||||
*
|
||||
* Returns:
|
||||
* {DOMElement} Reference to a div that contains the drawn popup.
|
||||
*/
|
||||
draw: function(px) {
|
||||
|
||||
OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments);
|
||||
|
||||
this.setContentHTML();
|
||||
|
||||
//set the popup color and opacity
|
||||
this.setBackgroundColor();
|
||||
this.setOpacity();
|
||||
|
||||
return this.div;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: updateRelativePosition
|
||||
* The popup has been moved to a new relative location, in which case
|
||||
* we will want to re-do the rico corners.
|
||||
*/
|
||||
updateRelativePosition: function() {
|
||||
this.setRicoCorners();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setSize
|
||||
*
|
||||
* Parameters:
|
||||
* contentSize - {<OpenLayers.Size>} the new size for the popup's
|
||||
* contents div (in pixels).
|
||||
*/
|
||||
setSize:function(contentSize) {
|
||||
OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
|
||||
|
||||
this.setRicoCorners();
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setBackgroundColor
|
||||
*
|
||||
* Parameters:
|
||||
* color - {String}
|
||||
*/
|
||||
setBackgroundColor:function(color) {
|
||||
if (color != undefined) {
|
||||
this.backgroundColor = color;
|
||||
}
|
||||
|
||||
if (this.div != null) {
|
||||
if (this.contentDiv != null) {
|
||||
this.div.style.background = "transparent";
|
||||
OpenLayers.Rico.Corner.changeColor(this.groupDiv,
|
||||
this.backgroundColor);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setOpacity
|
||||
*
|
||||
* Parameters:
|
||||
* opacity - {float}
|
||||
*/
|
||||
setOpacity:function(opacity) {
|
||||
OpenLayers.Popup.Anchored.prototype.setOpacity.call(this, opacity);
|
||||
|
||||
if (this.div != null) {
|
||||
if (this.groupDiv != null) {
|
||||
OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,
|
||||
this.opacity);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setBorder
|
||||
* Always sets border to 0. Bubble Popups can not have a border.
|
||||
*
|
||||
* Parameters:
|
||||
* border - {Integer}
|
||||
*/
|
||||
setBorder:function(border) {
|
||||
this.border = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setRicoCorners
|
||||
* Update RICO corners according to the popup's current relative postion.
|
||||
*/
|
||||
setRicoCorners:function() {
|
||||
|
||||
var corners = this.getCornersToRound(this.relativePosition);
|
||||
var options = {corners: corners,
|
||||
color: this.backgroundColor,
|
||||
bgColor: "transparent",
|
||||
blend: false};
|
||||
|
||||
if (!this.rounded) {
|
||||
OpenLayers.Rico.Corner.round(this.div, options);
|
||||
this.rounded = true;
|
||||
} else {
|
||||
OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
|
||||
//set the popup color and opacity
|
||||
this.setBackgroundColor();
|
||||
this.setOpacity();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getCornersToRound
|
||||
*
|
||||
* Returns:
|
||||
* {String} The proper corners string ("tr tl bl br") for rico to round.
|
||||
*/
|
||||
getCornersToRound:function() {
|
||||
|
||||
var corners = ['tl', 'tr', 'bl', 'br'];
|
||||
|
||||
//we want to round all the corners _except_ the opposite one.
|
||||
var corner = OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);
|
||||
OpenLayers.Util.removeItem(corners, corner);
|
||||
|
||||
return corners.join(" ");
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Popup.AnchoredBubble"
|
||||
});
|
||||
|
||||
/**
|
||||
* Constant: CORNER_SIZE
|
||||
* {Integer} 5. Border space for the RICO corners.
|
||||
*/
|
||||
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5;
|
||||
|
||||
@@ -132,4 +132,25 @@ run 'build.py -h' for more details
|
||||
|
||||
Corresponding issue/pull requests:
|
||||
|
||||
* https://github.com/openlayers/openlayers/pull/528
|
||||
* https://github.com/openlayers/openlayers/pull/528
|
||||
|
||||
## Deprecated Components
|
||||
A number of properties, methods, and constructors have been marked as
|
||||
deprecated for multiple releases in the 2.x series.
|
||||
For the 2.13 release this deprecated functionality has been moved to a
|
||||
separate deprecated.js file. If you use any of the constructors or
|
||||
methods below, you will have to explicitly include the deprecated.js
|
||||
file in your build (or add it in a separate `<script>` tag after
|
||||
OpenLayers.js).
|
||||
|
||||
* OpenLayers.Layer.Popup.AnchoredBubble
|
||||
|
||||
Because the Rico library is now only used by deprecated components, the
|
||||
files have been removed from the debug loader in lib/OpenLayers.js;
|
||||
the files have now to be explicitly loaded in a script tag.
|
||||
|
||||
## LayerSwitcher rounded corner removal
|
||||
|
||||
The deprecated `roundedCorner` and `roundedCornerColor` options have
|
||||
been removed from the `OpenLayers.Control.LayerSwitcher` control. Use
|
||||
CSS3's border-radius instead.
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../OLLoader.js"></script>
|
||||
<script src="../../OLLoader.js"></script>
|
||||
<script src="../../../lib/Rico/Corner.js"></script>
|
||||
<script src="../../../lib/deprecated.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_Popup_Anchored_setOpacity(t) {
|
||||
function test_Popup_Anchored_setOpacity(t) {
|
||||
t.plan(5);
|
||||
var opacity = 0.5;
|
||||
var id = "chicken";
|
||||
@@ -48,7 +50,7 @@
|
||||
} else {
|
||||
t.eq(ricoCornerDiv.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default ricoCornerDiv.opacity");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -193,7 +193,6 @@
|
||||
<li>SingleFile3.html</html>
|
||||
<li>Popup.html</li>
|
||||
<li>Popup/Anchored.html</li>
|
||||
<li>Popup/AnchoredBubble.html</li>
|
||||
<li>Popup/FramedCloud.html</li>
|
||||
<li>Projection.html</li>
|
||||
<li>Protocol.html</li>
|
||||
@@ -250,6 +249,7 @@
|
||||
<li>deprecated/Layer/WFS.html</li>
|
||||
<li>deprecated/Layer/WMS.html</li>
|
||||
<li>deprecated/Layer/WMS/Post.html</li>
|
||||
<li>deprecated/Popup/AnchoredBubble.html</li>
|
||||
<li>deprecated/Protocol/SQL.html</li>
|
||||
<li>deprecated/Protocol/SQL/Gears.html</li>
|
||||
<li>deprecated/Renderer/SVG2.html</li>
|
||||
|
||||
Reference in New Issue
Block a user