From 3487d0596ff64a3bfbfc00e8187e34d9eb2ba0ab Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 29 Jun 2012 13:23:30 -0700 Subject: Timeline: Bug fix: IKNINJA-1857, "Using keyboard shortcut for chrome-preview causes each layer in the timeline to remain selected even when clicking on another layer." --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index b0ab3b19..4c349247 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -1369,8 +1369,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { targetIndex = 0, isAlreadySelected = false, indexAlreadySelected = 0, - indexLastClicked = 0; - + indexLastClicked = 0, + ua = navigator.userAgent.toLowerCase(), + boolCommandControlKeyIsPressed = false; + + // Check to see if either the Command key (macs) or Control key (windows) is being pressed + if (ua.indexOf("mac") > -1) { + if (event.metaKey === true) { + boolCommandControlKeyIsPressed = true; + } + } else { + if (this._isControlPressed === true) { + boolCommandControlKeyIsPressed = true; + } + } + // Did the mousedown event originate within a layer? if (ptrParent === false) { // No it did not. Do nothing. @@ -1406,8 +1419,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } else { // Something is already selected. What do do depends on whether // or not other keys are pressed. - if (this._isControlPressed === true) { - // Control key is being pressed, so we need to + if (boolCommandControlKeyIsPressed === true) { + // Control or Command key is being pressed, so we need to // either add the current layer to selectedLayers // or remove it if it's already there. if (this.currentLayersSelected === false) { @@ -1467,9 +1480,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Control key has been pressed this._isControlPressed = true; } + /* if (event.metaKey === true) { this._isControlPressed = true; } + */ } }, -- cgit v1.2.3 From f065c2bc664e9c8e4e97f8b6f6b684c310233f89 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 29 Jun 2012 14:21:08 -0700 Subject: Timeline: Bug fix: Unable to reselect a layer with control-click that was previously just deselected with control-click. (Yes, that's a weird one.) --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 4c349247..7deaf0d1 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -1368,7 +1368,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { arrLayersLength = arrLayers.length, targetIndex = 0, isAlreadySelected = false, - indexAlreadySelected = 0, + indexAlreadySelected = -5, indexLastClicked = 0, ua = navigator.userAgent.toLowerCase(), boolCommandControlKeyIsPressed = false; @@ -1383,6 +1383,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { boolCommandControlKeyIsPressed = true; } } + // Did the mousedown event originate within a layer? if (ptrParent === false) { @@ -1400,17 +1401,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Did we just click on a layer that's already selected? if (this.currentLayersSelected !== false) { - indexAlreadySelected = this.currentLayersSelected.indexOf(targetIndex); + for (i = 0; i < this.currentLayersSelected.length; i++) { + if (this.currentLayersSelected[i] === targetIndex) { + indexAlreadySelected = i; + } + } } if (indexAlreadySelected > -1) { isAlreadySelected = true; } - - /* - if (targetIndex > -1) { - indexLastClicked = targetIndex; - } - */ // Now, do the selection based on all of that information. if (this.currentLayersSelected.length === 0) { @@ -1425,7 +1424,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // or remove it if it's already there. if (this.currentLayersSelected === false) { this.currentLayersSelected = []; - //this.currentLayerSelected = false; } if (isAlreadySelected === false) { this.currentLayersSelected.push(targetIndex); @@ -1457,9 +1455,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.currentLayersSelected = [targetIndex]; this.lastLayerClicked = targetIndex; } - } - //this._captureSelection = true; this.selectLayers(this.currentLayersSelected); this.updateStageSelection(); } -- cgit v1.2.3