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

Borders are not considered in bounds calculation #110

Open
nhasdarjian opened this issue Jan 16, 2023 · 1 comment
Open

Borders are not considered in bounds calculation #110

nhasdarjian opened this issue Jan 16, 2023 · 1 comment
Assignees
Labels
core Related to core library enhancement New feature or request

Comments

@nhasdarjian
Copy link

nhasdarjian commented Jan 16, 2023

Hey @PuruVJ, very cool project, saved me from reimplementing drag on my own.

One thing I noticed, when I add a draggable div with {bounds: 'parent'} as a child of another div,
the draggable is able to move outside the parent's bounds if it has a border of any size greater than 0.

I tried working around it with DragBoundsCoords, but my border thickness is stored as a global CSS variable and extracting it in Svelte proved unsuccessful. I'm using the Svelte bindings if that makes a difference.

Please let me know if there's anything I can do to fix this myself!
The picture below shows the blue border of the white panel moving past its parent's bounds (background image)
image

Perhaps it can be fixed with a flag in DragOptions whether to include border or not?

@PuruVJ
Copy link
Owner

PuruVJ commented Jan 16, 2023

Its something I plan to add. As a workaround, you could use the box-shadow to create the border, as it doesn't have its own space in the box model.

box:shadow: 0 0 0 2px black should make a 2px border.

Sharing just in case you're not aware :)

@PuruVJ PuruVJ added enhancement New feature or request core Related to core library labels Jan 18, 2023
@PuruVJ PuruVJ added this to 2.1 Jan 18, 2023
@PuruVJ PuruVJ self-assigned this Jan 18, 2023
@PuruVJ PuruVJ moved this to Todo in 2.1 Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core library enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants