Merge pull request #16443 from ctrlaltdavid/DEV-2646

DEV-2646: Use Alt to clone entities on Mac
This commit is contained in:
Shannon Romano 2019-11-19 14:02:10 -08:00 committed by GitHub
commit a5943f8ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1118,8 +1118,9 @@ SelectionDisplay = (function() {
return false; return false;
} }
// No action if the Alt key is pressed. // No action if the Alt key is pressed unless on Mac.
if (event.isAlt) { var isMac = Controller.getValue(Controller.Hardware.Application.PlatformMac);
if (event.isAlt && !isMac) {
return; return;
} }
@ -2044,10 +2045,11 @@ SelectionDisplay = (function() {
Vec3.print(" pickResult.intersection", pickResult.intersection); Vec3.print(" pickResult.intersection", pickResult.intersection);
} }
// Duplicate entities if Ctrl is pressed. This will make a // Duplicate entities if Ctrl is pressed on Windows or Alt is press on Mac.
// copy of the selected entities and move the _original_ entities, not // This will make a copy of the selected entities and move the _original_ entities, not the new ones.
// the new ones. var isMac = Controller.getValue(Controller.Hardware.Application.PlatformMac);
if (event.isControl || doDuplicate) { var isDuplicate = isMac ? event.isAlt : event.isControl;
if (isDuplicate || doDuplicate) {
duplicatedEntityIDs = SelectionManager.duplicateSelection(); duplicatedEntityIDs = SelectionManager.duplicateSelection();
var ids = []; var ids = [];
for (var i = 0; i < duplicatedEntityIDs.length; ++i) { for (var i = 0; i < duplicatedEntityIDs.length; ++i) {
@ -2270,10 +2272,11 @@ SelectionDisplay = (function() {
addHandleTool(overlay, { addHandleTool(overlay, {
mode: mode, mode: mode,
onBegin: function(event, pickRay, pickResult) { onBegin: function(event, pickRay, pickResult) {
// Duplicate entities if Ctrl is pressed. This will make a // Duplicate entities if Ctrl is pressed on Windows or Alt is pressed on Mac.
// copy of the selected entities and move the _original_ entities, not // This will make a copy of the selected entities and move the _original_ entities, not the new ones.
// the new ones. var isMac = Controller.getValue(Controller.Hardware.Application.PlatformMac);
if (event.isControl) { var isDuplicate = isMac ? event.isAlt : event.isControl;
if (isDuplicate) {
duplicatedEntityIDs = SelectionManager.duplicateSelection(); duplicatedEntityIDs = SelectionManager.duplicateSelection();
var ids = []; var ids = [];
for (var i = 0; i < duplicatedEntityIDs.length; ++i) { for (var i = 0; i < duplicatedEntityIDs.length; ++i) {