diff options
author | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-27 13:51:21 -0400 |
---|---|---|
committer | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-27 13:51:21 -0400 |
commit | fdc7c28eb758c8ef0e764cec4cfc261e01da3dea (patch) | |
tree | 45a6dcde1075b0c3d52f2d4417cc43cd63a6f9b3 /src/Utils.ts | |
parent | 7535e446e9a8aa2a0afaf84c667f3a58f437d99b (diff) | |
parent | 1f80b87178a84c1a449e27c90b1f7b635593cdad (diff) |
Merge branch 'master' into sophie-report-manager
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index e03632c8b..599c6456a 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -16,18 +16,18 @@ export namespace Utils { return Date.now() - downTime < Utils.CLICK_TIME && Math.abs(x - downX) < Utils.DRAG_THRESHOLD && Math.abs(y - downY) < Utils.DRAG_THRESHOLD; } - export function cleanDocumentType(type: DocumentType) { - switch(type) { + export function cleanDocumentType(type: DocumentType) { + switch (type) { case DocumentType.IMG: - return "Image" + return 'Image'; case DocumentType.AUDIO: - return "Audio" + return 'Audio'; case DocumentType.COL: - return "Collection" + return 'Collection'; case DocumentType.RTF: - return "Text" - default: - return type.charAt(0).toUpperCase() + type.slice(1) + return 'Text'; + default: + return type.charAt(0).toUpperCase() + type.slice(1); } } @@ -140,7 +140,7 @@ export namespace Utils { } export function colorString(color: ColorState) { - return color.hex.startsWith('#') ? color.hex + (color.rgb.a ? decimalToHexString(Math.round(color.rgb.a * 255)) : 'ff') : color.hex; + return color.hex.startsWith('#') && color.hex.length < 8 ? color.hex + (color.rgb.a ? decimalToHexString(Math.round(color.rgb.a * 255)) : 'ff') : color.hex; } export function fromRGBAstr(rgba: string) { |