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

.resize_widget produces a wrong collision model #32

Closed
zambadu opened this issue Aug 20, 2012 · 20 comments
Closed

.resize_widget produces a wrong collision model #32

zambadu opened this issue Aug 20, 2012 · 20 comments
Labels

Comments

@zambadu
Copy link

zambadu commented Aug 20, 2012

Seen on Chrome & Firefox (both latest).
If I use the .resize_widget function, the widget resizes as expected, but after that the collision model doesn't fit the cols and rows anymore, it seems to have doubled margin around the box, but only for the resized box. The others are still intact, but may produce overlays now and also ignore the box margins, if they have to push the resized box. This appears only on changing the cols. If changing the rows the collision model just doesn't resize, but still works correct.
Also the Preview Container is not scaled to the new size in both directions. It still have the origin size.

@vieron
Copy link
Member

vieron commented Aug 25, 2012

It's possible this commit 9402f20 fixes your problem? If not, let me know!

Thanks!

@zambadu
Copy link
Author

zambadu commented Aug 27, 2012

Hi vieron,

thanks for your reply.
Unfortunately, this doesn't fix the problem, it change it.
now the resized widget, still not fits the columns and being positioned wrong. additionally now the resized widget does not displace the other widgets and converse.

Is this wrong behavior reproducible for you? or I'm the only one with this problem?
using jquery 1.8.0 and jquery ui 1.8.23 (i have tried without ui, the problem still persists)

@lgomezma
Copy link

lgomezma commented Sep 3, 2012

Hi zambadu,

I'm experiencing the exact same problem. After calling resize_widget there is some overlapping between the element that was resized and its neighbors. I will try to work on a solution for that... Please keep us posted on it.

@bmla
Copy link

bmla commented Sep 6, 2012

I'm having the same problem. Commit 9402f20 fixes the drop zone/drop preview.

When resizing the height of a widget I have no problem. But something happens when I resize the width.
When resizing the width I discovered:

  • Widgets can overlap.
  • If I resize the width of a widget and then try to resize the height of the same widget, it freezes and I have to close the browser tab.

@baswildeboer
Copy link

I'm also experiencing issues when dragging after resizing a widget (tested with changing height and width in chrome and ff). The overlapping issue still exists and widgets are not always placed as expected.

@raananraz
Copy link

+1

@TalD
Copy link

TalD commented Nov 9, 2012

+1 Is there a fix for this?

@TalD
Copy link

TalD commented Nov 12, 2012

I think I may have stumbled upon a "fix" for this. Open jquery.gridster.js...

Go to the resize_widget function definition. At the end of the function, you will see "return $widget" (this appears on line 1017).

I've inserted "this.init();" right above the line where it returns $widget (inserted on line 1016) and this seems to have solved the problem for me.

Can someone else verify that this does or does not work for them?

@raananraz
Copy link

tried it from the outside.
var widget = resize_widget(...)
widget.init()
with no luck.

@TalD
Copy link

TalD commented Nov 12, 2012

raanmanraz - Just use the resize_widget function from the outside as normal (without calling widget.init() from the outside). If you drag elements around after you've implemented that one line of code, your widgets will cease to overlap and the collision class will be working as expected.

@abhijitbarve
Copy link

Works like magic!! Thanks!!

@FRickReich
Copy link

TaiD's fix NEEDS to be put into this, it works perfectly and fixes this problem just perfectly.

@bompus
Copy link

bompus commented May 4, 2013

I think I have a better fix which doesn't slow things down as much.

inside of fn.add_faux_cols , find the following line:
var max_cols = actual_cols + (cols || 1);

add this line directly BELOW it:
if (max_cols > this.max_cols) { return this; }

inside of fn.generate_grid_and_stylesheet , find the following line:
this.cols = Math.max(min_cols, cols, this.options.min_cols);

add this line directly BELOW it:
this.max_cols = this.cols;

inside of fn.resize_widget , find the following line:
return $widget;

add this line directly ABOVE it:
this.set_dom_grid_height();

This combination seems to have fixed my issue and should resolve this issue as well.

@markjohndoyle
Copy link

TalD's line: 1017 fix worked for me. Thanks!

@ghost
Copy link

ghost commented Jul 17, 2013

Bompus' suggestion worked for me. Thanks!

@bounav
Copy link

bounav commented Jul 24, 2013

bompus' patch works for me too.

@xmikew
Copy link

xmikew commented Aug 8, 2013

bompus' patch did not work for me but the TalD's this.init did... i dont notice slowness yet.

@Ivshti
Copy link

Ivshti commented Sep 9, 2013

TalD's patch works for me, I haven't tested bompus's patch.

Anyway, the good thing here is that we can just do grid.init after grid.resize_widget so we don't have to actually patch the code.

@muriloreinert
Copy link

Thank You, saved me 👍

@bassarisse
Copy link

Shouldn't the bompus's patch be included on the original source?

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

No branches or pull requests