-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cannot change the size of the dnd helper #1840
Comments
thanks for posting a demo (and cool usage of grid pattern - possible because you know the fixed row/column count). since you have gs-w/gs-h attributes from draggable, ideally the items would default to those cell height/width (minus margins). I have not paid too much attention to that part... will need to fix the sizing. Shouldn't have to redefine start/clone. |
So this issue has been plaguing me as well, and I came up with a css hack involving variables that gets the job done. I edited the original fiddle provided by koljada to illustrate the differences https://jsfiddle.net/zwhqp7y4/3/ The important tags could almost certainly be done away with by just targeting the element a bit better, but I was trying to change as little as possible in the fiddle so as not to overcomplicate the demo. Hopefully this hack is helpful to others who have this use case and don't mind dirtying up their code a little bit for the sake of making things work as they need. |
@giantroboticcat thanks for the demo fix. yeah it should probably work out of the box when you specify w/h as a node, and also be reduced by the margin so the dragged item looks exactly like the dropped item (which your fix doesn't do). .grid-stack>.grid-stack-item[data-gs-width='1'] {
width: 8.3333333333%;
} but just |
Does anyone have any workaround for this? I'm also almost pulling my hair out over this issue. Taking into account the previously posted jsfiddle, if you make the clone smaller than the element itself, everything becomes weird and messy. Even when trying to change the object's position through JavaScript, it seems to be overwritten later by the code. Here's a small example of making the clone smaller and the element larger in this jsfiddle. |
Subject of the issue
My goal is to create a sidebar with widgets which can be dragged into the grid. I need to change the default helper to have configured size when dragging, it's not enough for me to have only the following shadow. And it seems like currently it's impossible to do because width and height styles are overridden in
_setupDragFollowNodeNotifyStart
->_setupHelperStyle
method. I tried to usestart
event handler but an original event is passed as a target so I can't access the helper element.Your environment
Steps to reproduce
https://jsfiddle.net/koljada/yfbjvg3h/13/
Expected behavior
There must be some way to modify dimensions of the helper
Actual behavior
It's not possible to modify dimensions of the helper
The text was updated successfully, but these errors were encountered: