You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a resizable layout using gridster, and it saves on change, so for example my current configuration is:
widget base: [50,50]
margin [2,2]
and one item "Page section 1" only with sizex="10" sizey="10" row="1" col="1"
Now, let's assume one user called Mr. Whites modified his layout, so that "Page section 1" becomes:
sizex="5" sizey="5" row="1" col="1", that will be saved in db, and every time Mr. Whites opens this page, his layout will be that size.
After long time using this solution, I've realized that, it may be useful for Mr. Whites to resize with smaller steps, so I changed the widget base from: [50,50] to [10,10], because I wanted to be flexible if one day I decide to change it again, I've created a function that will calculate the factor:
In this case the factor will be 5 because 50/10 is 5.
Then I get the settings saved in DB for Mr. Whites and I multiple sizex and sizey by the factor.
So now:
sizex="5" sizey="5" row="1" col="1"
will become:
sizex="25" sizey="25" row="1" col="1"
I expected it to look exactly the same as previous layout, but it doesn't. I also tried to measure the width of the element while changing the widget base, so seeing if I was able to see any kind of pattern, but no luck.
Hi,
I have created a resizable layout using gridster, and it saves on change, so for example my current configuration is:
widget base: [50,50]
margin [2,2]
and one item "Page section 1" only with sizex="10" sizey="10" row="1" col="1"
Now, let's assume one user called Mr. Whites modified his layout, so that "Page section 1" becomes:
sizex="5" sizey="5" row="1" col="1", that will be saved in db, and every time Mr. Whites opens this page, his layout will be that size.
After long time using this solution, I've realized that, it may be useful for Mr. Whites to resize with smaller steps, so I changed the widget base from: [50,50] to [10,10], because I wanted to be flexible if one day I decide to change it again, I've created a function that will calculate the factor:
In this case the factor will be 5 because 50/10 is 5.
Then I get the settings saved in DB for Mr. Whites and I multiple sizex and sizey by the factor.
So now:
sizex="5" sizey="5" row="1" col="1"
will become:
sizex="25" sizey="25" row="1" col="1"
I expected it to look exactly the same as previous layout, but it doesn't. I also tried to measure the width of the element while changing the widget base, so seeing if I was able to see any kind of pattern, but no luck.
when widget base is: | width() / sizex | height() / sizey
5 | 8.953846154px | 8.7px
10 | 13.0976px | 13.4px
25 | 28.76px | 27.2px
50 | 53px | 51px
The dirty way, would be to ask Mr. Whites to resize his layout with the new version, I would like to avoid that.
Is there any other way to calculate this?
Thank you very much!
The text was updated successfully, but these errors were encountered: