Skip to content
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

[2.0] Grouping & Active Selection Position Bug #4163

Closed
jrking4 opened this issue Aug 3, 2017 · 9 comments
Closed

[2.0] Grouping & Active Selection Position Bug #4163

jrking4 opened this issue Aug 3, 2017 · 9 comments

Comments

@jrking4
Copy link
Contributor

jrking4 commented Aug 3, 2017

Version

2.0 Beta 4

Test Case

https://jsfiddle.net/L16kzxzh/

Steps to reproduce

  1. Position Bug - Select 2 of the rectangles in an active selection and click group button. Now 2 of the rectangles should be grouped. And one should not be grouped. Now click and drag your mouse to make an active selection of the rectangle group and the remaining rectangle. The grouped objects get moved to the upper left corner of canvas.
  2. Ungrouping bug - Select the rectangles into an activeSelection and click group button. Now the rectangles are in a group. Now click ungroup and move the rectangles out of the way. The old group remains.

Expected Behavior

1 - The objects should be selected and not moved.
2 - The group you convert to an activeSelection should be removed from canvas

Actual Behavior

1 - The object group is moved to the top left corner of canvas
2- The old group and objects still remain after ungrouping

@asturur
Copy link
Member

asturur commented Aug 4, 2017

I can verify just 1.
Can you check 2 again?

@asturur
Copy link
Member

asturur commented Aug 4, 2017

Ok not a bug, mainly because new docs are not yet ready.

toGroup and toActiveSelection do not return anything, they just do the necessary operations to move a group to activeSelection and viceversa

$(".group").on('click', function() {
  var activeObject = canvas.getActiveObject();
  if (activeObject.type === 'activeSelection') {
    activeObject.toGroup();
    canvas.renderAll();
  }
});

@asturur asturur closed this as completed Aug 4, 2017
@jrking4
Copy link
Contributor Author

jrking4 commented Aug 10, 2017

On issue #2 I see that it clones the group to an active selection, and works as expected if i delete the group after.

But for issue #1 (position bug), i still see the group getting moved to top left corner when i try and make an active selection. I see you have verified the bug, but why is the issue closed? Thanks!

@asturur
Copy link
Member

asturur commented Aug 10, 2017

did you read my message?

@asturur asturur reopened this Aug 10, 2017
@asturur
Copy link
Member

asturur commented Aug 10, 2017

do not know, looked solved to me.

@jrking4
Copy link
Contributor Author

jrking4 commented Aug 10, 2017

This is the one im still having an issue with:

Position Bug - Select 2 of the rectangles in an active selection and click group button. Now 2 of the rectangles should be grouped. And one should not be grouped. Now click and drag your mouse to make an active selection of the rectangle group and the remaining rectangle. The grouped objects get moved to the upper left corner of canvas.

@asturur
Copy link
Member

asturur commented Aug 10, 2017

https://jsfiddle.net/L16kzxzh/1/

if you do it simpler it works, but i have to check why

@jrking4
Copy link
Contributor Author

jrking4 commented Aug 10, 2017

yes that seems to work. thank you for the help!

@asturur
Copy link
Member

asturur commented Aug 13, 2017

Ok i found the answer i can remove the issue.
You are adding the object to the canvas twice.
When you multiselect by dragging, the object enter twice in the multiselection.
The coordinates get addjusted first one then another time from the group center and the object get's displaced too much.

Is just this.

adding the object to canvas twice is wrong and does not need a fix.

@asturur asturur closed this as completed Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants