Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating tests and examples.

  • Loading branch information...
commit 03a44254180d4f04266e56d12fc9a300d018a22e 1 parent 22cea3e
@tmcw tmcw authored
View
4 CHANGELOG
@@ -8,6 +8,10 @@ Following the semantic versioning recommendation best we can:
minor version, and backwards incompatible API changes increment
the major version." -- http://semver.org/
+v1.0.0-alpha
+- Removes TilePaintingProvider and auto-casting to it in setProvider,
+ updating all examples.
+
v1.0.0 (dev)
- `map.setSize` now only accepts an object of the form `{x: 0, y: 0}` or a
`MM.Point` object, and it calls its callback with a `MM.Point` argument.
View
36 examples/cloudmade/cloudmade.html
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Modest Maps JS</title>
-<script type="text/javascript" src="../../modestmaps.js"></script>
-<script type="text/javascript" src="cloudmade.js"></script>
-<script type="text/javascript">
- var map; // declared here so it can be accessed by javascript: links
- function initMap() {
- var src = document.getElementById('src');
- eval(src.textContent || src.innerText);
- }
-</script>
-</head>
-<body onload="initMap()">
-<h1>Modest Maps JS</h1>
-<p><a href="javascript:map.zoomIn()">zoom in</a> | <a href="javascript:map.zoomOut()">zoom out</a>
-<br><a href="javascript:map.panLeft()">pan left</a> | <a href="javascript:map.panRight()">pan right</a> | <a href="javascript:map.panDown()">pan down</a> | <a href="javascript:map.panUp()">pan up</a></p>
-<div id="map" style="background:#eee">
-</div>
-<p>The above div is a map initialized like so:</p>
-<pre id="src">
-// "import" the namespace
-var MM = com.modestmaps;
-
-// please use your own API key, see http://developers.cloudmade.com/ for more details
-var provider = new MM.CloudMadeProvider('1a914755a77758e49e19a26e799268b7','998');
-
-map = new MM.Map('map', provider, new MM.Point(640,480))
-
-map.setCenterZoom(new MM.Location(37.804656, -122.263606), 14);
-</pre>
-<p>Hands up who wants overlays?</p>
-<div id="log"></div>
-</body>
-</html>
View
6 examples/cloudmade/cloudmade.js
@@ -8,7 +8,7 @@ MM.CloudMadeProvider = function(key, style) {
this.style = style;
this.tileWidth = 256;
this.tileHeight = 256;
-}
+};
MM.CloudMadeProvider.prototype = {
key: null,
@@ -16,10 +16,10 @@ MM.CloudMadeProvider.prototype = {
getTile: function(coord) {
coord = this.sourceCoordinate(coord);
var worldSize = Math.pow(2, coord.zoom);
- var server = new Array('a.', 'b.', 'c.', '')[parseInt(worldSize * coord.row + coord.column) % 4];
+ var server = new Array('a.', 'b.', 'c.', '')[parseInt(worldSize * coord.row + coord.column, 10) % 4];
var imgPath = new Array(this.key, this.style, this.tileWidth, coord.zoom, coord.column, coord.row).join('/');
return 'http://' + server + 'tile.cloudmade.com/' + imgPath + '.png';
}
-}
+};
MM.extend(MM.CloudMadeProvider, MM.MapProvider);
View
16 examples/enforce-limits/index.html
@@ -5,10 +5,7 @@
<script type="text/javascript" src="../../modestmaps.js"></script>
<script type="text/javascript">
window.onload = function() {
-
// "import" the namespace
- var MM = com.modestmaps;
-
var provider = new MM.TemplatedMapProvider("http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png");
map = new MM.Map(document.body, provider)
@@ -19,12 +16,16 @@
var bottomRight = new MM.Location(21.5, -50.5);
// override map limits so that panning and zooming are constrained within these bounds:
- map.coordLimits = [ map.locationCoordinate(topLeft).zoomTo(minZoom),
- map.locationCoordinate(bottomRight).zoomTo(maxZoom) ];
+ map.coordLimits = [
+ map.locationCoordinate(topLeft).zoomTo(minZoom),
+ map.locationCoordinate(bottomRight).zoomTo(maxZoom)
+ ];
// override provider limits so that tiles are not loaded unless they are inside these bounds:
- provider.tileLimits = [ map.locationCoordinate(topLeft).zoomTo(minZoom),
- map.locationCoordinate(bottomRight).zoomTo(maxZoom) ];
+ provider.tileLimits = [
+ map.locationCoordinate(topLeft).zoomTo(minZoom),
+ map.locationCoordinate(bottomRight).zoomTo(maxZoom)
+ ];
// override sourceCoordinate so that it doesn't use coord limits to wrap tiles
// but so that it rejects any tile coordinates that lie outside the limits
@@ -44,7 +45,6 @@
}
map.setCenterZoom(new MM.Location(37.811530, -122.2666097), 5);
-
}
</script>
<style>
View
2  src/layer.js
@@ -506,6 +506,8 @@
};
},
+ // Remove this layer from the DOM, cancel all of its requests
+ // and unbind any callbacks that are bound to it.
destroy: function() {
this.requestManager.clear();
this.requestManager.removeCallback('requestcomplete', this.getTileComplete());
View
2  test/browser/spec/MouseWheelHandler.js
@@ -8,7 +8,7 @@ describe('MouseWheelHandler', function() {
div.style.height = 500;
var template = 'http://{S}tile.openstreetmap.org/{Z}/{X}/{Y}.png';
- var subdomains = [ '', 'a.', 'b.', 'c.' ];
+ var subdomains = [ '', 'a.', 'b.', 'c.' ];
var provider = new MM.TemplatedMapProvider(template, subdomains);
map = new MM.Map(div, provider, [
View
2  test/browser/spec/Provider.js
@@ -5,7 +5,7 @@ describe('Providers', function() {
var p = new MM.TemplatedMapProvider(
'http://{S}.tile.openstreetmap.org/{Z}/{X}/{Y}.png', ['a']);
- expect(p.getTileUrl(new MM.Coordinate(1225, 1832, 12))).toEqual(
+ expect(p.getTile(new MM.Coordinate(1225, 1832, 12))).toEqual(
'http://a.tile.openstreetmap.org/12/1832/1225.png');
});
});

0 comments on commit 03a4425

Please sign in to comment.
Something went wrong with that request. Please try again.