validateAndroidGestureViewport (src/gesture-viewport.ts)

agent-device · packages/platform-android/src/gesture-viewport.ts · typescript · MIT
pos

Validates Android gesture viewport Rect, ensuring numeric bounds and positive size for safe gesture handling.

// Source: https://github.com/callstack/agent-device | License: MIT | Copyright 2026 Callstack
// Provided via justclaw.it.com; keep this notice with the code.
import { AppError } from '@agent-device/kernel/errors';
import type { Rect } from '@agent-device/kernel/snapshot';

/**
 * What the helper reports about the surface a gesture may target: the application window, and the
 * input method window's share of the screen when a keyboard is on screen.
 *
 * The keyboard arrives as absolute screen pixels — the same space as the application window's
 * `getBoundsInScreen()` — and is never converted into another platform's coordinate space.
 */
export type AndroidGestureViewportReading = Readonly<{
  viewport: Rect;
  /**
   * Absent when no input method window is on screen, or when the install

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key