-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Fix position of drag image #595
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
@@ -93,5 +93,4 @@ | |||
min-width: 125px; | |||
border: none; | |||
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); | |||
transform: translateX(-40%) translateY(-58%); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this because it's always overridden by
lumino/packages/dragdrop/src/index.ts
Lines 229 to 234 in 3f0be5c
protected moveDragImage(clientX: number, clientY: number): void { | |
if (!this.dragImage) { | |
return; | |
} | |
let style = this.dragImage.style; | |
style.transform = `translate(${clientX}px, ${clientY}px)`; |
Thanks @MetRonnie I took the liberty to push a commit on top of your PR to set the exact offset position of the cursor. What do you think? @krassowski do you have time to review this one as it may impact CSS styling performance? |
I think the proposed solution would be fine performance-wise as it only modifies position once when creating the drag node. I would recommend merging and once a new release is out I can run benchmarks to ensure there is no regressions and investigate manually if needed. |
@fcollonval Nice 👍 |
Thanks both - so I'm merging as is. |
* Fix position of drag image * Set exact offset between tab and cursor --------- Co-authored-by: Frédéric Collonval <fcollonval@gmail.com>
Closes #593
I tried using transform-origin but that didn't work.
Note I've only tested this in my web app using Lumino but not a minimal example.