hide fill icons when fill color transparent (#2414)
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
This commit is contained in:
13
src/utils.ts
13
src/utils.ts
@ -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]
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user