Merge pull request from paulkaplan/fix-pen-transparency

Add back pen transparency from color number
This commit is contained in:
Paul Kaplan 2017-11-06 09:55:39 -05:00 committed by GitHub
commit 67cb026e02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -451,7 +451,11 @@ class Scratch3PenBlocks {
penState.color = (hsv.h / 360) * 100;
penState.saturation = hsv.s * 100;
penState.brightness = hsv.v * 100;
penState.transparency = 0;
if (rgb.hasOwnProperty('a')) {
penState.transparency = 100 * (1 - (rgb.a / 255.0));
} else {
penState.transparency = 0;
}
// Set the legacy "shade" value the same way scratch 2 did.
penState._shade = penState.brightness / 2;