Fix emoji scale being blurred for notes

This commit is contained in:
Mitchell McCaffrey 2021-08-06 08:48:54 +10:00
parent afd9f2d30a
commit 729705b86b
2 changed files with 7 additions and 5 deletions

View File

@ -27,7 +27,8 @@ import { Map } from "../../types/Map";
import Transformer from "./Transformer";
const defaultFontSize = 16;
const defaultFontSize = 144;
const minFontSize = 16;
type NoteProps = {
note: NoteType;
@ -154,10 +155,10 @@ function Note({
if (!text) {
return;
}
// Create an array from 1 / defaultFontSize of the note height to the full note height
// Create an array from 1 / minFontSize of the note height to the full note height
let sizes = Array.from(
{ length: Math.ceil(noteHeight - notePadding * 2) },
(_, i) => i + Math.ceil(noteHeight / defaultFontSize)
(_, i) => i + Math.ceil(noteHeight / minFontSize)
);
if (sizes.length > 0) {

View File

@ -6,7 +6,8 @@ import useSetting from "../../hooks/useSetting";
import { TokenState } from "../../types/TokenState";
const maxTokenSize = 3;
const defaultFontSize = 16;
const defaultFontSize = 144;
const minFontSize = 16;
type TokenLabelProps = {
tokenState: TokenState;
@ -31,7 +32,7 @@ function TokenLabel({ tokenState, width, height }: TokenLabelProps) {
}
let fontSizes: number[] = [];
for (let size = 20 * labelSize; size >= 6; size--) {
for (let size = minFontSize * labelSize; size >= 6; size--) {
const verticalSize = height / size / tokenState.size;
const tokenSize = Math.min(tokenState.size, maxTokenSize);
const fontSize = verticalSize * tokenSize * labelSize;