Browse files

Fix template-only tilesets and interaction

  • Loading branch information...
1 parent ce7cda7 commit df745585b1923255d5907efa43adc0ab3f18d1a2 @tmcw tmcw committed Oct 28, 2011
Showing with 16 additions and 8 deletions.
  1. +8 −6 models/Tileset.server.bones
  2. +1 −1 servers/Tile.bones
  3. +7 −1 views/MapClient.bones
View
14 models/Tileset.server.bones
@@ -11,13 +11,15 @@ models.Tileset.syncread = function(data, options) {
protocol: 'http:'
});
});
- if (data.formatter) data.grids = data.grids || _(options.tileHost).map(function(host) {
- return url.format({
- host: host,
- pathname: options.basepath + 'v2/' + data.id + '/{z}/{x}/{y}.grid.json',
- protocol: 'http:'
+ if (data.formatter || data.template) {
+ data.grids = data.grids || _(options.tileHost).map(function(host) {
+ return url.format({
+ host: host,
+ pathname: options.basepath + 'v2/' + data.id + '/{z}/{x}/{y}.grid.json',
+ protocol: 'http:'
+ });
});
- });
+ }
if (data.basename) data.download = url.format({
host: options.tileHost[0],
pathname: options.basepath + 'v2/' + data.basename,
View
2 servers/Tile.bones
@@ -26,7 +26,7 @@ server = Bones.Server.extend({
this.get('/v2/:tileset/:z/:x/:y.(png|jpg|jpeg)', this.tile);
this.get('/v2/:tileset/:z/:x/:y.grid.json', this.grid);
- this.get('/v2/:tileset/layer.json', this.layer);
+ this.get('/v2/:tileset.json', this.layer);
this.get('/v2/:tileset.mbtiles', this.download);
this.get('/crossdomain.xml', this.crossdomainXML);
View
8 views/MapClient.bones
@@ -17,15 +17,21 @@ view = Backbone.View.extend({
}
var center = this.model.get('center');
+ var tj = this.model.toJSON();
var map = new mm.Map(this.el,
- new wax.mm.connector(this.model.toJSON())
+ new wax.mm.connector(tj)
).setCenterZoom(
new mm.Location(center[1], center[0]
), center[2]);
wax.mm.zoomer(map).appendTo(map.parent);
wax.mm.zoombox(map);
wax.mm.attribution(map).appendTo(map.parent);
+
+ if (tj.grids) {
+ wax.mm.interaction(map, tj);
+ }
+
map.addCallback('zoomed', mmNav);
map.addCallback('extentset', mmNav);
mmNav();

0 comments on commit df74558

Please sign in to comment.