Permalink
Browse files

Fix anyscale demo, rewrite transforms. Needs IE work.

  • Loading branch information...
1 parent da5bdd8 commit 2550d61dcc8c174839d864181be5400cfd23db1c @tmcw tmcw committed Mar 29, 2012
Showing with 13 additions and 41 deletions.
  1. +6 −20 modestmaps.js
  2. +1 −1 modestmaps.min.js
  3. +3 −7 src/layer.js
  4. +3 −13 src/utils.js
View
@@ -79,22 +79,12 @@ var MM = com.modestmaps = {
point.scale += (1 - point.scale * point.width % 1) / point.width;
}
+ var scale = point.scale || 1;
if (MM._browser.webkit3d) {
- return 'matrix3d(' +
- [(point.scale || '1'), '0,0,0,0',
- (point.scale || '1'), '0,0',
- '0,0,1,0',
- (point.x + (((point.width * point.scale) - point.width) / 2)).toFixed(4),
- (point.y + (((point.height * point.scale) - point.height) / 2)).toFixed(4),
- 0,1].join(',') + ')';
+ return 'scale3d(' + scale + ',' + scale + ', 1) translate3d(' + point.x.toFixed(6) + 'px,' + point.y.toFixed(6) + 'px, 0px)';
} else {
var unit = (MM.transformProperty == 'MozTransform') ? 'px' : '';
- return 'matrix(' +
- [(point.scale || '1'), 0, 0,
- (point.scale || '1'),
- (point.x + (((point.width * point.scale) - point.width) / 2)) + unit,
- (point.y + (((point.height * point.scale) - point.height) / 2)) + unit
- ].join(',') + ')';
+ return 'scale(' + scale + ',' + scale + ') translate(' + point.x.toFixed(6) + 'px,' + point.y.toFixed(6) + 'px)';
}
};
@@ -2012,13 +2002,9 @@ var MM = com.modestmaps = {
// position tiles
MM.moveElement(level, {
- x: Math.round(center.x - (theCoord.column * tileWidth)),
- y: Math.round(center.y - (theCoord.row * tileHeight)),
- scale: scale,
- // TODO: pass only scale or only w/h
- // width: this.map.tileSize.x,
- width: Math.pow(2, theCoord.zoom) * this.map.tileSize.x,
- height: Math.pow(2, theCoord.zoom) * this.map.tileSize.y
+ x: -(theCoord.column * 256) + center.x,
+ y: -(theCoord.row * 256) + center.y,
+ scale: scale
});
},
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -283,13 +283,9 @@
// position tiles
MM.moveElement(level, {
- x: Math.round(center.x - (theCoord.column * tileWidth)),
- y: Math.round(center.y - (theCoord.row * tileHeight)),
- scale: scale,
- // TODO: pass only scale or only w/h
- // width: this.map.tileSize.x,
- width: Math.pow(2, theCoord.zoom) * this.map.tileSize.x,
- height: Math.pow(2, theCoord.zoom) * this.map.tileSize.y
+ x: -(theCoord.column * 256) + center.x,
+ y: -(theCoord.row * 256) + center.y,
+ scale: scale
});
},
View
@@ -49,22 +49,12 @@
point.scale += (1 - point.scale * point.width % 1) / point.width;
}
+ var scale = point.scale || 1;
if (MM._browser.webkit3d) {
- return 'matrix3d(' +
- [(point.scale || '1'), '0,0,0,0',
- (point.scale || '1'), '0,0',
- '0,0,1,0',
- (point.x + (((point.width * point.scale) - point.width) / 2)).toFixed(4),
- (point.y + (((point.height * point.scale) - point.height) / 2)).toFixed(4),
- 0,1].join(',') + ')';
+ return 'scale3d(' + scale + ',' + scale + ', 1) translate3d(' + point.x.toFixed(6) + 'px,' + point.y.toFixed(6) + 'px, 0px)';
} else {
var unit = (MM.transformProperty == 'MozTransform') ? 'px' : '';
- return 'matrix(' +
- [(point.scale || '1'), 0, 0,
- (point.scale || '1'),
- (point.x + (((point.width * point.scale) - point.width) / 2)) + unit,
- (point.y + (((point.height * point.scale) - point.height) / 2)) + unit
- ].join(',') + ')';
+ return 'scale(' + scale + ',' + scale + ') translate(' + point.x.toFixed(6) + 'px,' + point.y.toFixed(6) + 'px)';
}
};

0 comments on commit 2550d61

Please sign in to comment.