Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No commit message

  • Loading branch information...
commit 968fb440a75d1450035f41699fce2af1ba524a6f 1 parent f94c180
@RandomEtc RandomEtc authored
Showing with 21 additions and 19 deletions.
  1. +21 −19 index.html
View
40 index.html
@@ -171,24 +171,26 @@
.on('mousewheel', function() {
var dz = d3.event.wheelDelta > 0 ? 0.05 : d3.event.wheelDelta < 0 ? -0.05 : 0.0,
power = Math.pow(2,dz);
- if (dz != 0 && (coord[2] > 0 && coord[2] < 18)) {
- var mouse = [ d3.event.pageX, d3.event.pageY ];
- coord = [
- coord[0] + ((mouse[0]-center[0]) / tileSize[0]),
- coord[1] + ((mouse[1]-center[1]) / tileSize[1]),
- coord[2]
- ];
- coord = [
- coord[0] * power,
- coord[1] * power,
- coord[2] + dz
- ];
- coord = [
- coord[0] - ((mouse[0]-center[0]) / tileSize[0]),
- coord[1] - ((mouse[1]-center[1]) / tileSize[1]),
- coord[2]
- ];
- d3.timer(redraw);
+ if (dz != 0) {
+ if ((dz > 0 && coord[2] < 18) || (dz < 0 && coord[2] > 0)) {
+ var mouse = [ d3.event.pageX, d3.event.pageY ];
+ coord = [
+ coord[0] + ((mouse[0]-center[0]) / tileSize[0]),
+ coord[1] + ((mouse[1]-center[1]) / tileSize[1]),
+ coord[2]
+ ];
+ coord = [
+ coord[0] * power,
+ coord[1] * power,
+ coord[2] + dz
+ ];
+ coord = [
+ coord[0] - ((mouse[0]-center[0]) / tileSize[0]),
+ coord[1] - ((mouse[1]-center[1]) / tileSize[1]),
+ coord[2]
+ ];
+ d3.timer(redraw);
+ }
}
d3.event.preventDefault();
d3.event.stopPropagation();
@@ -225,4 +227,4 @@
<body>
<div id="#map"></div>
</body>
-</html>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.