Merge pull request #170 from fredj/prototype-pollution

Initialize variables in the code to keep the prototype clean.
This commit is contained in:
Frédéric Junod
2012-01-22 22:49:20 -08:00
+6 -6
View File
@@ -63,21 +63,21 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
* {Array(Integer)} Number of tiles up to the given tier of pyramid. * {Array(Integer)} Number of tiles up to the given tier of pyramid.
* - filled during Zoomify pyramid initialization. * - filled during Zoomify pyramid initialization.
*/ */
tileCountUpToTier: new Array(), tileCountUpToTier: null,
/** /**
* Property: tierSizeInTiles * Property: tierSizeInTiles
* {Array(<OpenLayers.Size>)} Size (in tiles) for each tier of pyramid. * {Array(<OpenLayers.Size>)} Size (in tiles) for each tier of pyramid.
* - filled during Zoomify pyramid initialization. * - filled during Zoomify pyramid initialization.
*/ */
tierSizeInTiles: new Array(), tierSizeInTiles: null,
/** /**
* Property: tierImageSize * Property: tierImageSize
* {Array(<OpenLayers.Size>)} Image size in pixels for each pyramid tier. * {Array(<OpenLayers.Size>)} Image size in pixels for each pyramid tier.
* - filled during Zoomify pyramid initialization. * - filled during Zoomify pyramid initialization.
*/ */
tierImageSize: new Array(), tierImageSize: null,
/** /**
* Constructor: OpenLayers.Layer.Zoomify * Constructor: OpenLayers.Layer.Zoomify
@@ -117,8 +117,8 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
Math.ceil( imageSize.h / this.standardTileSize ) Math.ceil( imageSize.h / this.standardTileSize )
); );
this.tierSizeInTiles.push( tiles ); this.tierSizeInTiles = [tiles];
this.tierImageSize.push( imageSize ); this.tierImageSize = [imageSize];
while (imageSize.w > this.standardTileSize || while (imageSize.w > this.standardTileSize ||
imageSize.h > this.standardTileSize ) { imageSize.h > this.standardTileSize ) {
@@ -140,7 +140,7 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
this.numberOfTiers = this.tierSizeInTiles.length; this.numberOfTiers = this.tierSizeInTiles.length;
this.tileCountUpToTier[0] = 0; this.tileCountUpToTier = [0];
for (var i = 1; i < this.numberOfTiers; i++) { for (var i = 1; i < this.numberOfTiers; i++) {
this.tileCountUpToTier.push( this.tileCountUpToTier.push(
this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h + this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h +