round x and y like Scratch 2 does#1453
Merged
rschamp merged 1 commit intoscratchfoundation:developfrom Aug 17, 2018
Merged
Conversation
https://github.com/LLK/scratch-flash/blob/develop/src/scratch/ScratchSprite.as#L180-L186 Scratch 2 rounds the X and Y to the nearest whole number.
Contributor
|
This is the only place in the code which uses the (private) function |
cwillisf
approved these changes
Aug 15, 2018
|
From some testing it looks like in 2.0, the x position reporter is precise to 8 digits and the x position monitor is precise to 6 digits. That specific rounding was added to fix project 117386152 (see #1150) -- does rounding to integer happen to the stored value or does it only round while rendering? |
rschamp
added a commit
to scratchfoundation/scratch-gui
that referenced
this pull request
Aug 20, 2018
Roll back VM to before scratchfoundation/scratch-vm#1453. This broke some pen drawing. Resolves #2911.
rschamp
added a commit
to scratchfoundation/scratch-gui
that referenced
this pull request
Aug 20, 2018
Roll back VM to before scratchfoundation/scratch-vm#1453. This broke some pen drawing. Resolves #2911.
This was referenced Aug 20, 2018
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.
Proposed Changes
Use Math.round instead of this._roundCoord.
Reason for Changes
https://github.com/LLK/scratch-flash/blob/develop/src/scratch/ScratchSprite.as#L180-L186
Scratch 2 rounds the X and Y to the nearest whole number.
Test Coverage
Projects like https://llk.github.io/scratch-gui/develop/#238746871 with fine lines and fractional positions needs rounded x and y values so that their lines are not offset from whole numbers. Offset lines from whole numbers in Scratch 3 render "inbetween pixels" and come out faded out or with striations.
https://scratch.mit.edu/projects/238746871/
https://llk.github.io/scratch-gui/develop/#238746871