-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the draggability of small objects (#5379)
* change to action logic * fixed test * added some tests
- Loading branch information
Showing
5 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,5 +77,6 @@ | |
"engines": { | ||
"node": ">=4.0.0" | ||
}, | ||
"main": "./dist/fabric.js" | ||
"main": "./dist/fabric.js", | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -644,8 +644,8 @@ | |
/** | ||
* @private | ||
*/ | ||
_getActionFromCorner: function(target, corner, e) { | ||
if (!corner) { | ||
_getActionFromCorner: function(alreadySelected, corner, e) { | ||
if (!corner || !alreadySelected) { | ||
return 'drag'; | ||
} | ||
|
||
|
@@ -668,14 +668,14 @@ | |
* @param {Event} e Event object | ||
* @param {fabric.Object} target | ||
*/ | ||
_setupCurrentTransform: function (e, target) { | ||
_setupCurrentTransform: function (e, target, alreadySelected) { | ||
if (!target) { | ||
return; | ||
} | ||
|
||
var pointer = this.getPointer(e), | ||
corner = target._findTargetCorner(this.getPointer(e, true)), | ||
action = this._getActionFromCorner(target, corner, e), | ||
action = this._getActionFromCorner(alreadySelected, corner, e), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
asturur
Author
Member
|
||
origin = this._getOriginFromCorner(target, corner); | ||
|
||
this._currentTransform = { | ||
|
@@ -1148,8 +1148,11 @@ | |
/** | ||
* Method that determines what object we are clicking on | ||
* the skipGroup parameter is for internal use, is needed for shift+click action | ||
* 11/09/2018 TODO: would be cool if findTarget could discern between being a full target | ||
* or the outside part of the corner. | ||
* @param {Event} e mouse event | ||
* @param {Boolean} skipGroup when true, activeGroup is skipped and only objects are traversed through | ||
* @return {fabric.Object} the target found | ||
*/ | ||
findTarget: function (e, skipGroup) { | ||
if (this.skipTargetFind) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I really miss
target
here. I let me overwrite this method and define behavior depending on target. How about bring it back @asturur ?