hide fill icons when fill color transparent (#2414)

Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
This commit is contained in:
Aakansha Doshi 2020-11-27 02:13:38 +05:30 committed by GitHub
parent 6c0296c434
commit ca60244aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 289 additions and 16 deletions

View file

@ -1,10 +1,11 @@
import { Zoom } from "./types";
import colors from "./colors";
import {
CURSOR_TYPE,
FONT_FAMILY,
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
import { FontFamily, FontString } from "./element/types";
import { Zoom } from "./types";
export const SVG_NS = "http://www.w3.org/2000/svg";
@ -292,3 +293,13 @@ export const findLastIndex = <T>(
}
return -1;
};
export const isTransparent = (color: string) => {
const isRGBTransparent = color.length === 5 && color.substr(4, 1) === "0";
const isRRGGBBTransparent = color.length === 9 && color.substr(7, 2) === "00";
return (
isRGBTransparent ||
isRRGGBBTransparent ||
color === colors.elementBackground[0]
);
};