AppCanvas.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* eslint-disable @typescript-eslint/no-explicit-any */
  2. import * as React from 'react'
  3. import { observer } from 'mobx-react-lite'
  4. import type { TLReactShape } from '~lib'
  5. import { useApp } from '~hooks'
  6. import type { AppProps } from './App'
  7. import { Renderer } from './Renderer'
  8. export const AppCanvas = observer(function InnerApp<S extends TLReactShape>(
  9. props: AppProps<S>
  10. ): JSX.Element {
  11. const app = useApp<S>()
  12. return (
  13. <Renderer
  14. viewport={app.viewport}
  15. inputs={app.inputs}
  16. callbacks={app._events as any}
  17. brush={app.brush}
  18. editingShape={app.editingShape}
  19. hoveredShape={app.hoveredShape}
  20. bindingShapes={app.bindingShapes}
  21. selectionDirectionHint={app.selectionDirectionHint}
  22. selectionBounds={app.selectionBounds}
  23. selectedShapes={app.selectedShapesArray}
  24. erasingShapes={app.erasingShapesArray}
  25. shapes={app.shapesInViewport}
  26. assets={app.assets}
  27. showGrid={app.settings.showGrid}
  28. showSelection={app.showSelection}
  29. showSelectionRotation={app.showSelectionRotation}
  30. showResizeHandles={app.showResizeHandles}
  31. showRotateHandles={app.showRotateHandles}
  32. showSelectionDetail={app.showSelectionDetail}
  33. showContextBar={app.showContextBar}
  34. showContextMenu={app.showContextMenu}
  35. cursor={app.cursors.cursor}
  36. cursorRotation={app.cursors.rotation}
  37. selectionRotation={app.selectionRotation}
  38. onEditingEnd={app.clearEditingState}
  39. {...props}
  40. />
  41. )
  42. })