Fix note crash when selecting pan tool
This commit is contained in:
parent
9fa8667081
commit
19d44f3f79
@ -69,6 +69,7 @@ function MapNotes({
|
||||
}
|
||||
|
||||
function handleBrushMove() {
|
||||
if (noteData) {
|
||||
const brushPosition = getBrushPosition();
|
||||
setNoteData((prev) => ({
|
||||
...prev,
|
||||
@ -77,6 +78,7 @@ function MapNotes({
|
||||
}));
|
||||
setIsBrushDown(true);
|
||||
}
|
||||
}
|
||||
|
||||
function handleBrushUp() {
|
||||
if (noteData) {
|
||||
|
@ -104,7 +104,8 @@ function Note({
|
||||
(_, i) => i + Math.ceil(noteHeight / 10)
|
||||
);
|
||||
|
||||
return sizes.reduce((prev, curr) => {
|
||||
if (sizes.length > 0) {
|
||||
const size = sizes.reduce((prev, curr) => {
|
||||
text.fontSize(curr);
|
||||
const width = text.getTextWidth() + notePadding * 2;
|
||||
if (width < noteWidth) {
|
||||
@ -113,8 +114,12 @@ function Note({
|
||||
return prev;
|
||||
}
|
||||
});
|
||||
|
||||
setFontSize(size);
|
||||
}
|
||||
setFontSize(findFontSize());
|
||||
}
|
||||
|
||||
findFontSize();
|
||||
}, [note, noteWidth, noteHeight, notePadding]);
|
||||
|
||||
const textRef = useRef();
|
||||
|
Loading…
x
Reference in New Issue
Block a user