replace Size instances with simple object

This commit is contained in:
fredj
2012-01-09 09:51:13 +01:00
committed by Frederic Junod
parent 4844baf666
commit 07e3fa9624
4 changed files with 15 additions and 14 deletions

View File

@@ -41,7 +41,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
* class name olControlOverviewMapElement) may have padding or other style
* attributes added via CSS.
*/
size: new OpenLayers.Size(180, 90),
size: {w: 180, h: 90},
/**
* APIProperty: layers

View File

@@ -87,7 +87,7 @@ OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
// place the controls
this.buttons = [];
var sz = new OpenLayers.Size(18,18);
var sz = {w: 18, h: 18};
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
this._addButton("panup", "north-mini.png", centered, sz);

View File

@@ -151,7 +151,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
// place the controls
this.buttons = [];
var sz = new OpenLayers.Size(18,18);
var sz = {w: 18, h: 18};
if (this.panIcons) {
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
var wposition = sz.w;
@@ -198,7 +198,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
new OpenLayers.Size(20,9),
{w: 20, h: 9},
imgLocation,
"absolute");
slider.style.cursor = "move";
@@ -217,17 +217,17 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
"click": this.doubleClick
});
var sz = new OpenLayers.Size();
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();
sz.w = this.zoomStopWidth;
var sz = {
w: this.zoomStopWidth,
h: this.zoomStopHeight * this.map.getNumZoomLevels()
};
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
var div = null;
if (OpenLayers.Util.alphaHack()) {
var id = this.id + "_" + this.map.id;
div = OpenLayers.Util.createAlphaImageDiv(id, centered,
new OpenLayers.Size(sz.w,
this.zoomStopHeight),
{w: sz.w, h: this.zoomStopHeight},
imgLocation,
"absolute", null, "crop");
div.style.height = sz.h + "px";

View File

@@ -533,11 +533,12 @@ OpenLayers.Popup = OpenLayers.Class({
} else {
//make a new OL.Size object with the clipped dimensions
// make a new 'size' object with the clipped dimensions
// set or null if not clipped.
var fixedSize = new OpenLayers.Size();
fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null;
fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null;
var fixedSize = {
w: (safeSize.w < realSize.w) ? safeSize.w : null,
h: (safeSize.h < realSize.h) ? safeSize.h : null
};
if (fixedSize.w && fixedSize.h) {
//content is too big in both directions, so we will use
@@ -872,7 +873,7 @@ OpenLayers.Popup = OpenLayers.Class({
addCloseBox: function(callback) {
this.closeDiv = OpenLayers.Util.createDiv(
this.id + "_close", null, new OpenLayers.Size(17, 17)
this.id + "_close", null, {w: 17, h: 17}
);
this.closeDiv.className = "olPopupCloseBox";