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

Support rotating of elements #5559

Closed

Conversation

PaulRill00
Copy link
Contributor

@PaulRill00 PaulRill00 commented Dec 14, 2023

This PR introduces an option to use a rotate handle to rotate elements.

component: {
  rotatable: true
}

Next to adding support for rotating, this PR also adds a fix for resizing rotated elements. The element will now 'lock' on the opposite handle when someone stats resizing.

In this PR CSS changes have been made, however, I don't know if we should submit the minified CSS in this PR.

PaulRill00 and others added 8 commits December 8, 2023 10:16
feat: rotating is almost done, just need to fix the resizing

feat: 🐛 fixed the rotating element rectangle not keeping bounding rectangle

fix: 🔥 removed comments

Discard changes to dist/index.d.ts

Discard changes to dist/css/grapes.min.css

Discard changes to src/utils/mixins.ts
Support rotating of elements
@PaulRill00 PaulRill00 marked this pull request as ready for review December 14, 2023 10:43
@artf
Copy link
Member

artf commented Dec 23, 2023

Thanks @PaulRill00 this is a nice functionality but I'm against merging it in the core, especially if no one ever asked for it... I'm quite confused as to why you even started this without opening a discussion.
If the next time you wish to add something, please let's discuss this first.

Anyway, I'd suggest you refactor this to a plugin, I see this functionality as a perfect usage of Canvas Spots

@artf artf closed this Dec 23, 2023
@PaulRill00
Copy link
Contributor Author

Thanks @PaulRill00 this is a nice functionality but I'm against merging it in the core, especially if no one ever asked for it... I'm quite confused as to why you even started this without opening a discussion. If the next time you wish to add something, please let's discuss this first.

Anyway, I'd suggest you refactor this to a plugin, I see this functionality as a perfect usage of Canvas Spots

Hi @artf, I would argue that at least half of the functionality included in this PR should be included in the core. Especially since the 'absolute' mode is already supported. But - when you set any rotation on the element using the build-in editor, the resize/drag functionality is broken.

Then - it only seems like a small addition to also natively support a rotate-handle to make navigating elements easier.

As to the reason why I never opened a discussion, is because we use GrapesJS in a project internally and were missing this functionality. So we decided to add it ourselves and then open a PR here.

Moving this to a plugin sounds like a lot of work. Maybe you could re-consider implementing this into the core of GrapesJS? We like using the project and would love to make more contributions, but not merging this would mean we'll be using a fork - and therefore a detached-HEAD.

@artf
Copy link
Member

artf commented Feb 10, 2024

Sorry @PaulRill00 but in my opinion, just the Rotator file is a HUGE addition to the core, that a lot of people will download and probably won't even use, so for me it's a hard pass for this addition to the core.

Moving this to a plugin sounds like a lot of work

I'm not sure about that, what you might find it's some kind of missing API or event that would you allow to bind easily your functionality but here I'm more than open to implementing it if necessary.

@PaulRill00
Copy link
Contributor Author

@artf - we're thinking about finally turning this into a proper plugin.
But for that we are wondering if our additions towards the Resizer would be OK to be merged. Since in our opinion it's weird that the current resize logic does not work correctly when the element is rotated.
Then we will move the Rotator logic + handles etc to a plugin for easy injection.

@artf
Copy link
Member

artf commented Sep 19, 2024

@PaulRill00 can you please open a new issue/PR showing the problem (reproducible demo) with the Resizer.

@lukjaki
Copy link

lukjaki commented Oct 15, 2024

@PaulRill00 is this available as a plugin?

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

Successfully merging this pull request may close these issues.

4 participants