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

Rotate and delete with Moveable rotatable #657

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

hchiam
Copy link
Contributor

@hchiam hchiam commented Feb 28, 2025

@hchiam
Copy link
Contributor Author

hchiam commented Feb 28, 2025

note:

  • only editing isOffBounds in common.js actually prevented overriding of the deleteButton's click event (whereas editing notList in strings.js didn't seem to help) - when i tried adding .moveable-control and visbug-moveable-delete-button so that you don't add labels and draggability to the delete button itself
  • moveable has some known issues with position being offset, for example, when the parent element uses display: flex; and related properties, i found the clicking the child element to show the rotatable handles in the wrong position for VisBug

Copy link
Contributor Author

@hchiam hchiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for review. 😄

Comment on lines +92 to +93
|| node.closest('.moveable-control')
|| node.closest('visbug-moveable-delete-button')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding this didn't seem to help

@@ -44,4 +44,4 @@ export const altKey = window.navigator.platform.includes('Mac')
? 'opt'
: 'alt'

export const notList = ':not(vis-bug):not(script):not(hotkey-map):not(.visbug-metatip):not(visbug-label):not(visbug-handles):not(visbug-corners):not(visbug-grip):not(visbug-gridlines)'
export const notList = ':not(vis-bug):not(script):not(hotkey-map):not(.visbug-metatip):not(visbug-label):not(visbug-handles):not(visbug-corners):not(visbug-grip):not(visbug-gridlines):not(.moveable-control):not(visbug-moveable-delete-button)'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only adding this here actually helped

Comment on lines +170 to +173
const mv = new Moveable(document.body, {
target: el,
rotatable: true
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ables option for adding things like a custom delete button seems to only work with react and react-moveable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lame!

@hchiam
Copy link
Contributor Author

hchiam commented Feb 28, 2025

also tested to work in both Chrome and Firefox

@argyleink
Copy link
Member

looking forward to pulling this and trying it out!
will look into the issues you mention and suggest workarounds too.

Copy link
Member

@argyleink argyleink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so fun! very meaningful addition I feel 🙂

not sure whether we should treat this like a prototype to show us just how nice it can feel to rotate and delete, or if we should actually adopt this library.

if we keep the library, there's a lot of:

things to do:

  • position.js line 38, need to do some cleanup so the remnants of the rotation controls arent present
  • make a delete button component, and use visbug colors

things to fix:

  • remove the bounding box Moveable UI makes
  • update the colors to match visbugs (blue -> hotpink)
  • remove the red circle handle that Moveable UI makes
  • every time i use the position tool, a new Moveable UI is made. which also, while using the position or resize tool the Moveable UI doesnt come with it

but if we don't adopt the library

things to do:

  • create a new visbug-rotation handle-like element
  • write your own pointer down/move handlers
  • add new handle into handles
  • create a visbug-delete element

this would make the solution native, aiding in avoiding a lot of the hover/zombie issues we have no, since Moveable has it's own lifecycle. if we write and own it all, we can integrate tightly and reuse more of what we have.

question is, were you hoping to leverage the library or are you interesting in writing your own rotation code?! how do you feel about the remaining work? do you want to fix the leaks, or rip out Moveable and create your own solutions?

Comment on lines +170 to +173
const mv = new Moveable(document.body, {
target: el,
rotatable: true
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lame!

@hchiam
Copy link
Contributor Author

hchiam commented Mar 1, 2025

...

but if we don't adopt the library

things to do:

  • create a new visbug-rotation handle-like element
  • write your own pointer down/move handlers
  • add new handle into handles
  • create a visbug-delete element

this would make the solution native, aiding in avoiding a lot of the hover/zombie issues we have no, since Moveable has it's own lifecycle. if we write and own it all, we can integrate tightly and reuse more of what we have.

question is, were you hoping to leverage the library or are you interesting in writing your own rotation code?! how do you feel about the remaining work? do you want to fix the leaks, or rip out Moveable and create your own solutions?

first off, thanks!

tldr: "the latter":

i was hoping this would be a quick fix, but of course things often turn out not so simple haha

it also felt like as i was using the moveable library there'd be code bloat, and i was already having to make custom code and listeners to make the delete button work and rotate and prevent visbug labels on the button - so i'm thinking i can "handle" a native solution! can't make any promises when i'll get back to this though, but i'll put it on my queue

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.

Better rotate and delete
2 participants