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

problem with flip of group in v6 #8743

Open
ShaMan123 opened this issue Feb 27, 2023 Discussed in #8740 · 3 comments
Open

problem with flip of group in v6 #8743

ShaMan123 opened this issue Feb 27, 2023 Discussed in #8740 · 3 comments

Comments

@ShaMan123
Copy link
Contributor

Discussed in #8740

Originally posted by thipm196 February 26, 2023
The controls are working wrong when flipping an element inside a flipped group.
https://codesandbox.io/s/fabricjs-flip-inside-group-npz4xs
image
image

@ShaMan123
Copy link
Contributor Author

#8745 is a first step to tackle this but for now it seems to me a won't fix

@asturur
Copy link
Member

asturur commented Feb 28, 2023

I will give it a stab to it too, with fresh eyes.
Even if i think is a low prio and a super edge case.

But first i ll follow the priority things to get 6.0 out of the door

@ShaMan123
Copy link
Contributor Author

ShaMan123 commented Feb 28, 2023

OK I found the cause and I managed to produce a fix that can't be accepted since it doesn't respect stroke.

Gist

positionHandler receives dim and finalMatrix. finalMatrix doesn't account for flipping of ancestors in the form of rotation, while dim account for complete flipping.
When calling positionHandler:

  • dim is transformed by finalMatrix, meaning we apply flipping twice. Once when we calculated the transformed dimensions and again with the finalMatrix rotation value. That is why it was off by 180deg.
  • offset is transformed by finalMatrix. The rotation value doesn't include own flipping values. That is why the offset was in the wrong direction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants