mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-03-13 22:50:01 -04:00
Add comment on early return if !paper.view
This commit is contained in:
parent
3946cdc5f8
commit
f76a399b83
1 changed files with 3 additions and 0 deletions
|
@ -304,6 +304,9 @@ class PaperCanvas extends React.Component {
|
|||
// Sets the size that Paper thinks the canvas is to the size the canvas element actually is.
|
||||
// When these are out of sync, the mouse events in the paint editor don't line up correctly.
|
||||
return window.setTimeout(() => {
|
||||
// If the component unmounts, the canvas will be removed from the page, detaching paper.view.
|
||||
// This could also be called before paper.view exists.
|
||||
// In either case, return early if so without running the callback.
|
||||
if (!paper.view) return;
|
||||
// Prevent blurriness caused if the "CSS size" of the element is a float--
|
||||
// setting canvas dimensions to floats floors them, but we need to round instead
|
||||
|
|
Loading…
Reference in a new issue