From 07e3fa9624e278771aca213e3ca67390f175109c Mon Sep 17 00:00:00 2001 From: fredj Date: Mon, 9 Jan 2012 09:51:13 +0100 Subject: [PATCH] replace Size instances with simple object --- lib/OpenLayers/Control/OverviewMap.js | 2 +- lib/OpenLayers/Control/PanZoom.js | 2 +- lib/OpenLayers/Control/PanZoomBar.js | 14 +++++++------- lib/OpenLayers/Popup.js | 11 ++++++----- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/OpenLayers/Control/OverviewMap.js b/lib/OpenLayers/Control/OverviewMap.js index 01fe86ee3a..df057d74e9 100644 --- a/lib/OpenLayers/Control/OverviewMap.js +++ b/lib/OpenLayers/Control/OverviewMap.js @@ -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 diff --git a/lib/OpenLayers/Control/PanZoom.js b/lib/OpenLayers/Control/PanZoom.js index 46908a9da5..959e0a8a13 100644 --- a/lib/OpenLayers/Control/PanZoom.js +++ b/lib/OpenLayers/Control/PanZoom.js @@ -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); diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index ad3ecf48e0..ceb7ccb215 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -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"; diff --git a/lib/OpenLayers/Popup.js b/lib/OpenLayers/Popup.js index 2d93e4b703..36f666e73f 100644 --- a/lib/OpenLayers/Popup.js +++ b/lib/OpenLayers/Popup.js @@ -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";