From e5830283ada6449447fc60018cdc61aafef0f753 Mon Sep 17 00:00:00 2001 From: hpnrep6 Date: Wed, 1 Sep 2021 13:16:35 -0400 Subject: [PATCH] Allow command key zoom on mac devices (#5419) * Allow command key zoom on mac devices * Clarify comment on mac command key zoom --- core/workspace_svg.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 21ee217ae..b513ed674 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1800,7 +1800,15 @@ Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) { } var scrollDelta = Blockly.utils.getScrollDeltaPixels(e); - if (canWheelZoom && (e.ctrlKey || !canWheelMove)) { + + // Zoom should also be enabled by the command key on Mac devices, + // but not super on Unix. + var commandKey; + if (Blockly.utils.userAgent.MAC) { + commandKey = e.metaKey; + } + + if (canWheelZoom && (e.ctrlKey || commandKey || !canWheelMove)) { // Zoom. // The vertical scroll distance that corresponds to a click of a zoom // button.