-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group selection Resize and Rotate not working when canvas has perPixelTargetFind true #6631
Comments
does it work with normal objects? |
Yes, it works fine with a single object. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
That's still an issue, I don't think it should be closed |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Unfortunately still a problem on linux environment. |
I do not have any linux machine to test it out. |
No the problem is clearly on macOS too. |
Tested on windows - seems to be fine, but on Mac OS there is an issue. |
I think I have seen similar behaviour on windows using 4.2 but with ActiveSelection. The grab handles are only available where the selection intersects with an object within the group (hence why in the original example. top-left works). After some experimentation, the issue is that ActiveSelection is transparent and, with per-pixel target set, this causes the area inside the selection (including the corners) to be ignored. This check is performed in the My workaround is to remove the per-pixel target find check by overriding the default implementation as follows: fabric.Canvas.prototype._checkTarget = (function (_checkTarget) {
return function (pointer, obj, _globalPointer) {
return obj && obj.visible && obj.evented && (obj.containsPoint(pointer) || !!obj._findTargetCorner(pointer));
};
})(fabric.Canvas.prototype._checkTarget); This makes the entire area of an ActiveSelection selectable and all control points accessible. Hope this helps someone! |
I debug this problem for a long time, your patch helped me, thanks very much! @marshall76963 |
Glad it helped you @linrz I just came up with an alternative solution that might be slightly better. The issue with overriding the If you just want to make the selection points available to ActiveSelections, then try this: fabric.Canvas.prototype.findTarget = (function (findTarget) {
return function (e, skipGroup) {
var result = findTarget.apply(this, [e, skipGroup]);
if (!(result && (skipGroup || this.skipTargetFind))) {
var obj = this._activeObject;
if (obj && obj.type === "activeSelection" && obj._findTargetCorner(this.getPointer(e, true), fabric.util.isTouchEvent(e))) {
result = obj;
}
}
return result
};
})(fabric.Canvas.prototype.findTarget); Cheers |
It works again from Fabric-4.4.0 and up |
i think this was fixed from this: |
Ok thanks, but I checked it again, only from version 4.4.0 it works on my Linux. Version 4.3.1 (cdnjs.com) does not work on Linux, but it works normally on Windows. |
not sure why the os should make a difference. The code change between 4.3.1 and 4.4.0 was effectively fixing a generic bug. |
Yeah, i agree, it sounds weird, i haven't figured out why this only happens with Chrome on Linux. But i checked that version 4.4.0 has this fix #6798, not 4.3.1, and looking the files changed, it has this commit 537eeb5 to canvas.class.js. Testing with the previous commit ee17127 i got the problem again. So it looks fixed with #6798 as you mentioned earlier, but it looks like it was released with v4.4.0 |
Hi, This is my code to create a fabric.Group export class GraphNode extends fabric.Group{
} I |
Version
4.2.0
Test Case
http://jsfiddle.net/s0tn3e15/
Information about environment
Steps to reproduce
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: