您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

page.tsx 747B

123456789101112131415161718192021222324252627282930
  1. import { useSelector } from 'state'
  2. import Shape from './shape'
  3. import usePageShapes from 'hooks/usePageShapes'
  4. /*
  5. On each state change, compare node ids of all shapes
  6. on the current page. Kind of expensive but only happens
  7. here; and still cheaper than any other pattern I've found.
  8. */
  9. const noOffset = [0, 0]
  10. export default function Page(): JSX.Element {
  11. const currentPageShapeIds = usePageShapes()
  12. const isSelecting = useSelector((s) => s.isIn('selecting'))
  13. return (
  14. <g pointerEvents={isSelecting ? 'all' : 'none'}>
  15. {currentPageShapeIds.map((shapeId) => (
  16. <Shape
  17. key={shapeId}
  18. id={shapeId}
  19. isSelecting={isSelecting}
  20. parentPoint={noOffset}
  21. />
  22. ))}
  23. </g>
  24. )
  25. }