openpencil/packages/docs/pl/programmable/sdk/api/composables/use-canvas-input.md
Danila Poyarkov 14325280d9 docs(i18n): translate all missing pages to 6 languages
- 78 SDK pages per language (components, composables, advanced API,
  guides, architecture, getting-started)
- vector-edit.md user guide page (5 languages)
- Update stale ru/programmable/cli/inspecting.md
- Fix YAML frontmatter quoting for colons in descriptions

474 files, 0 missing pages across de/es/fr/it/pl/ru.
VitePress build verified — all 546 SDK pages render.
2026-04-22 18:35:22 +03:00

1.3 KiB

title description
useCanvasInput Podłącz wejście wskaźnika kanvasu, przeciąganie, selekcję, zmianę rozmiaru, obrót i zachowanie narzędzi.

useCanvasInput

useCanvasInput() łączy interakcję wskaźnika i myszy z kanwasem edytora.

Obsługuje zagadnienia interakcji takie jak:

  • selekcja
  • przeciąganie
  • zmiana rozmiaru
  • obrót
  • przesuwanie
  • przepływy pióra/rysowania
  • interakcja edycji tekstu
  • testy trafień uwzględniające zakres

Użycie

Ten kompozyt jest zazwyczaj parowany z useCanvas() i pomocnikami testów trafień z renderera.

useCanvasInput(
  canvasRef,
  editor,
  hitTestSectionTitle,
  hitTestComponentLabel,
  hitTestFrameTitle,
)

Podstawowy przykład

const canvas = useCanvas(canvasRef, editor)

useCanvasInput(
  canvasRef,
  editor,
  canvas.hitTestSectionTitle,
  canvas.hitTestComponentLabel,
  canvas.hitTestFrameTitle,
)

Przykłady praktyczne

Śledź ruch kursora w przestrzeni kanvasu

useCanvasInput(
  canvasRef,
  editor,
  hitTestSectionTitle,
  hitTestComponentLabel,
  hitTestFrameTitle,
  (cx, cy) => {
    console.log(cx, cy)
  },
)

Uwagi

Ten kompozyt jest niższego poziomu niż większość logiki paneli. Najlepiej nadaje się do powłok edytora i kontenerów kanvasu.

Powiązane API