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

Can the skyhook-preview-renderer factor in the relative position? #274

Open
dotjoe-zz opened this issue Feb 19, 2019 · 4 comments
Open

Can the skyhook-preview-renderer factor in the relative position? #274

dotjoe-zz opened this issue Feb 19, 2019 · 4 comments
Labels

Comments

@dotjoe-zz
Copy link

I was trying to use a skyhook-preview inside a modal (which is at fixed position). This forces the preview to render at the mouse position without accounting for the offset. I saw an example of how to do this in the xy pad custom drag layer example, but Im curious if it's something that could be added to skyhook-preview?

@cormacrelf
Copy link
Owner

Can you provide a screenshot of what you mean?

In general, you can apply any style to whatever you put in the preview, including CSS translation or positioning, so it seems unlikely the skyhook-preview component would need to change to make this work.

@cormacrelf
Copy link
Owner

Further, if for whatever reason the preview’s base layer is in the wrong spot (not sure how that would work, it’s already out of normal document flow), you could always move it out of whatever div it’s in. It can be in a portal to the end of <body> for it all it cares.

@dotjoe-zz
Copy link
Author

image

That's when starting a drag from the top left dot of the gripper handle, I did follow your suggestion and translate my element. Which now has it like so...

image

Now it seems to be a different issue when using dragSource on the gripper. It's fine if I put dragSource on the root element.

@cormacrelf
Copy link
Owner

Ah, there’s something you have to do with react-dnd as well — the grabber handle is padded inside the box by the same amount that remains. Either translate the rest of the way back, or make the grabber hit the top left somehow. There might be a relevant issue upstream, have a look.

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

No branches or pull requests

2 participants