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 * class name olControlOverviewMapElement) may have padding or other style
* attributes added via CSS. * attributes added via CSS.
*/ */
size: new OpenLayers.Size(180, 90), size: {w: 180, h: 90},
/** /**
* APIProperty: layers * APIProperty: layers

View File

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

View File

@@ -533,11 +533,12 @@ OpenLayers.Popup = OpenLayers.Class({
} else { } 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. // set or null if not clipped.
var fixedSize = new OpenLayers.Size(); var fixedSize = {
fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null; w: (safeSize.w < realSize.w) ? safeSize.w : null,
fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null; h: (safeSize.h < realSize.h) ? safeSize.h : null
};
if (fixedSize.w && fixedSize.h) { if (fixedSize.w && fixedSize.h) {
//content is too big in both directions, so we will use //content is too big in both directions, so we will use
@@ -872,7 +873,7 @@ OpenLayers.Popup = OpenLayers.Class({
addCloseBox: function(callback) { addCloseBox: function(callback) {
this.closeDiv = OpenLayers.Util.createDiv( 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"; this.closeDiv.className = "olPopupCloseBox";