mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 17:37:49 +02:00
Merge branch 'master' of github.com:systemed/iD
This commit is contained in:
+4
-1
@@ -903,6 +903,10 @@ img.tile {
|
||||
-o-transform-origin:0 0;
|
||||
}
|
||||
|
||||
#surface {
|
||||
position: static;
|
||||
}
|
||||
|
||||
#tile-g {
|
||||
opacity: 0.5;
|
||||
}
|
||||
@@ -1333,7 +1337,6 @@ a.success-action {
|
||||
color: #222;
|
||||
font-size: 10px;
|
||||
padding: 0px 7px;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<script src='js/id/ui/radial_menu.js'></script>
|
||||
<script src='js/id/ui/inspector.js'></script>
|
||||
<script src='js/id/ui/modal.js'></script>
|
||||
<script src='js/id/ui/cmd.js'></script>
|
||||
<script src='js/id/ui/confirm.js'></script>
|
||||
<script src='js/id/ui/commit.js'></script>
|
||||
<script src='js/id/ui/success.js'></script>
|
||||
|
||||
@@ -24,7 +24,6 @@ iD.behavior.drag = function() {
|
||||
origin = null,
|
||||
selector = '',
|
||||
filter = null,
|
||||
keybinding = d3.keybinding('drag'),
|
||||
event_, target;
|
||||
|
||||
event.of = function(thiz, argumentz) {
|
||||
@@ -137,9 +136,6 @@ iD.behavior.drag = function() {
|
||||
drag.off = function(selection) {
|
||||
selection.on("mousedown.drag" + selector, null)
|
||||
.on("touchstart.drag" + selector, null);
|
||||
keybinding
|
||||
.on('⌘+Z', null)
|
||||
.on('⌃+Z', null);
|
||||
};
|
||||
|
||||
drag.delegate = function(_) {
|
||||
@@ -174,11 +170,5 @@ iD.behavior.drag = function() {
|
||||
return drag;
|
||||
};
|
||||
|
||||
keybinding
|
||||
.on('⌘+Z', drag.cancel)
|
||||
.on('⌃+Z', drag.cancel);
|
||||
|
||||
d3.select(document).call(keybinding);
|
||||
|
||||
return d3.rebind(drag, event, "on");
|
||||
};
|
||||
|
||||
@@ -36,6 +36,8 @@ iD.behavior.DragNode = function(context) {
|
||||
}
|
||||
|
||||
function start(entity) {
|
||||
context.history()
|
||||
.on('undone.drag-node', cancel);
|
||||
|
||||
wasMidpoint = entity.type === 'midpoint';
|
||||
if (wasMidpoint) {
|
||||
@@ -95,12 +97,7 @@ iD.behavior.DragNode = function(context) {
|
||||
}
|
||||
|
||||
function end(entity) {
|
||||
context.surface()
|
||||
.classed('behavior-drag-node', false)
|
||||
.selectAll('.active')
|
||||
.classed('active', false);
|
||||
|
||||
stopNudge();
|
||||
off();
|
||||
|
||||
var d = datum();
|
||||
if (d.type === 'way') {
|
||||
@@ -132,6 +129,23 @@ iD.behavior.DragNode = function(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function off() {
|
||||
context.history()
|
||||
.on('undone.drag_node', null);
|
||||
|
||||
context.surface()
|
||||
.classed('behavior-drag-node', false)
|
||||
.selectAll('.active')
|
||||
.classed('active', false);
|
||||
|
||||
stopNudge();
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
off();
|
||||
behavior.cancel();
|
||||
}
|
||||
|
||||
var behavior = iD.behavior.drag()
|
||||
.delegate("g.node, g.midpoint")
|
||||
.origin(origin)
|
||||
|
||||
+5
-13
@@ -200,20 +200,14 @@ iD.ui = function(context) {
|
||||
}
|
||||
}
|
||||
|
||||
var mod = {
|
||||
'mac': '⌘',
|
||||
'win': 'Ctrl',
|
||||
'linux': 'Ctrl'
|
||||
}[iD.detect().os];
|
||||
|
||||
limiter.select('#undo')
|
||||
.classed('disabled', !undo)
|
||||
.attr('data-original-title', hintprefix(mod + ' + Z', undo || t('nothing_to_undo')))
|
||||
.attr('data-original-title', hintprefix(iD.ui.cmd('⌘Z'), undo || t('nothing_to_undo')))
|
||||
.call(refreshTooltip);
|
||||
|
||||
limiter.select('#redo')
|
||||
.classed('disabled', !redo)
|
||||
.attr('data-original-title', hintprefix(mod + ' + ⇧ + Z', redo || t('nothing_to_redo')))
|
||||
.attr('data-original-title', hintprefix(iD.ui.cmd('⌘⇧Z'), redo || t('nothing_to_redo')))
|
||||
.call(refreshTooltip);
|
||||
});
|
||||
|
||||
@@ -232,16 +226,14 @@ iD.ui = function(context) {
|
||||
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(iD.ui.cmd('⌘Z'), function() { history.undo(); })
|
||||
.on(iD.ui.cmd('⌘⇧Z'), function() { history.redo(); })
|
||||
.on('⌫', function() { d3.event.preventDefault(); })
|
||||
.on('←', pan([pa, 0]))
|
||||
.on('↑', pan([0, pa]))
|
||||
.on('→', pan([-pa, 0]))
|
||||
.on('↓', pan([0, -pa]))
|
||||
.on('⇧+=', function() { map.zoomIn(); })
|
||||
.on('⇧=', function() { map.zoomIn(); })
|
||||
.on('+', function() { map.zoomIn(); })
|
||||
.on('-', function() { map.zoomOut(); })
|
||||
.on('dash', function() { map.zoomOut(); });
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Translate a MacOS key command into the appropriate Windows/Linux equivalent.
|
||||
// For example, ⌘Z -> Ctrl+Z
|
||||
iD.ui.cmd = function(code) {
|
||||
if (iD.detect().os === 'mac')
|
||||
return code;
|
||||
|
||||
var modifiers = {
|
||||
'⌘': 'Ctrl',
|
||||
'⇧': 'Shift',
|
||||
'⌥': 'Alt'
|
||||
}, keys = [];
|
||||
|
||||
for (var i = 0; i < code.length; i++) {
|
||||
if (code[i] in modifiers) {
|
||||
keys.push(modifiers[code[i]]);
|
||||
} else {
|
||||
keys.push(code[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return keys.join('+');
|
||||
};
|
||||
@@ -63,7 +63,7 @@ d3.keybinding = function(namespace) {
|
||||
callback: callback
|
||||
};
|
||||
|
||||
code = code.toLowerCase().match(/(?:(?:[^+])+|\+\+|^\+$)/g);
|
||||
code = code.toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
|
||||
|
||||
for (var i = 0; i < code.length; i++) {
|
||||
// Normalise matching errors
|
||||
|
||||
Reference in New Issue
Block a user