mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-15 17:23:09 +00:00
parent
068c815340
commit
e0546b0105
4 changed files with 22 additions and 9 deletions
|
|
@ -543,7 +543,8 @@
|
|||
target = this._activeObject;
|
||||
}
|
||||
|
||||
if (this.selection && (!target || (!target.selectable && !target.isEditing))) {
|
||||
if (this.selection && (!target ||
|
||||
(!target.selectable && !target.isEditing && target !== this._activeObject))) {
|
||||
this._groupSelector = {
|
||||
ex: pointer.x,
|
||||
ey: pointer.y,
|
||||
|
|
@ -553,16 +554,13 @@
|
|||
}
|
||||
|
||||
if (target) {
|
||||
if (target.selectable && (target.__corner || !shouldGroup)) {
|
||||
if ((target.selectable || target === this._activeObject) && (target.__corner || !shouldGroup)) {
|
||||
this._beforeTransform(e, target);
|
||||
this._setupCurrentTransform(e, target);
|
||||
}
|
||||
if (target.selectable) {
|
||||
this.setActiveObject(target, e);
|
||||
}
|
||||
else {
|
||||
this.discardActiveObject();
|
||||
}
|
||||
}
|
||||
this._handleEvent(e, 'down', target ? target : null);
|
||||
// we must renderAll so that we update the visuals
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
_shouldGroup: function(e, target) {
|
||||
var activeObject = this._activeObject;
|
||||
return e[this.selectionKey] && target && target.selectable && this.selection &&
|
||||
return activeObject && e[this.selectionKey] && target && target.selectable && this.selection &&
|
||||
(activeObject !== target || activeObject.type === 'activeSelection');
|
||||
},
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
_handleGrouping: function (e, target) {
|
||||
var activeObject = this._activeObject;
|
||||
if (activeObject.__corner !== 0) {
|
||||
if (activeObject.__corner) {
|
||||
return;
|
||||
}
|
||||
if (target === activeObject) {
|
||||
|
|
|
|||
|
|
@ -545,6 +545,16 @@
|
|||
*/
|
||||
dirty: true,
|
||||
|
||||
/**
|
||||
* keeps the value of the last hovered coner during mouse move.
|
||||
* 0 is no corner, or 'mt', 'ml', 'mtr' etc..
|
||||
* It should be private, but there is no harm in using it as
|
||||
* a read-only property.
|
||||
* @type number|string|any
|
||||
* @default 0
|
||||
*/
|
||||
__corner: 0,
|
||||
|
||||
/**
|
||||
* List of properties to consider when checking if state
|
||||
* of an object is changed (fabric.Object#hasStateChanged)
|
||||
|
|
|
|||
|
|
@ -1812,13 +1812,18 @@
|
|||
rect.selectable = false;
|
||||
canvas.__onMouseUp(e);
|
||||
canvas.__onMouseDown(e);
|
||||
deepEqual(canvas._groupSelector, expectedGroupSelector, 'with object non selectable groupSelector is started');
|
||||
deepEqual(canvas._groupSelector, null, 'with object non selectable but already selected groupSelector is not started');
|
||||
canvas.__onMouseUp(e);
|
||||
canvas.discardActiveObject();
|
||||
rect.isEditing = true;
|
||||
canvas.__onMouseUp(e);
|
||||
canvas.__onMouseDown(e);
|
||||
deepEqual(canvas._groupSelector, null, 'with object editing, groupSelector is not started');
|
||||
canvas.__onMouseUp(e);
|
||||
canvas.discardActiveObject();
|
||||
rect.isEditing = false;
|
||||
canvas.__onMouseDown(e);
|
||||
deepEqual(canvas._groupSelector, expectedGroupSelector, 'a new groupSelector is created');
|
||||
canvas.__onMouseUp(e);
|
||||
});
|
||||
|
||||
test('mouse:up isClick = true', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue