Skip to content

Pointer events

Pointer, wheel, hover и click events внутри canvas runtime.

Практическая схема

  • Документация: NovaCore.
  • Раздел: Взаимодействие.
  • Тема страницы: Pointer events.
  • Переключатель TypeScript / DSL находится в панели навигации; вкладка Код в примере показывает файлы выбранного подхода.
Исполняемый примерДиагностика inputCapture, bubble, selection и drag meta.
import { Nova, NovaNode, type NovaSchema } from '@endge/nova'

// Документационный сценарий: nova-input-diagnostics
class ExampleNode extends NovaNode<Record<string, Event>> {
  render(): void {
    const schema: NovaSchema = [
      {
        type: 'rect',
        x: 24,
        y: 24,
        width: this.width - 48,
        height: this.height - 48,
        styles: { background: '#0d2745' },
      },
      {
        type: 'text',
        x: 44,
        y: 44,
        width: this.width - 88,
        height: 32,
        text: 'Диагностика input',
        styles: { color: '#e8f5ff' },
      },
    ]

    this.renderer.schema(schema)
    this.setRenderBoundsFromSchema(schema)
  }
}

export function mountExample(canvas: HTMLCanvasElement) {
  const app = Nova.createApp({
    target: canvas,
    size: { width: canvas.clientWidth, height: canvas.clientHeight, maxDpr: 2 },
    scheduler: { loop: false },
  })
  const surface = app.surface({ id: 'input-diagnostics' })
  surface.createNode(ExampleNode)

  return () => app.destroy()
}

Как применять

Используйте страницу как короткую рабочую заметку: сначала определите границу ответственности, затем откройте пример и сравните TypeScript-реализацию с DSL-описанием. Runtime-код остается в Nova-слое, а Vue отвечает только за mount, layout shell и cleanup.