Skip to content
Permalink
Browse files

Fix picking area average color calculation not returning alpha as float

  • Loading branch information...
SeinopSys committed Apr 12, 2019
1 parent 9c69081 commit 1fea0d441eaae8781d663508e4de826f0e661036
Showing with 9 additions and 2 deletions.
  1. +9 −2 assets/js/pages/colorguide/picker-frame.js
@@ -41,7 +41,14 @@


class Pixel {
constructor(r,g,b,a, overrideAlpha = false){
/**
* @param {number} r 0-255
* @param {number} g 0-255
* @param {number} b 0-255
* @param {number} a 0.0-1.0
* @param {false|number} [overrideAlpha]
*/
constructor(r, g, b, a, overrideAlpha = false){
this.red = r;
this.green = g;
this.blue = b;
@@ -110,7 +117,7 @@
b += pixel.blue;
a += pixel.alpha;
});
return new Pixel(Math.round(r/l), Math.round(g/l), Math.round(b/l), Math.round(a/l));
return new Pixel(Math.round(r/l), Math.round(g/l), Math.round(b/l), Math.round((a/l)/255));
}
#getImageData(){
if (!(this._tab instanceof Tab))

0 comments on commit 1fea0d4

Please sign in to comment.
You can’t perform that action at this time.