OSDN Git Service

commit the part that makes the map work
[automap/automap.git] / Automap / MapSRC / src / index.js
index 5b8dc9e..55abc93 100644 (file)
@@ -25,7 +25,6 @@ vf.reloadChunkList();
        });
 }());
 
-
 // #### CONTROLS ####
 // hovering
 (function () {
@@ -49,10 +48,17 @@ vf.reloadChunkList();
        var id;
        vf.map.canvas.addEventListener('wheel', event => {
                clearTimeout(id);
-               vf.zoom += -Math.sign(event.deltaY)*2;
                id = setTimeout(() => {
                        vf.render();
                }, 250);
+               // this makes it so zooming out is faster
+               let dir = -Math.sign(event.deltaY);
+               if (vf.zoom < 16) // arbitrary value
+                       vf.zoom += dir;
+               else
+                       vf.zoom += dir * 4;
+               if (vf.zoom <= 0)
+                       vf.zoom += 1; // make sure it doesnt go to negative values
        });
 }());