tiletopia/dev.log
megaproxy 96a9180f3b Fix active-pane click via document-capture pointerdown
Root cause: xterm.js attaches its own pointerdown handler inside the
terminal and calls e.stopPropagation(), which prevents the .leaf
div's onpointerdown from firing for any click landing inside the
terminal body. That's why clicking pane bodies never moved the blue
active border — the event simply never reached our handler.

Fix: register a document-level CAPTURE-phase pointerdown listener
in App.svelte. Capture fires before xterm.js's bubble-phase handler
runs (and before it can stop propagation), so we always see the
click. The handler walks up via Element.closest('[data-leaf-id]')
to find which pane was clicked, then calls orch.setActive.

- LeafPane.svelte: add data-leaf-id={leaf.id} attribute so the
  document handler can identify the clicked pane.
- App.svelte: $effect attaches document.addEventListener('pointerdown',
  ..., true) and cleans up on teardown.
- Keep the per-leaf onpointerdown as a redundant backup for clicks
  on toolbar buttons (which sit outside the xterm subtree). Cheap
  + idempotent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:35:59 +01:00

20 lines
2.3 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

node.exe : $ tauri "dev"
At C:\Program Files\nodejs\pnpm.ps1:16 char:5
+ & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/pnpm. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ($ tauri "dev":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Running BeforeDevCommand (`pnpm dev`)
$ vite
VITE v5.4.21 ready in 482 ms
Ô×£ Local: http://127.0.0.1:1420/
Running DevCommand (`cargo run --no-default-features --color always --`)
Info Watching D:\dev\tiletopia\src-tauri for changes...
 Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.28s
 Running `target\debug\tiletopia.exe`
14:34:16 [vite] hmr update /src/App.svelte
14:34:25 [vite] hmr update /src/App.svelte
14:34:29 [vite] hmr update /src/lib/layout/LeafPane.svelte