Thumbnail position calculation#3516
Merged
joeyparrish merged 5 commits intoshaka-project:masterfrom Jul 9, 2021
Merged
Conversation
avelad
reviewed
Jul 9, 2021
| positionX = (thumbnailPosition % columns) / columns * fullImageWidth; | ||
| positionY = (thumbnailPosition % rows) / rows * fullImageHeight; | ||
| positionX = (thumbnailPosition % columns) * width; | ||
| positionY = Math.floor(thumbnailPosition / columns) * height; |
Member
There was a problem hiding this comment.
Should be: Math.floor(thumbnailPosition / rows) * height;
(columns vs rows)
Contributor
Author
There was a problem hiding this comment.
@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
joeyparrish
approved these changes
Jul 9, 2021
Collaborator
|
All tests passed! |
joeyparrish
pushed a commit
that referenced
this pull request
Jul 13, 2021
Fix Y position calculation for the `getThumbnails` function of Player. Fixes #3511
1 task
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Fix Y position calculation for the
getThumbnailsfuntion.Fixes #3511
Type of change
not work as expected)
Checklist:
./build/all.pyand the build passes./build/test.pyand all tests pass