[eric] dashboard: scroll zooms the canvas over any card (Google Maps); click into a card to scroll its content

This commit is contained in:
ciregenz
2026-07-15 19:17:08 -07:00
parent d405c221ed
commit dd4605c7b3
6 changed files with 96 additions and 11 deletions
+1
View File
@@ -25,6 +25,7 @@ export interface BrowserWebview extends HTMLElement {
isLoading: () => boolean;
// Optional: present on real Electron webviews; the iframe fallback lacks it, callers must ?.() it.
isCurrentlyAudible?: () => boolean;
send?: (channel: string, ...args: any[]) => void;
capturePage: (rect?: { x: number; y: number; width: number; height: number }) => Promise<ElectronNativeImage>;
executeJavaScript: (code: string) => Promise<any>;
sendInputEvent: (event: any) => void;
+22
View File
@@ -0,0 +1,22 @@
// The card you've clicked INTO, so plain scroll reads its content (chat transcript, web page)
// while scroll everywhere else zooms the canvas (Google Maps model). Imperative + read on the
// wheel handler so no re-render; cleared when you click blank canvas.
let scrollFocusedCardId: string | null = null;
type Listener = (id: string | null) => void;
const listeners = new Set<Listener>();
export function setScrollFocusedCard(id: string | null): void {
if (scrollFocusedCardId === id) return;
scrollFocusedCardId = id;
for (const l of listeners) l(id);
}
export function getScrollFocusedCard(): string | null {
return scrollFocusedCardId;
}
// Browser cards subscribe so they can tell their (out-of-process) guest whether plain wheel should scroll the page or zoom the canvas.
export function onScrollFocusChange(l: Listener): () => void {
listeners.add(l);
return () => { listeners.delete(l); };
}