-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
Dynamic snap to guidelines, instead of widths/heights provided for each axis? #1044
Comments
Try setting snapThreshold, snapWidth, and snapHeight to the same number. Now the threshold has the same width and height, but I will add threshold props for width and height respectively. |
@daybrush Thanks a lot for the quick answer - again, really amazing library - unfortunately, not what I need. I need the snappable to snap only to guidelines. Assume that the width/height of the snappable was correct, and that it'd match my CSS grid. Not sure if it makes sense, but if I were to put This is what I wanna do: see how the draggable snaps to the grid lines only? |
That's what I said. I plan to add A similar role now is |
Incredible @daybrush - the amount of support you put into this library is insane. Unparalleled. Wish you the best, and here's to many more years of daybrush! 👍 |
@daybrush and @brutal-orange, I have similar requirements to snap Elements to CSSGrid (Squarespace Style) For now, I am using I look forward to seeing how I can use Thanks! |
Hey @jadiagaurang - saw your other issue! Any chance you can post a link to your working example? As I noted, if we worked with fixed values, we'll have issues on responsive screens. In essence, we'd always have some padding, to ensure our real container is a multiplier of 50 (so, if it wasn't, we'd get misaligments). I'm sorry if the wording here is bad on my part, but it seems that concrete values will not be a good candidate, simply because of this. We need to "snap to [only] guidelines"...whatever that means technically. Btw, as a side-note: if "snapping to guidelines" were possible, the way I built my grid would work. You can even make the guidelines 1px wide/tall, so that you wouldn't snap to the (current implementation's) guidedlines' edges. On the looks side of things - I will make sure to post a working nice example of my app. Just happened to stumble upon Squarespace's builder. Theirs looks nice, BUT it can be improved massively. Alas, it's all just CSS trickery, so, not sure how helpful it'll be :) |
@brutal-orange I can't post a working example due to my employer's policy. But I look forward to your working example with CSS Grid output. |
moveable's new version is released. snapVerticalThreshold, snapHorizontalThreshold props are added. Make |
Environments
Description
I have a Moveable that uses grid lines as its guidelines. I'm trying to find a way to make it snap/resize to only its guidelines, no in-betweens. I am not setting any
snapWidth/Height
properties, since, in my case, they can be dynamic and/or unknown. I can compute them if I really needed to, but I'd much rather not.Every time a section is created, it gets a number of rows/columns-as-divs, those are then set and used as guidelines (the guidelines is an array of classes, nothing more).
In essence, given my definition of
Moveable
insideElement.tsx
, is there a way to make it snap to its guidelines?Awesome library, btw :)
The text was updated successfully, but these errors were encountered: