Fix for grids with many columns#810
Closed
nulen wants to merge 1 commit intogridstack:developfrom
nulen:patch-2
Closed
Fix for grids with many columns#810nulen wants to merge 1 commit intogridstack:developfrom nulen:patch-2
nulen wants to merge 1 commit intogridstack:developfrom
nulen:patch-2
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)
Member
|
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? |
Member
|
if we use cellWidth() * n, then the rounding will mess things up. I agree with him, taking a look. |
3 tasks
Member
Member
|
@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. |
Closed
adumesny
added a commit
to adumesny/gridstack.js
that referenced
this pull request
Jul 5, 2020
* 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).
adumesny
added a commit
that referenced
this pull request
Jul 5, 2020
TS: fix for #810 many columns roundoff error
Member
|
thank you, I ended up checking in the fix for 2.x |
adumesny
added a commit
to adumesny/gridstack.js
that referenced
this pull request
Jul 5, 2020
adumesny
added a commit
that referenced
this pull request
Jul 5, 2020
TS: more fix for #810 many columns roundoff error
adumesny
added a commit
to adumesny/gridstack.js
that referenced
this pull request
Jul 27, 2020
* 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.