Skip to content

Commit

Permalink
Fix groupSelector on editing Text (#3901)
Browse files Browse the repository at this point in the history
* fix for drag on editing text

* updated test
  • Loading branch information
asturur committed Apr 30, 2017
1 parent 4808eb3 commit ce0962d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mixins/canvas_events.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
target = this.getActiveGroup();
}

if (this.selection && (!target || !target.selectable)) {
if (this.selection && (!target || (!target.selectable && !target.isEditing))) {
this._groupSelector = {
ex: pointer.x,
ey: pointer.y,
Expand Down
9 changes: 7 additions & 2 deletions test/unit/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,9 +1768,14 @@
canvas.__onMouseDown(e);
deepEqual(canvas._groupSelector, expectedGroupSelector, 'with object non selectable groupSelector is started');
canvas.__onMouseUp(e);
rect.isEditing = true;
canvas.__onMouseUp(e);
canvas.__onMouseDown(e);
deepEqual(canvas._groupSelector, null, 'with object editing, groupSelector is not started');
canvas.__onMouseUp(e);
});

test('mouse:down and group selector isClick = true', function() {
test('mouse:up isClick = true', function() {
var e = { clientX: 30, clientY: 30, which: 1 };
var isClick = false;
canvas.on('mouse:up', function(opt) {
Expand All @@ -1781,7 +1786,7 @@
equal(isClick, true, 'without moving the pointer, the click is true');
});

test('mouse:down and group selector isClick = false', function() {
test('mouse:up isClick = false', function() {
var e = { clientX: 30, clientY: 30, which: 1 };
var e2 = { clientX: 31, clientY: 31, which: 1 };
var isClick = true;
Expand Down

0 comments on commit ce0962d

Please sign in to comment.