remove state checks for brush and zoom brush (#1717)

This PR removes the strict state checks for the brush and zoom brush. We
should consider making the canvas more controlled by what exists (e.g.
whether a `brush` exists) rather than depending on particular statechart
states.

### Change Type

- [x] `minor`

### Test Plan

1. Create a brush manually in the API.
2. The brush should be visible on the canvas.

### Release Notes

- [editor] remove `editor.isIn` state checks for displaying brush and
zoom brush.
This commit is contained in:
Steve Ruiz 2023-07-07 10:38:16 +01:00 committed by GitHub
parent a316fd2ab4
commit 7fe43bb2ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,7 +149,7 @@ const BrushWrapper = track(function BrushWrapper() {
const { brush } = editor const { brush } = editor
const { Brush } = useEditorComponents() const { Brush } = useEditorComponents()
if (!(Brush && brush && editor.isIn('select.brushing'))) return null if (!(Brush && brush)) return null
return <Brush className="tl-user-brush" brush={brush} /> return <Brush className="tl-user-brush" brush={brush} />
}) })
@ -159,7 +159,7 @@ export const ZoomBrushWrapper = track(function Zoom() {
const { zoomBrush } = editor const { zoomBrush } = editor
const { ZoomBrush } = useEditorComponents() const { ZoomBrush } = useEditorComponents()
if (!(ZoomBrush && zoomBrush && editor.isIn('zoom'))) return null if (!(ZoomBrush && zoomBrush)) return null
return <ZoomBrush className="tl-user-brush" brush={zoomBrush} /> return <ZoomBrush className="tl-user-brush" brush={zoomBrush} />
}) })