Adds increased zoom keyboard shortcuts.

This commit is contained in:
Rowan Hogan
2015-06-13 15:24:48 +10:00
parent 20e619ea21
commit 9aa1ffa227
3 changed files with 20 additions and 2 deletions
+2
View File
@@ -264,6 +264,8 @@ window.iD = function () {
context.pan = map.pan;
context.zoomIn = map.zoomIn;
context.zoomOut = map.zoomOut;
context.zoomInFurther = map.zoomInFurther;
context.zoomOutFurther = map.zoomOutFurther;
context.surfaceRect = function() {
// Work around a bug in Firefox.
+13 -2
View File
@@ -327,8 +327,19 @@ iD.Map = function(context) {
return redraw();
};
map.zoomIn = function() { interpolateZoom(~~map.zoom() + 1); };
map.zoomOut = function() { interpolateZoom(~~map.zoom() - 1); };
function zoomIn(integer) {
interpolateZoom(~~map.zoom() + integer);
}
function zoomOut(integer) {
interpolateZoom(~~map.zoom() - integer);
}
map.zoomIn = function() { zoomIn(1); };
map.zoomInFurther = function() { zoomIn(4); };
map.zoomOut = function() { zoomOut(1); };
map.zoomOutFurther = function() { zoomOut(4); };
map.center = function(loc) {
if (!arguments.length) {
+5
View File
@@ -33,10 +33,15 @@ iD.ui.Zoom = function(context) {
_.each(['=','ffequals','plus','ffplus'], function(key) {
keybinding.on(key, function() { context.zoomIn(); });
keybinding.on('⇧' + key, function() { context.zoomIn(); });
keybinding.on('ctrl+' + key, function() { context.zoomInFurther(); });
keybinding.on('ctrl+⇧' + key, function() { context.zoomInFurther(); });
});
_.each(['-','ffminus','_','dash'], function(key) {
keybinding.on(key, function() { context.zoomOut(); });
keybinding.on('⇧' + key, function() { context.zoomOut(); });
keybinding.on('ctrl+' + key, function() { context.zoomOutFurther(); });
keybinding.on('ctrl+⇧' + key, function() { context.zoomOutFurther(); });
});
d3.select(document)