-
-
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
When user drags inactive object, make sure he won't scale it instead #1570
Conversation
Hi, any comments? Should I create an issue first to discuss that? The problem is especially annoying when you try to move around small shapes. |
i pulled it and try it and looks fine for me. |
@kangax can you look at this? it looks harmless and solve that accidental resizing. |
Absolutely yes. |
I suppose we can "fix" it although I'm not sure it's exactly the right behavior. If someone wanted to scale an object (after we merge this) they would need to first select it. So it's kind of a matter of whether we want to prioritize movement over scaling. Right now an object can be scaled by the corner even if it's not selected. |
oh ok, if it is a feature ok. I also noticed some strange behaviour, like if you take the vertical resize corner, and you drag left, as soon as you overcome the left side, you flip the object. If you drag right you do not flip. |
If you don't mind comments from the peanut gallery... When I encountered this behaviour I also assumed it was a bug. Given that I can't see the resize handles before selecting the object, I would never intend to resize an object when dragging from that place. I also agree with @pjanik regarding manipulation of small objects. Familiarity is another concern. I'm not aware of any other editor that lets you resize an object without selecting it first, unless using a special "resize" tool where it's obvious that this is the only action you could mean. Just my €0.02! |
I agree with @pjanik; I would find it surprising if I could resize an object that I had not selected. |
Yeap, I still feel the same after couple of months... This can be considered as a matter of taste though. But the fact that I can't move small object (as I always resize it instead) is an obvious problem / bug to me and it's pretty annoying in practice. |
I was thinking again about this, i'm sure @pjanik is right. |
replaced by #2907 |
To replicate the issue using current release of FabricJS:
I would expect that object would be moved, but instead it's scaled, as exactly under the mouse pointer there is a control point (invisible at the beginning, until the object is selected).
The problem seems to be here:
https://github.com/kangax/fabric.js/blob/818ab118b30a9205a0e57620452b08bb8f5f18cc/src/mixins/canvas_events.mixin.js#L414-L415
_findTargetCorner
checks whether the target is active (what makes sense). It's called twice, once in_beforeTransform
and the second time in_setupCurrentTransform
. However the target is activated in the meantime, in_beforeTransform
. So the second call to_findTargetCorner
actually returns corner and scaling is being activated. I've just moved target activation out of_beforeTransform
and it seems to fix the problem for me. These functions are used only in this context, so hopefully it's not a risky change.Regards,
Piotr