From bd75c1c75352f39305c8b7efb779144dc145ecef Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Tue, 28 Oct 2014 09:03:00 +0000 Subject: [PATCH] Better attempt at adding Apple meta key --- public/red/ui/keyboard.js | 8 ++++---- public/red/ui/view.js | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/public/red/ui/keyboard.js b/public/red/ui/keyboard.js index e1fc14161..f34bf51a8 100644 --- a/public/red/ui/keyboard.js +++ b/public/red/ui/keyboard.js @@ -24,8 +24,8 @@ RED.keyboard = (function() { if (handler && handler.ondown) { if (!handler.modifiers || ((!handler.modifiers.shift || d3.event.shiftKey) && - (!handler.modifiers.ctrl || !handler.modifiers.meta || d3.event.ctrlKey || d3.event.metaKey) && - (!handler.modifiers.alt || d3.event.altKey ) )) { + ((!handler.modifiers.ctrl || d3.event.ctrlKey) || (!handler.modifiers.meta || d3.event.metaKey)) && + (!handler.modifiers.alt || d3.event.altKey ) )) { handler.ondown(); } } @@ -37,8 +37,8 @@ RED.keyboard = (function() { if (handler && handler.onup) { if (!handler.modifiers || ((!handler.modifiers.shift || d3.event.shiftKey) && - (!handler.modifiers.ctrl || !handler.modifiers.meta || d3.event.ctrlKey || d3.event.metaKey) && - (!handler.modifiers.alt || d3.event.altKey ) )) { + ((!handler.modifiers.ctrl || d3.event.ctrlKey) || (!handler.modifiers.meta || d3.event.metaKey)) && + (!handler.modifiers.alt || d3.event.altKey ) )) { handler.onup(); } } diff --git a/public/red/ui/view.js b/public/red/ui/view.js index 275cbe1c2..de44958f7 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -651,8 +651,8 @@ RED.view = (function() { } else { RED.keyboard.add(/* backspace */ 8,function(){deleteSelection();d3.event.preventDefault();}); RED.keyboard.add(/* delete */ 46,function(){deleteSelection();d3.event.preventDefault();}); - RED.keyboard.add(/* c */ 67,{ctrl:true},function(){copySelection();d3.event.preventDefault();}); - RED.keyboard.add(/* x */ 88,{ctrl:true},function(){copySelection();deleteSelection();d3.event.preventDefault();}); + RED.keyboard.add(/* c */ 67,{ctrl:true,meta:true},function(){copySelection();d3.event.preventDefault();}); + RED.keyboard.add(/* x */ 88,{ctrl:true,meta:true},function(){copySelection();deleteSelection();d3.event.preventDefault();}); } if (moving_set.length === 0) { RED.keyboard.remove(/* up */ 38); @@ -1369,14 +1369,14 @@ RED.view = (function() { } } - RED.keyboard.add(/* z */ 90,{ctrl:true},function(){RED.history.pop();}); - RED.keyboard.add(/* a */ 65,{ctrl:true},function(){selectAll();d3.event.preventDefault();}); - RED.keyboard.add(/* = */ 187,{ctrl:true},function(){zoomIn();d3.event.preventDefault();}); - RED.keyboard.add(/* - */ 189,{ctrl:true},function(){zoomOut();d3.event.preventDefault();}); - RED.keyboard.add(/* 0 */ 48,{ctrl:true},function(){zoomZero();d3.event.preventDefault();}); - RED.keyboard.add(/* v */ 86,{ctrl:true},function(){importNodes(clipboard);d3.event.preventDefault();}); - RED.keyboard.add(/* e */ 69,{ctrl:true},function(){showExportNodesDialog();d3.event.preventDefault();}); - RED.keyboard.add(/* i */ 73,{ctrl:true},function(){showImportNodesDialog();d3.event.preventDefault();}); + RED.keyboard.add(/* z */ 90,{ctrl:true,meta:true},function(){RED.history.pop();}); + RED.keyboard.add(/* a */ 65,{ctrl:true,meta:true},function(){selectAll();d3.event.preventDefault();}); + RED.keyboard.add(/* = */ 187,{ctrl:true,meta:true},function(){zoomIn();d3.event.preventDefault();}); + RED.keyboard.add(/* - */ 189,{ctrl:true,meta:true},function(){zoomOut();d3.event.preventDefault();}); + RED.keyboard.add(/* 0 */ 48,{ctrl:true,meta:true},function(){zoomZero();d3.event.preventDefault();}); + RED.keyboard.add(/* v */ 86,{ctrl:true,meta:true},function(){importNodes(clipboard);d3.event.preventDefault();}); + RED.keyboard.add(/* e */ 69,{ctrl:true,meta:true},function(){showExportNodesDialog();d3.event.preventDefault();}); + RED.keyboard.add(/* i */ 73,{ctrl:true,meta:true},function(){showImportNodesDialog();d3.event.preventDefault();}); // TODO: 'dirty' should be a property of RED.nodes - with an event callback for ui hooks function setDirty(d) {