Changed notes to left aligned and accept more text per line

This commit is contained in:
Mitchell McCaffrey 2021-02-13 10:45:28 +11:00
parent ed605fe55b
commit 93f45c738f
2 changed files with 6 additions and 4 deletions

View File

@ -11,6 +11,8 @@ import colors from "../../helpers/colors";
import usePrevious from "../../hooks/usePrevious"; import usePrevious from "../../hooks/usePrevious";
import useGridSnapping from "../../hooks/useGridSnapping"; import useGridSnapping from "../../hooks/useGridSnapping";
const minTextSize = 16;
function Note({ function Note({
note, note,
map, map,
@ -117,10 +119,10 @@ function Note({
} }
function findFontSize() { function findFontSize() {
// Create an array from 1 / 10 of the note height to the full note height // Create an array from 1 / minTextSize of the note height to the full note height
const sizes = Array.from( const sizes = Array.from(
{ length: Math.ceil(noteHeight - notePadding * 2) }, { length: Math.ceil(noteHeight - notePadding * 2) },
(_, i) => i + Math.ceil(noteHeight / 10) (_, i) => i + Math.ceil(noteHeight / minTextSize)
); );
if (sizes.length > 0) { if (sizes.length > 0) {
@ -203,7 +205,7 @@ function Note({
? "white" ? "white"
: "black" : "black"
} }
align="center" align="left"
verticalAlign="middle" verticalAlign="middle"
padding={notePadding} padding={notePadding}
fontSize={fontSize} fontSize={fontSize}

View File

@ -53,7 +53,7 @@ function NoteMenu({
}, [isOpen, note, wasOpen, noteNode]); }, [isOpen, note, wasOpen, noteNode]);
function handleTextChange(event) { function handleTextChange(event) {
const text = event.target.value.substring(0, 144); const text = event.target.value.substring(0, 1024);
note && onNoteChange({ ...note, text: text }); note && onNoteChange({ ...note, text: text });
} }