Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

When dragging item don't move other box until it gets on the middle of that other box #233

Open
JovanaVar opened this issue May 18, 2017 · 5 comments

Comments

@JovanaVar
Copy link

I would like when I drag the item that other box moves when I reach middle of it. Is it possible?

Thanks

@BTMorton
Copy link
Owner

What settings are you currently using? If you are using the max_cols property and resizing each column dynamically, and then each box uses a single column, then it will behave as described.

@JovanaVar
Copy link
Author

I didn't understand about each box uses a single column? Here is my grid config:
'margins': [5],
'draggable': true,
'resizable': true,
'max_cols': 25,
'max_rows': 0,
'visible_cols': 0,
'visible_rows': 0,
'min_cols': 1,
'min_rows': 1,
'col_width': 2,
'row_height': 2,
'cascade': 'up',
'min_width': 50,
'min_height': 50,
'fix_to_grid': false,
'auto_style': true,
'auto_resize': false,
'maintain_ratio': false,
'prefer_new': false,
'zoom_on_drag': false,
'limit_to_screen': true

and for items (boxes):
[{ 'dragHandle': null, 'resizeHandle': null, 'resizable': true, 'draggable': true, 'col': 1, 'row': 1, 'sizex': 1, 'sizey': 1, 'borderSize': 15 },
{ 'dragHandle': null, 'resizeHandle': null, 'resizable': true, 'draggable': true, 'col': 26, 'row': 1, 'sizex': 1, 'sizey': 1, 'borderSize': 15 },
{ 'dragHandle': null, 'resizeHandle': null, 'resizable': true, 'draggable': true, 'col': 51, 'row': 1, 'sizex': 1, 'sizey': 1, 'borderSize': 15 },
{ 'dragHandle': null, 'resizeHandle': null, 'resizable': true, 'draggable': true, 'col': 76, 'row': 1, 'sizex': 1, 'sizey': 1, 'borderSize': 15 },
{ 'dragHandle': null, 'resizeHandle': null, 'resizable': true, 'draggable': true, 'col': 1, 'row': 26, 'sizex': 1, 'sizey': 1, 'borderSize': 15 },
{ 'dragHandle': null, 'resizeHandle': null, 'resizable': true, 'draggable': true, 'col': 26, 'row': 26, 'sizex': 1, 'sizey': 1, 'borderSize': 15 }
];

@BTMorton
Copy link
Owner

Yes, that's about the configuration I was expecting. Does the behaviour not already work as described? If not, at what point does the item move?

@JovanaVar
Copy link
Author

Yes it moves but as soon as one box interacts with another that other box moves. I need a behavior that one box get a little bit over another and than that other moves.

@BTMorton
Copy link
Owner

BTMorton commented Sep 1, 2017

Ah, hang on, I know what's going. I misread your config. Basically, ever column in the grid is only 2 pixels wide according to your config, which means that it only take 2 pixels of movement to update an item's position and force another item out of the way. If you want the behaviour like you've described, you'll need to set a larger column/row width (say, 50 or 100) so that it takes more movement to actually change an item's position.

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

No branches or pull requests

2 participants