Skip to content

Commit

Permalink
Adding bleeding-edge mm support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom MacWright committed Jul 14, 2011
2 parents e7dc165 + 26b53f3 commit 04364b9
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 48 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,15 @@
## Changelog

### 3.0.2

* Fixes `xyzFinder` in `wax.GridManager` to handle URLs with query strings.

### 3.0.1

* Expose `#full` and `#original` methods on `wax.mm.fullscreen` allowing API
access to fullscreen toggling actions.
* Fixes to boxselector and zoombox controls.

### 3.0.0

* TileJSON support in new map connectors: `wax.mm.connector`,
Expand Down
2 changes: 1 addition & 1 deletion control/lib/gridmanager.js
Expand Up @@ -11,7 +11,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;

var formatterUrl = function(url) {
Expand Down
5 changes: 3 additions & 2 deletions control/mm/boxselector.js
Expand Up @@ -100,7 +100,7 @@ wax.mm.boxselector = function(map, tilejson, opts) {
}

boxselector.add = function(map) {
boxDiv = document.createElement('div');
boxDiv = boxDiv || document.createElement('div');
boxDiv.id = map.parent.id + '-boxselector-box';
boxDiv.className = 'boxselector-box';
map.parent.appendChild(boxDiv);
Expand All @@ -112,7 +112,8 @@ wax.mm.boxselector = function(map, tilejson, opts) {

boxselector.remove = function() {
map.parent.removeChild(boxDiv);
map.removeCallback('mousedown', drawbox);
MM.removeEvent(map.parent, 'mousedown', mouseDown);
map.removeCallback('drawn', drawbox);
};

return boxselector.add(map);
Expand Down
24 changes: 15 additions & 9 deletions control/mm/fullscreen.js
Expand Up @@ -17,16 +17,9 @@ wax.mm.fullscreen = function(map) {
function click(e) {
if (e) com.modestmaps.cancelEvent(e);
if (state = !state) {
map.parent.className = map.parent.className.replace('wax-fullscreen-map', '');
map.setSize(
smallSize[0],
smallSize[1]);
fullscreen.original();
} else {
smallSize = [map.parent.offsetWidth, map.parent.offsetHeight];
map.parent.className += ' wax-fullscreen-map';
map.setSize(
map.parent.offsetWidth,
map.parent.offsetHeight);
fullscreen.full();
}
}

Expand All @@ -41,6 +34,19 @@ wax.mm.fullscreen = function(map) {
com.modestmaps.addEvent(a, 'click', click);
return this;
};
fullscreen.full = function() {
smallSize = [map.parent.offsetWidth, map.parent.offsetHeight];
map.parent.className += ' wax-fullscreen-map';
map.setSize(
map.parent.offsetWidth,
map.parent.offsetHeight);
};
fullscreen.original = function() {
map.parent.className = map.parent.className.replace('wax-fullscreen-map', '');
map.setSize(
smallSize[0],
smallSize[1]);
};
fullscreen.appendTo = function(elem) {
wax.util.$(elem).appendChild(a);
return this;
Expand Down
4 changes: 2 additions & 2 deletions control/mm/interaction.js
Expand Up @@ -139,7 +139,7 @@ wax.mm.interaction = function(map, tilejson, options) {
} else if (e.type === 'touchstart' && e.touches.length === 1) {

// turn this into touch-mode. Fallback to teaser and full.
this.clickAction = ['full', 'teaser'];
clickAction = ['full', 'teaser'];

// Don't make the user click close if they hit another tooltip
if (callbacks._currentTooltip) {
Expand Down Expand Up @@ -170,7 +170,7 @@ wax.mm.interaction = function(map, tilejson, options) {
_downLock = false;
if (e.type === 'touchend') {
// If this was a touch and it survived, there's no need to avoid a double-tap
click(_d);
click(e, _d);
} else if (Math.round(pos.y / tol) === Math.round(_d.y / tol) &&
Math.round(pos.x / tol) === Math.round(_d.x / tol)) {
// Contain the event data in a closure.
Expand Down
5 changes: 3 additions & 2 deletions control/mm/zoombox.js
Expand Up @@ -85,16 +85,17 @@ wax.mm.zoombox = function(map) {
// Use a flag to determine whether the zoombox is currently being
// drawn. Necessary only for IE because `mousedown` is triggered
// twice.
box = document.createElement('div');
box = box || document.createElement('div');
box.id = map.parent.id + '-zoombox-box';
box.className = 'zoombox-box';
map.parent.appendChild(box);
mm.addEvent(map.parent, 'mousedown', mouseDown);
return this;
};

zoombox.remove = function() {
map.parent.removeChild(box);
map.removeCallback('mousedown', mouseDown);
mm.removeEvent(map.parent, 'mousedown', mouseDown);
};

return zoombox.add(map);
Expand Down
4 changes: 2 additions & 2 deletions dist/wax.g.js
@@ -1,4 +1,4 @@
/* wax - 3.0.0 - 1.0.4-321-g053540e */
/* wax - 3.0.2 - 1.0.4-322-ge7dc165 */


/*!
Expand Down Expand Up @@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;

var formatterUrl = function(url) {
Expand Down
4 changes: 2 additions & 2 deletions dist/wax.g.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/wax.leaf.js
@@ -1,4 +1,4 @@
/* wax - 3.0.0 - 1.0.4-321-g053540e */
/* wax - 3.0.2 - 1.0.4-322-ge7dc165 */


/*!
Expand Down Expand Up @@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;

var formatterUrl = function(url) {
Expand Down
4 changes: 2 additions & 2 deletions dist/wax.leaf.min.js

Large diffs are not rendered by default.

42 changes: 25 additions & 17 deletions dist/wax.mm.js
@@ -1,4 +1,4 @@
/* wax - 3.0.0 - 1.0.4-321-g053540e */
/* wax - 3.0.2 - 1.0.4-322-ge7dc165 */


/*!
Expand Down Expand Up @@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;

var formatterUrl = function(url) {
Expand Down Expand Up @@ -917,7 +917,7 @@ wax.mm.boxselector = function(map, tilejson, opts) {
}

boxselector.add = function(map) {
boxDiv = document.createElement('div');
boxDiv = boxDiv || document.createElement('div');
boxDiv.id = map.parent.id + '-boxselector-box';
boxDiv.className = 'boxselector-box';
map.parent.appendChild(boxDiv);
Expand All @@ -929,7 +929,8 @@ wax.mm.boxselector = function(map, tilejson, opts) {

boxselector.remove = function() {
map.parent.removeChild(boxDiv);
map.removeCallback('mousedown', drawbox);
MM.removeEvent(map.parent, 'mousedown', mouseDown);
map.removeCallback('drawn', drawbox);
};

return boxselector.add(map);
Expand All @@ -953,16 +954,9 @@ wax.mm.fullscreen = function(map) {
function click(e) {
if (e) com.modestmaps.cancelEvent(e);
if (state = !state) {
map.parent.className = map.parent.className.replace('wax-fullscreen-map', '');
map.setSize(
smallSize[0],
smallSize[1]);
fullscreen.original();
} else {
smallSize = [map.parent.offsetWidth, map.parent.offsetHeight];
map.parent.className += ' wax-fullscreen-map';
map.setSize(
map.parent.offsetWidth,
map.parent.offsetHeight);
fullscreen.full();
}
}

Expand All @@ -977,6 +971,19 @@ wax.mm.fullscreen = function(map) {
com.modestmaps.addEvent(a, 'click', click);
return this;
};
fullscreen.full = function() {
smallSize = [map.parent.offsetWidth, map.parent.offsetHeight];
map.parent.className += ' wax-fullscreen-map';
map.setSize(
map.parent.offsetWidth,
map.parent.offsetHeight);
};
fullscreen.original = function() {
map.parent.className = map.parent.className.replace('wax-fullscreen-map', '');
map.setSize(
smallSize[0],
smallSize[1]);
};
fullscreen.appendTo = function(elem) {
wax.util.$(elem).appendChild(a);
return this;
Expand Down Expand Up @@ -1262,7 +1269,7 @@ wax.mm.interaction = function(map, tilejson, options) {
} else if (e.type === 'touchstart' && e.touches.length === 1) {

// turn this into touch-mode. Fallback to teaser and full.
this.clickAction = ['full', 'teaser'];
clickAction = ['full', 'teaser'];

// Don't make the user click close if they hit another tooltip
if (callbacks._currentTooltip) {
Expand Down Expand Up @@ -1293,7 +1300,7 @@ wax.mm.interaction = function(map, tilejson, options) {
_downLock = false;
if (e.type === 'touchend') {
// If this was a touch and it survived, there's no need to avoid a double-tap
click(_d);
click(e, _d);
} else if (Math.round(pos.y / tol) === Math.round(_d.y / tol) &&
Math.round(pos.x / tol) === Math.round(_d.x / tol)) {
// Contain the event data in a closure.
Expand Down Expand Up @@ -1757,16 +1764,17 @@ wax.mm.zoombox = function(map) {
// Use a flag to determine whether the zoombox is currently being
// drawn. Necessary only for IE because `mousedown` is triggered
// twice.
box = document.createElement('div');
box = box || document.createElement('div');
box.id = map.parent.id + '-zoombox-box';
box.className = 'zoombox-box';
map.parent.appendChild(box);
mm.addEvent(map.parent, 'mousedown', mouseDown);
return this;
};

zoombox.remove = function() {
map.parent.removeChild(box);
map.removeCallback('mousedown', mouseDown);
mm.removeEvent(map.parent, 'mousedown', mouseDown);
};

return zoombox.add(map);
Expand Down
4 changes: 2 additions & 2 deletions dist/wax.mm.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/wax.ol.js
@@ -1,4 +1,4 @@
/* wax - 3.0.0 - 1.0.4-321-g053540e */
/* wax - 3.0.2 - 1.0.4-322-ge7dc165 */


/*!
Expand Down Expand Up @@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;

var formatterUrl = function(url) {
Expand Down
4 changes: 2 additions & 2 deletions dist/wax.ol.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "wax",
"version": "3.0.0",
"version": "3.0.2",
"description": "Tools for improving web maps.",
"author": {
"name": "MapBox",
Expand Down

0 comments on commit 04364b9

Please sign in to comment.