-
-
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
[Bug]: add existing object to group get wrong control position #10214
Comments
The bug happens only if you do it inside object:modified. not if you just exec the code one step after another. |
@asturur Thank you for your reply! You are right, but I want switch object's artboard when user is dragging object in modify callback, Do you know how to solve this problem. |
@byeval canvas.on("mouse:move", e => {
const target = e.target;
if (!canvas.selection) return;
if (e.transform?.action != "drag") return;
if (!target) return;
const isA = target instanceof ActiveSelection;
const fn = (o: FabricObject) => {
(o.group ?? canvas).remove(o);
// XXX -> The "XXX" in your example === group
XXX.add(o);
}
if (isA) {
const list = target.getObjects();
for (const item of list) {
target.remove(item);
fn(item);
target.add(item);
}
} else {
canvas._activeObject = undefined;
canvas._hoveredTarget = undefined;
fn(target);
canvas._activeObject = target;
canvas._hoveredTarget = target;
canvas._setupCurrentTransform(e.e, target, true);
}
});
|
@zhe-he It works! Thank you so much ❤️ |
CheckList
Version
6.0.2
In What environments are you experiencing the problem?
Chrome
Node Version (if applicable)
None
Link To Reproduction
https://codesandbox.io/p/sandbox/group-clippath-fabric-js-6-0-0-beta-14-forked-8zzx2r?file=%2Fsrc%2Findex.js%3A36%2C21
Steps To Reproduce
Expected Behavior
control is fit with object
Actual Behavior
control has wrong position
Error Message & Stack Trace
No response
The text was updated successfully, but these errors were encountered: