Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { useSelector } from "state"
  2. import { DotShape, ShapeProps } from "types"
  3. import ShapeGroup from "./shape-g"
  4. function BaseDot({
  5. fill = "#999",
  6. stroke = "none",
  7. strokeWidth = 0,
  8. }: ShapeProps<DotShape>) {
  9. return (
  10. <>
  11. <circle
  12. cx={strokeWidth}
  13. cy={strokeWidth}
  14. r={8}
  15. fill="transparent"
  16. stroke="none"
  17. strokeWidth="0"
  18. />
  19. <circle
  20. cx={strokeWidth}
  21. cy={strokeWidth}
  22. r={Math.max(1, 4 - strokeWidth)}
  23. fill={fill}
  24. stroke={stroke}
  25. strokeWidth={strokeWidth}
  26. />
  27. </>
  28. )
  29. }
  30. export default function Dot({ id, point }: DotShape) {
  31. const isSelected = useSelector((state) => state.values.selectedIds.has(id))
  32. return (
  33. <ShapeGroup id={id} point={point}>
  34. <BaseDot />
  35. {isSelected && <BaseDot fill="none" stroke="blue" strokeWidth={1} />}
  36. </ShapeGroup>
  37. )
  38. }