-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix for grids with many columns #810
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
Conversation
Updated cellWidth method to not round cellWidth value. It was causing problem for grids with larger number of columns and uneven cell width calculated. (e.g. cellWidth is calculated to be 19.5px and there are 30 columns. Further we go, larger the mistake with positioning widgets)
|
This is an exact value and not a percentage. I'd imagine in every case you'd want this to return the rounded value. Why is this causing problems? |
|
if we use cellWidth() * n, then the rounding will mess things up. I agree with him, taking a look. |
|
@nulen closing for now I don't see the need for this 'fix' - please re-open and update with more info (see my comment and sample app) |
|
@adumesny A breaking example is using a large number of columns, say 100, and try and move a widget that has a larger x position (far right of the grid). In dragOrResize, ui.position.left / cellWidth will result in a huge error that will result in the widget moving significantly even if you've barely touched it. |
* cellWidth() no longer round things off (I was able to see issue with 60 columns and dragging itelf on right and would not relocate unless moved a lot futher).
TS: fix for #810 many columns roundoff error
|
thank you, I ended up checking in the fix for 2.x |
TS: more fix for #810 many columns roundoff error
* forgot to update the test case for gridstack#810 changes * also found getCellFromPixel() was incorrect in rounding as well or delaing with margins (which don't affect cell size, just content)
There was a problem with positioning dragged widgets if there were larger number of columns and cumulated diff between real value and rounded one. (e.g. cellWidth is calculated to be 19.5px and there are 30 columns. Further we go, larger the mistake with positioning widgets)
Description
Updated cellWidth method to not round cellWidth value. It was causing problem for grids with larger number of columns and uneven cell width calculated.