mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Added back eyedropper
This commit is contained in:
17
js/Util.js
17
js/Util.js
@@ -1,6 +1,23 @@
|
||||
// Acts as a public static class
|
||||
class Util {
|
||||
|
||||
/** Tells if a pixel is empty (has alpha = 0)
|
||||
*
|
||||
* @param {*} pixel
|
||||
*/
|
||||
static isPixelEmpty(pixel) {
|
||||
if (pixel == null || pixel === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the alpha channel is 0, the current pixel is empty
|
||||
if (pixel[3] == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Tells if element is a child of an element with class className
|
||||
*
|
||||
* @param {*} element
|
||||
|
||||
Reference in New Issue
Block a user