mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add ⌘ Cmd key as alternative to Ctrl key to make Mac users happy.
This commit is contained in:
parent
bbaf7bf247
commit
c51866c2c5
@ -136,6 +136,9 @@
|
|||||||
<td><span class="help-key">Ctrl</span> <span class="help-key">+</span></td><td>Zoom in</td>
|
<td><span class="help-key">Ctrl</span> <span class="help-key">+</span></td><td>Zoom in</td>
|
||||||
<td><span class="help-key">Ctrl</span> <span class="help-key">-</span></td><td>Zoom out</td>
|
<td><span class="help-key">Ctrl</span> <span class="help-key">-</span></td><td>Zoom out</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">Mac users can use the <b>⌘ - Cmd</b> key rather than Ctrl key.</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
@ -24,19 +24,20 @@ RED.keyboard = (function() {
|
|||||||
if (handler && handler.ondown) {
|
if (handler && handler.ondown) {
|
||||||
if (!handler.modifiers ||
|
if (!handler.modifiers ||
|
||||||
((!handler.modifiers.shift || d3.event.shiftKey) &&
|
((!handler.modifiers.shift || d3.event.shiftKey) &&
|
||||||
(!handler.modifiers.ctrl || d3.event.ctrlKey ) &&
|
(!handler.modifiers.ctrl || !handler.modifiers.meta || d3.event.ctrlKey || d3.event.metaKey) &&
|
||||||
(!handler.modifiers.alt || d3.event.altKey ) )) {
|
(!handler.modifiers.alt || d3.event.altKey ) )) {
|
||||||
handler.ondown();
|
handler.ondown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
d3.select(window).on("keyup",function() {
|
d3.select(window).on("keyup",function() {
|
||||||
if (!active) { return; }
|
if (!active) { return; }
|
||||||
var handler = handlers[d3.event.keyCode];
|
var handler = handlers[d3.event.keyCode];
|
||||||
if (handler && handler.onup) {
|
if (handler && handler.onup) {
|
||||||
if (!handler.modifiers ||
|
if (!handler.modifiers ||
|
||||||
((!handler.modifiers.shift || d3.event.shiftKey) &&
|
((!handler.modifiers.shift || d3.event.shiftKey) &&
|
||||||
(!handler.modifiers.ctrl || d3.event.ctrlKey ) &&
|
(!handler.modifiers.ctrl || !handler.modifiers.meta || d3.event.ctrlKey || d3.event.metaKey) &&
|
||||||
(!handler.modifiers.alt || d3.event.altKey ) )) {
|
(!handler.modifiers.alt || d3.event.altKey ) )) {
|
||||||
handler.onup();
|
handler.onup();
|
||||||
}
|
}
|
||||||
@ -46,7 +47,6 @@ RED.keyboard = (function() {
|
|||||||
var mod = modifiers;
|
var mod = modifiers;
|
||||||
var cbdown = ondown;
|
var cbdown = ondown;
|
||||||
var cbup = onup;
|
var cbup = onup;
|
||||||
|
|
||||||
if (typeof modifiers == "function") {
|
if (typeof modifiers == "function") {
|
||||||
mod = {};
|
mod = {};
|
||||||
cbdown = modifiers;
|
cbdown = modifiers;
|
||||||
|
Loading…
Reference in New Issue
Block a user