-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Thumbnail position calculation #3516
Thumbnail position calculation #3516
Conversation
positionX = (thumbnailPosition % columns) / columns * fullImageWidth; | ||
positionY = (thumbnailPosition % rows) / rows * fullImageHeight; | ||
positionX = (thumbnailPosition % columns) * width; | ||
positionY = Math.floor(thumbnailPosition / columns) * height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be: Math.floor(thumbnailPosition / rows) * height;
(columns vs rows)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avelad I've checked the logic again and the use of columns is correct. Consider the following as per the unit test.
Grid of 2x3 100x150px:
[0][1]
[2][3]
[4][5]
Requesting the position of thumbnail 5 using your suggested edit would result in the following:
Math.floor(thumbnailPosition / rows) * height
Math.floor( 5 / 3) * 50
1 * 50
yPosition = 50
The correct position for thumbnail 5 should be:
x= 50
y= 100
All tests passed! |
Fix Y position calculation for the `getThumbnails` function of Player. Fixes #3511
Description
Fix Y position calculation for the
getThumbnails
funtion.Fixes #3511
Type of change
not work as expected)
Checklist:
./build/all.py
and the build passes./build/test.py
and all tests pass