angular2-grid icon indicating copy to clipboard operation
angular2-grid copied to clipboard

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

Open JovanaVar opened this issue 7 years ago • 5 comments

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

Thanks

JovanaVar avatar May 18 '17 09:05 JovanaVar

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.

BTMorton avatar Aug 28 '17 14:08 BTMorton

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 } ];

JovanaVar avatar Aug 29 '17 07:08 JovanaVar

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?

BTMorton avatar Aug 29 '17 11:08 BTMorton

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.

JovanaVar avatar Aug 29 '17 12:08 JovanaVar

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.

BTMorton avatar Sep 01 '17 17:09 BTMorton