Skip to content

Commit

Permalink
fix mac control/command key when selecting multiple objects. Fixed #146
Browse files Browse the repository at this point in the history
  • Loading branch information
evolus authored and evolus committed Sep 5, 2016
1 parent 6a269d2 commit bfac063
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/pencil-core/common/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ Canvas.prototype.handleMouseUp = function (event) {
this.setRangeBoundVisibility(false);
this.isSelectingRange = false;
// enum objects that are in range
if (!event.ctrlKey) {
if (!this.isEventWithControl(event)) {
this.clearSelection();
}
var thiz = this;
Expand All @@ -963,7 +963,7 @@ Canvas.prototype.handleMouseUp = function (event) {
var bbox = controller.getBoundingRect();

if (Svg.isInside(bbox, thiz.currentRange)) {
if (event.ctrlKey) {
if (thiz.isEventWithControl(event)) {
var targets = thiz.getSelectedTargets();
var foundTarget = null;
for (i in targets) {
Expand Down Expand Up @@ -2110,7 +2110,7 @@ Canvas.prototype.handleMouseDown = function (event) {

thiz.duplicateFunc = null;
}
} else if (event.ctrlKey) {
} else if (this.isEventWithControl(event)) {
if (foundTarget) {
this.removeFromSelection(foundTarget);
} else {
Expand Down Expand Up @@ -2173,6 +2173,9 @@ Canvas.prototype.handleMouseDown = function (event) {

};

Canvas.prototype.isEventWithControl = function (event) {
return (event.ctrlKey && !IS_MAC) || (event.metaKey && IS_MAC);
};
Canvas.prototype.doGroup = function () {

this.run(this.doGroupImpl_, this, Util.getMessage("action.group.shapes"));
Expand Down

0 comments on commit bfac063

Please sign in to comment.