Permalink
Browse files

Possibly fix Gah issue for good, other shallow style changes

  • Loading branch information...
1 parent ddc073b commit 18c96c3c3edcd8b1f3a45e6fb765ba75825bbdfe @tmcw tmcw committed Mar 21, 2012
Showing with 43 additions and 61 deletions.
  1. +20 −29 modestmaps.js
  2. +2 −2 modestmaps.min.js
  3. +1 −1 package.json
  4. +15 −20 src/layer.js
  5. +4 −8 src/map.js
  6. +1 −1 src/start.js
View
@@ -1,5 +1,5 @@
/*!
- * Modest Maps JS v1.0.0-alpha
+ * Modest Maps JS v1.0.0-alpha3
* http://modestmaps.com/
*
* Copyright (c) 2011 Stamen Design, All Rights Reserved.
@@ -1764,7 +1764,7 @@ var MM = com.modestmaps = {
_tileComplete: null,
getTileComplete: function() {
- if(!this._tileComplete) {
+ if (!this._tileComplete) {
var theLayer = this;
this._tileComplete = function(manager, tile) {
@@ -1829,7 +1829,7 @@ var MM = com.modestmaps = {
if (this.levels.hasOwnProperty(name)) {
var zoom = parseInt(name,10);
- if (zoom >= startCoord.zoom-5 && zoom < startCoord.zoom+2) {
+ if (zoom >= startCoord.zoom - 5 && zoom < startCoord.zoom + 2) {
continue;
}
@@ -1864,20 +1864,16 @@ var MM = com.modestmaps = {
this.checkCache();
},
- /**
- * For a given tile coordinate in a given level element, ensure that it's
- * correctly represented in the DOM including potentially-overlapping
- * parent and child tiles for pyramid loading.
- *
- * Return a list of valid (i.e. loadable?) tile keys.
- */
+ // For a given tile coordinate in a given level element, ensure that it's
+ // correctly represented in the DOM including potentially-overlapping
+ // parent and child tiles for pyramid loading.
+ //
+ // Return a list of valid (i.e. loadable?) tile keys.
inventoryVisibleTile: function(layer_element, tile_coord) {
var tile_key = tile_coord.toKey(),
valid_tile_keys = [tile_key];
- /*
- * Check that the needed tile already exists someplace - add it to the DOM if it does.
- */
+ // Check that the needed tile already exists someplace - add it to the DOM if it does.
if (tile_key in this.tiles) {
var tile = this.tiles[tile_key];
@@ -1893,9 +1889,7 @@ var MM = com.modestmaps = {
return valid_tile_keys;
}
- /*
- * Check that the needed tile has even been requested at all.
- */
+ // Check that the needed tile has even been requested at all.
if (!this.requestManager.hasRequest(tile_key)) {
var tileToRequest = this.provider.getTile(tile_coord);
if (typeof tileToRequest == 'string') {
@@ -1946,7 +1940,7 @@ var MM = com.modestmaps = {
}
// if we didn't find a parent, look at the children:
- if(!tileCovered && !this.enablePyramidLoading) {
+ if (!tileCovered && !this.enablePyramidLoading) {
var child_coord = tile_coord.zoomBy(1);
// mark everything valid whether or not we have it:
@@ -1966,8 +1960,8 @@ var MM = com.modestmaps = {
// this is somewhat future proof, we're looking for DOM elements
// not necessarily <img> elements
var tiles = [];
- for(var tile = level.firstChild; tile; tile = tile.nextSibling) {
- if(tile.nodeType == 1) {
+ for (var tile = level.firstChild; tile; tile = tile.nextSibling) {
+ if (tile.nodeType == 1) {
tiles.push(tile);
}
}
@@ -2010,9 +2004,10 @@ var MM = com.modestmaps = {
this.provider.releaseTile(tile.coord);
this.requestManager.clearRequest(tile.coord.toKey());
level.removeChild(tile);
+ } else {
+ // log last-touched-time of currently cached tiles
+ this.recentTilesById[tile.id].lastTouchedTime = now;
}
- // log last-touched-time of currently cached tiles
- this.recentTilesById[tile.id].lastTouchedTime = now;
}
// position tiles
@@ -2791,25 +2786,21 @@ var MM = com.modestmaps = {
currentBottomRight.row - currentTopLeft.row) {
// if the limit is smaller than the current view center it
coord.row = (bottomRightLimit.row + topLeftLimit.row) / 2;
- }
- else {
+ } else {
if (currentTopLeft.row < topLeftLimit.row) {
coord.row += topLeftLimit.row - currentTopLeft.row;
- }
- else if (currentBottomRight.row > bottomRightLimit.row) {
+ } else if (currentBottomRight.row > bottomRightLimit.row) {
coord.row -= currentBottomRight.row - bottomRightLimit.row;
}
}
if (bottomRightLimit.column - topLeftLimit.column <
currentBottomRight.column - currentTopLeft.column) {
// if the limit is smaller than the current view, center it
coord.column = (bottomRightLimit.column + topLeftLimit.column) / 2;
- }
- else {
+ } else {
if (currentTopLeft.column < topLeftLimit.column) {
coord.column += topLeftLimit.column - currentTopLeft.column;
- }
- else if (currentBottomRight.column > bottomRightLimit.column) {
+ } else if (currentBottomRight.column > bottomRightLimit.column) {
coord.column -= currentBottomRight.column - bottomRightLimit.column;
}
}
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
{
"name": "modestmaps",
"description": "a display and interaction library for tile-based maps",
- "version": "1.0.0-alpha2",
+ "version": "1.0.0-alpha3",
"author": {
"name": "Tom Carden",
"email": "tom@tom-carden.co.uk",
View
@@ -35,7 +35,7 @@
_tileComplete: null,
getTileComplete: function() {
- if(!this._tileComplete) {
+ if (!this._tileComplete) {
var theLayer = this;
this._tileComplete = function(manager, tile) {
@@ -100,7 +100,7 @@
if (this.levels.hasOwnProperty(name)) {
var zoom = parseInt(name,10);
- if (zoom >= startCoord.zoom-5 && zoom < startCoord.zoom+2) {
+ if (zoom >= startCoord.zoom - 5 && zoom < startCoord.zoom + 2) {
continue;
}
@@ -135,20 +135,16 @@
this.checkCache();
},
- /**
- * For a given tile coordinate in a given level element, ensure that it's
- * correctly represented in the DOM including potentially-overlapping
- * parent and child tiles for pyramid loading.
- *
- * Return a list of valid (i.e. loadable?) tile keys.
- */
+ // For a given tile coordinate in a given level element, ensure that it's
+ // correctly represented in the DOM including potentially-overlapping
+ // parent and child tiles for pyramid loading.
+ //
+ // Return a list of valid (i.e. loadable?) tile keys.
inventoryVisibleTile: function(layer_element, tile_coord) {
var tile_key = tile_coord.toKey(),
valid_tile_keys = [tile_key];
- /*
- * Check that the needed tile already exists someplace - add it to the DOM if it does.
- */
+ // Check that the needed tile already exists someplace - add it to the DOM if it does.
if (tile_key in this.tiles) {
var tile = this.tiles[tile_key];
@@ -164,9 +160,7 @@
return valid_tile_keys;
}
- /*
- * Check that the needed tile has even been requested at all.
- */
+ // Check that the needed tile has even been requested at all.
if (!this.requestManager.hasRequest(tile_key)) {
var tileToRequest = this.provider.getTile(tile_coord);
if (typeof tileToRequest == 'string') {
@@ -217,7 +211,7 @@
}
// if we didn't find a parent, look at the children:
- if(!tileCovered && !this.enablePyramidLoading) {
+ if (!tileCovered && !this.enablePyramidLoading) {
var child_coord = tile_coord.zoomBy(1);
// mark everything valid whether or not we have it:
@@ -237,8 +231,8 @@
// this is somewhat future proof, we're looking for DOM elements
// not necessarily <img> elements
var tiles = [];
- for(var tile = level.firstChild; tile; tile = tile.nextSibling) {
- if(tile.nodeType == 1) {
+ for (var tile = level.firstChild; tile; tile = tile.nextSibling) {
+ if (tile.nodeType == 1) {
tiles.push(tile);
}
}
@@ -281,9 +275,10 @@
this.provider.releaseTile(tile.coord);
this.requestManager.clearRequest(tile.coord.toKey());
level.removeChild(tile);
+ } else {
+ // log last-touched-time of currently cached tiles
+ this.recentTilesById[tile.id].lastTouchedTime = now;
}
- // log last-touched-time of currently cached tiles
- this.recentTilesById[tile.id].lastTouchedTime = now;
}
// position tiles
View
@@ -545,25 +545,21 @@
currentBottomRight.row - currentTopLeft.row) {
// if the limit is smaller than the current view center it
coord.row = (bottomRightLimit.row + topLeftLimit.row) / 2;
- }
- else {
+ } else {
if (currentTopLeft.row < topLeftLimit.row) {
coord.row += topLeftLimit.row - currentTopLeft.row;
- }
- else if (currentBottomRight.row > bottomRightLimit.row) {
+ } else if (currentBottomRight.row > bottomRightLimit.row) {
coord.row -= currentBottomRight.row - bottomRightLimit.row;
}
}
if (bottomRightLimit.column - topLeftLimit.column <
currentBottomRight.column - currentTopLeft.column) {
// if the limit is smaller than the current view, center it
coord.column = (bottomRightLimit.column + topLeftLimit.column) / 2;
- }
- else {
+ } else {
if (currentTopLeft.column < topLeftLimit.column) {
coord.column += topLeftLimit.column - currentTopLeft.column;
- }
- else if (currentBottomRight.column > bottomRightLimit.column) {
+ } else if (currentBottomRight.column > bottomRightLimit.column) {
coord.column -= currentBottomRight.column - bottomRightLimit.column;
}
}
View
@@ -1,5 +1,5 @@
/*!
- * Modest Maps JS v1.0.0-alpha
+ * Modest Maps JS v1.0.0-alpha3
* http://modestmaps.com/
*
* Copyright (c) 2011 Stamen Design, All Rights Reserved.

0 comments on commit 18c96c3

Please sign in to comment.