mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
Pan, fix initial loads
This commit is contained in:
@@ -66,11 +66,9 @@ iD.behavior.Hash = function(context) {
|
||||
|
||||
if (location.hash) {
|
||||
var q = iD.util.stringQs(location.hash.substring(1));
|
||||
if (q.id) {
|
||||
willselect(q.id);
|
||||
}
|
||||
if (q.id) willselect(q.id);
|
||||
hashchange();
|
||||
hash.hadHash = true;
|
||||
if (q.map) hash.hadHash = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-5
@@ -92,14 +92,17 @@ window.iD = function () {
|
||||
return context;
|
||||
};
|
||||
|
||||
var q = iD.util.stringQs(location.hash.substring(1));
|
||||
var q = iD.util.stringQs(location.hash.substring(1)), detected = false;
|
||||
if (q.layer) {
|
||||
context.background()
|
||||
.source(_.find(iD.layers, function(l) {
|
||||
return l.data.sourcetag === q.layer;
|
||||
}));
|
||||
.source(_.find(iD.layers, function(l) {
|
||||
if (l.data.sourcetag === q.layer) {
|
||||
return (detected = true);
|
||||
}
|
||||
}));
|
||||
}
|
||||
if (!context.background()) {
|
||||
|
||||
if (!detected) {
|
||||
context.background()
|
||||
.source(_.find(iD.layers, function(l) {
|
||||
return l.data.name === 'Bing aerial imagery';
|
||||
|
||||
+15
-1
@@ -232,12 +232,26 @@ iD.ui = function(context) {
|
||||
map.size(m.size());
|
||||
});
|
||||
|
||||
function pan(d) {
|
||||
return function() {
|
||||
map.pan(d);
|
||||
map.redraw();
|
||||
};
|
||||
}
|
||||
|
||||
// pan amount
|
||||
var pa = 5;
|
||||
|
||||
var keybinding = d3.keybinding('main')
|
||||
.on('⌘+Z', function() { history.undo(); })
|
||||
.on('⌃+Z', function() { history.undo(); })
|
||||
.on('⌘+⇧+Z', function() { history.redo(); })
|
||||
.on('⌃+⇧+Z', function() { history.redo(); })
|
||||
.on('⌫', function() { d3.event.preventDefault(); });
|
||||
.on('⌫', function() { d3.event.preventDefault(); })
|
||||
.on('←', pan([pa, 0]))
|
||||
.on('↑', pan([0, pa]))
|
||||
.on('→', pan([-pa, 0]))
|
||||
.on('↓', pan([0, -pa]));
|
||||
|
||||
modes.forEach(function(m) {
|
||||
keybinding.on(m.key, function() { if (map.editable()) context.enter(m); });
|
||||
|
||||
Reference in New Issue
Block a user