Move and rename DashboardInputEvent->InputEvent
This commit is contained in:
1 parent
3e8be93833
commit
80d688dd4e
51 files changed
+299
-361
No files matched your search
@@ -14,7 +14,6 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
|
||||
declare const global: any;
|
||||
@@ -213,7 +213,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -302,7 +302,7 @@ function windowMenu(window: BlocksWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -319,7 +319,7 @@ function handleInput(window: BlocksWindow, event: DashboardInputEvent, frameId:
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
tryMove(window, -1, 0);
|
||||
@@ -346,7 +346,7 @@ function handlePlayingInput(window: BlocksWindow, event: DashboardInputEvent, fr
|
||||
}
|
||||
|
||||
/** Input while paused or game over. */
|
||||
function handleIdleInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "game-over") resetGame(window);
|
||||
|
||||
@@ -11,31 +11,16 @@ import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { getDefaultLargeFont, getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { gestureHints, GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { type DashboardInputEvent, type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, gestureHints, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { ConfigSettingBoolean, ConfigSettingEnum } from "../../ui/dashboard-settings";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
|
||||
import { type MathBranchOutcome, MathCoordinator } from "./math/coordinator";
|
||||
import {
|
||||
type LongRunOffer,
|
||||
type LongRunProgress,
|
||||
offerGlassesPrompt,
|
||||
progressText,
|
||||
} from "./math/workload";
|
||||
import { type LongRunOffer, type LongRunProgress, offerGlassesPrompt, progressText } from "./math/workload";
|
||||
import { plain } from "./math/text-renderer";
|
||||
import { drawGraph } from "./calculator-graph";
|
||||
import {
|
||||
type CalculatorListening,
|
||||
type CalculatorMode,
|
||||
CALCULATOR_MODES,
|
||||
cycleMode,
|
||||
isDictationCancellation,
|
||||
isWorthAnswering,
|
||||
listeningLabel,
|
||||
modeCommand,
|
||||
modeLabel,
|
||||
} from "./calculator-commands";
|
||||
import { type CalculatorListening, type CalculatorMode, CALCULATOR_MODES, cycleMode, isDictationCancellation, isWorthAnswering, listeningLabel, modeCommand, modeLabel } from "./calculator-commands";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Settings
|
||||
@@ -314,7 +299,7 @@ export class CalculatorLayer implements Layer {
|
||||
this.submit(text);
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
case "scroll-down": {
|
||||
|
||||
@@ -4,9 +4,9 @@ import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { readUpcomingEvents, type CalendarEvent } from "../../native/calendar";
|
||||
import { timeFormatSetting } from "../../ui/dashboard-settings";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { hasCalendarPermission } from "../../g2/android-permissions";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
|
||||
// Title position, shared with the other list apps (terminal, notifications).
|
||||
@@ -85,7 +85,7 @@ export class CalendarLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent): void {
|
||||
handleInput(event: InputEvent): void {
|
||||
if (!hasCalendarPermission()) {
|
||||
// Any tap on the prompt re-triggers the phone-side permission request.
|
||||
if (event.type === "click") this.requestPermission();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { screenCenterInViewportX } from "../../ui/shell/geometry";
|
||||
import {
|
||||
@@ -75,7 +76,7 @@ export class CompassCalibrationLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "scroll-up") {
|
||||
this.adjust(1);
|
||||
} else if (event.type === "scroll-down") {
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
type CompassEvent,
|
||||
} from "../../native/compass";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { screenCenterInViewportX } from "../../ui/shell/geometry";
|
||||
import {
|
||||
@@ -205,7 +206,7 @@ class CompassLayer implements Layer {
|
||||
// A tap opens calibration from either state: it is the affordance the
|
||||
// "Uncalibrated" prompt advertises, and re-calibrating is a normal thing to
|
||||
// want once the glasses have been taken off and put back on.
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "click") this.openCalibration(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fon
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { addImuListener, imuSourceLabel, setImuReportEnabled, type ImuReading } from "../../native/imu";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
|
||||
// IMU report pace. This is NOT a literal Hz — the firmware only accepts the
|
||||
@@ -119,7 +119,7 @@ export class AccelerometerDemoLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { drawSelectionHighlight, scrollToKeepSelectionVisible } from "../../ui/menu";
|
||||
import { tightRowHeight } from "../../ui/metrics";
|
||||
import {
|
||||
@@ -61,7 +61,7 @@ export class BuzzerDemoLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
||||
|
||||
@@ -3,8 +3,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { type AppContext } from "../app-definition";
|
||||
import { isLoadableAppUrl, openEvenHubUrl } from "../evenhub";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { developerAppUrlSetting } from "../../ui/dashboard-settings";
|
||||
import { isQrScannerAvailable, scanQrCode } from "../../native/qr-scan";
|
||||
@@ -76,7 +76,7 @@ export class LoadAppFromUrlLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
void this.launch(ctx);
|
||||
@@ -153,7 +153,7 @@ export class LoadAppFromQrLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (!this.busy && isQrScannerAvailable()) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
|
||||
declare const com: any;
|
||||
@@ -110,7 +110,7 @@ export class ResourceUsageLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { drawListScrollbar } from "../../ui/menu";
|
||||
|
||||
const COLOR_VALUE_COUNT = 256;
|
||||
@@ -49,7 +50,7 @@ export class ScreenTestLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.scrollRow = Math.max(0, this.scrollRow - 1);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../../ui/metrics";
|
||||
|
||||
@@ -79,7 +80,7 @@ export class EvenHubApiKeyDialogLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
case "scroll-down":
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { EVENHUB_SCREEN_WIDTH } from "./compositor";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import {
|
||||
createInProcessWindow,
|
||||
type InProcessAppOptions,
|
||||
@@ -33,7 +34,7 @@ class EvenHubAppLayer implements Layer {
|
||||
return this.session.paint(size, ctx.stack.isFocused());
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent): void {
|
||||
handleInput(event: InputEvent): void {
|
||||
// Everything goes to the app; long-press never reaches here (the window
|
||||
// menu intercepts it), which is the guaranteed way out since EvenHub
|
||||
// apps own double-click.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { permissionDetail, permissionLabel, type EvenHubPermission } from "./permissions";
|
||||
import { openPrivacyPolicyOnPhone } from "./privacy-policy";
|
||||
@@ -89,7 +90,7 @@ export class EvenHubPermissionDialogLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
const actions = this.actions();
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
import { ApplicationSettings } from "@nativescript/core";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { EvenHubFont } from "../../graphics/evenhub-font";
|
||||
import { type DashboardInputEvent, type InputSource, type Layer } from "../../ui/layers";
|
||||
import { type InputEvent, type InputSource } from "../../ui/gestures";
|
||||
import { type Layer } from "../../ui/layers";
|
||||
import {
|
||||
anthropicApiKeySetting,
|
||||
elevenLabsApiKeySetting,
|
||||
@@ -425,7 +426,7 @@ export class EvenHubSession implements EvenHubMicClient, EvenHubImuClient, EvenH
|
||||
* fields elided the way protobuf JSON elides them; list selection moves
|
||||
* locally with events only for clicks and boundary scrolls.
|
||||
*/
|
||||
handleGesture(event: DashboardInputEvent): void {
|
||||
handleGesture(event: InputEvent): void {
|
||||
if (!this.page) return;
|
||||
const capture = this.page ? eventCaptureContainer(this.page) : undefined;
|
||||
switch (event.type) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText, wrapText } from "../../graphics/textwrap";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { TextViewerLayer } from "../files/text-viewer";
|
||||
import { evenHubApi, type EvenHubStoreApp } from "./even-api";
|
||||
@@ -109,7 +110,7 @@ export class EvenHubStoreDetailLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click") {
|
||||
if (!this.working) ctx.stack.pop();
|
||||
return;
|
||||
|
||||
@@ -2,30 +2,12 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { truncateText, wrapText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { type DashboardInputEvent, type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import {
|
||||
drawListScrollbar,
|
||||
drawSelectionHighlight,
|
||||
scrollToKeepSelectionVisible,
|
||||
type MenuItem,
|
||||
} from "../../ui/menu";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { drawListScrollbar, drawSelectionHighlight, scrollToKeepSelectionVisible, type MenuItem } from "../../ui/menu";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
import {
|
||||
evenHubApi,
|
||||
EvenHubAuthenticationError,
|
||||
isEvenHubStoreConfigured,
|
||||
type EvenHubStoreApp,
|
||||
} from "./even-api";
|
||||
import {
|
||||
clearEvenHubLoginForm,
|
||||
clearEvenHubSession,
|
||||
clearTransientEvenHubSession,
|
||||
evenHubLoginEmailSetting,
|
||||
evenHubLoginPasswordSetting,
|
||||
evenHubRememberMeSetting,
|
||||
resetEvenHubLoginForm,
|
||||
} from "./credentials";
|
||||
import { evenHubApi, EvenHubAuthenticationError, isEvenHubStoreConfigured, type EvenHubStoreApp } from "./even-api";
|
||||
import { clearEvenHubLoginForm, clearEvenHubSession, clearTransientEvenHubSession, evenHubLoginEmailSetting, evenHubLoginPasswordSetting, evenHubRememberMeSetting, resetEvenHubLoginForm } from "./credentials";
|
||||
import { EvenHubStoreDetailLayer } from "./store-detail-layer";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
|
||||
@@ -122,7 +104,7 @@ export class EvenHubStoreLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (this.showingLogin) {
|
||||
if (event.type === "click" && !this.loading) {
|
||||
this.openCredentialEditor(ctx);
|
||||
|
||||
@@ -15,7 +15,8 @@ import {
|
||||
statPath,
|
||||
type DirectoryEntry,
|
||||
} from "../../native/file-access";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const LIST_X = 20;
|
||||
|
||||
@@ -231,7 +232,7 @@ export class FileBrowserLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (filesViewModeSetting.get() === "list") {
|
||||
await this.handleListInput(event, ctx);
|
||||
} else {
|
||||
@@ -239,7 +240,7 @@ export class FileBrowserLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private async handleListInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
private async handleListInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
const rows = this.flatRows();
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -261,7 +262,7 @@ export class FileBrowserLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private async handleIconsInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
private async handleIconsInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
const rows = this.flatRows();
|
||||
const iconRows = buildIconRows(rows);
|
||||
this.selectedRow = clamp(this.selectedRow, 0, Math.max(0, iconRows.length - 1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import type { DirectoryEntry } from "../../native/file-access";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../../ui/metrics";
|
||||
|
||||
@@ -81,7 +81,7 @@ export class FileInfoDialogLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
if (this.actions.length) {
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import {
|
||||
canLoadFontFile,
|
||||
fontFileDisplayName,
|
||||
fontFileMetrics,
|
||||
renderFontFileText,
|
||||
renderFontFileWrapped,
|
||||
} from "../../native/font-files";
|
||||
import {
|
||||
GESTURE_CLICK,
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_SCROLL,
|
||||
gestureHints,
|
||||
} from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { canLoadFontFile, fontFileDisplayName, fontFileMetrics, renderFontFileText, renderFontFileWrapped } from "../../native/font-files";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, gestureHints, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const MARGIN_X = 18;
|
||||
const TITLE_Y = 8;
|
||||
@@ -126,7 +115,7 @@ export class FontPreviewerLayer implements Layer {
|
||||
return out;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.setSizeIndex(this.sizeIndex + 1);
|
||||
|
||||
@@ -3,8 +3,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { loadImageFileAsGray } from "../../native/image-files";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const MARGIN_X = 18;
|
||||
const TITLE_Y = 8;
|
||||
@@ -50,7 +50,7 @@ export class ImageViewerLayer implements Layer {
|
||||
return out;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { TtfFont } from "../../graphics/ttf-font";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const MARGIN_X = 18;
|
||||
const TITLE_Y = 16;
|
||||
@@ -58,7 +59,7 @@ export class TextViewerLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-down":
|
||||
this.scrollBy(this.pageStep());
|
||||
|
||||
@@ -18,12 +18,11 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { MenuItem } from "../../ui/menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_LONG_PRESS } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_LONG_PRESS, type InputEvent } from "../../ui/gestures";
|
||||
|
||||
declare const global: any;
|
||||
declare const com: any;
|
||||
@@ -168,7 +167,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -256,7 +255,7 @@ function windowMenu(window: FreecellWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: FreecellWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: FreecellWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -273,7 +272,7 @@ function handleInput(window: FreecellWindow, event: DashboardInputEvent, frameId
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: FreecellWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: FreecellWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
window.cursor = (window.cursor + LOC_COUNT - 1) % LOC_COUNT;
|
||||
@@ -312,7 +311,7 @@ function handlePlayingInput(window: FreecellWindow, event: DashboardInputEvent,
|
||||
renderAndSubmit(window, frameId);
|
||||
}
|
||||
|
||||
function handleWonInput(window: FreecellWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleWonInput(window: FreecellWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
newGame(window, false);
|
||||
|
||||
@@ -5,7 +5,8 @@ import { GrayImage } from "../../graphics/image";
|
||||
import { type Plane } from "../../graphics/plane";
|
||||
import { renderIcon, type IconName } from "../../graphics/icons";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { DashboardInputEvent, isWatchInput, Layer, LayerActions, LayerContext } from "../../ui/layers";
|
||||
import { InputEvent, isWatchInput } from "../../ui/gestures";
|
||||
import { Layer, LayerActions, LayerContext } from "../../ui/layers";
|
||||
import { drawSelectionHighlight, MenuLayer, scrollToKeepSelectionVisible, type MenuItem } from "../../ui/menu";
|
||||
import { iconGridMinRowHeight } from "../../ui/metrics";
|
||||
import { WINDOW_MENU_LAYOUT } from "../../ui/window-menu";
|
||||
@@ -313,7 +314,7 @@ class LauncherGridLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (isWatchInput(event)) {
|
||||
await this.handleWatchInput(event, ctx);
|
||||
return;
|
||||
@@ -378,7 +379,7 @@ class LauncherGridLayer implements Layer {
|
||||
* Row mode is restored on the way out so a ring user finds the grid as
|
||||
* they left it.
|
||||
*/
|
||||
private async handleWatchInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
private async handleWatchInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
const entries = this.entries();
|
||||
const rows = this.rowCount(entries.length);
|
||||
if (this.mode === "row") {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { micSession, type CaptionLine, type MicSessionState } from "./mic-session";
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ export class CaptionsLayer implements Layer {
|
||||
return rows;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.scrollback += 1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { micSession, type MicSessionState } from "./mic-session";
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ export class LevelsLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { micSession, type MicSessionState } from "./mic-session";
|
||||
import { dotBrightness } from "./radar-dots";
|
||||
|
||||
@@ -175,7 +175,7 @@ export class RadarLayer implements Layer {
|
||||
return normalize(worldDeg - state.headingDeg);
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
micSession.setBeamWorldDeg(this.state.beamWorldDeg - 15);
|
||||
|
||||
@@ -18,7 +18,6 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -27,6 +26,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
@@ -178,7 +178,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -282,7 +282,7 @@ function windowMenu(window: MinesweeperWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: MinesweeperWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: MinesweeperWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -299,7 +299,7 @@ function handleInput(window: MinesweeperWindow, event: DashboardInputEvent, fram
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: MinesweeperWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: MinesweeperWindow, event: InputEvent, frameId: number): void {
|
||||
const rowMode = window.selectMode === "row";
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -347,7 +347,7 @@ function handlePlayingInput(window: MinesweeperWindow, event: DashboardInputEven
|
||||
}
|
||||
|
||||
/** Input while paused, won, or lost. */
|
||||
function handleIdleInput(window: MinesweeperWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: MinesweeperWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "paused") {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import {
|
||||
MenuLayer,
|
||||
drawListScrollbar,
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
type MediaBrowseItem,
|
||||
type MediaBrowserApp,
|
||||
} from "../../native/media-browser";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
/** Header: title line + path line (34px at the 12px bitmap default). */
|
||||
function headerHeight(font: UiFont): number {
|
||||
@@ -152,7 +152,7 @@ export class MediaBrowseLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (this.phase === "failed") {
|
||||
if (event.type === "click") {
|
||||
this.phase = "idle";
|
||||
|
||||
@@ -2,35 +2,14 @@ import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fon
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import {
|
||||
GESTURE_CLICK,
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_SCROLL_DOWN,
|
||||
GESTURE_SCROLL_UP,
|
||||
} from "../../ui/gestures";
|
||||
import { directionalFallback, GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL_DOWN, GESTURE_SCROLL_UP, type InputEvent, isDirectionalInput } from "../../ui/gestures";
|
||||
import { MenuLayer, drawSelectionHighlight, drawSubmenuIndicator } from "../../ui/menu";
|
||||
import { lineStep, tightRowHeight } from "../../ui/metrics";
|
||||
import {
|
||||
mediaControllerBridge,
|
||||
type MediaControllerState,
|
||||
type MediaQueueItem,
|
||||
} from "../../native/media-controller";
|
||||
import { mediaControllerBridge, type MediaControllerState, type MediaQueueItem } from "../../native/media-controller";
|
||||
import { mediaBrowserBridge, type MediaBrowserApp } from "../../native/media-browser";
|
||||
import { MediaBrowseLayer } from "./media-browse";
|
||||
import {
|
||||
directionalFallback,
|
||||
isDirectionalInput,
|
||||
Layer,
|
||||
type DashboardInputEvent,
|
||||
type LayerContext,
|
||||
type PaintBelow,
|
||||
} from "../../ui/layers";
|
||||
import {
|
||||
createInProcessWindow,
|
||||
YieldAtRootLayer,
|
||||
type InProcessAppOptions,
|
||||
type InProcessWindow,
|
||||
} from "../../ui/shell/in-process-window";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { createInProcessWindow, YieldAtRootLayer, type InProcessAppOptions, type InProcessWindow } from "../../ui/shell/in-process-window";
|
||||
|
||||
export const MUSIC_WINDOW_ID = "music";
|
||||
export const MUSIC_SURFACE_ID = "window:music";
|
||||
@@ -217,7 +196,7 @@ class MusicAppLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click" && this.focusColumn === "playlist") {
|
||||
this.focusColumn = "actions";
|
||||
this.selectedActionIndex = PLAYLIST_ACTION_INDEX;
|
||||
@@ -253,9 +232,9 @@ class MusicAppLayer implements Layer {
|
||||
if (media.canSkipPrevious) await mediaControllerBridge.skipPrevious();
|
||||
return;
|
||||
case "swipe-up":
|
||||
return this.handleInput({ type: "scroll-up" }, ctx);
|
||||
return this.handleInput({ type: "scroll-up", timestampMs: event.timestampMs }, ctx);
|
||||
case "swipe-down":
|
||||
return this.handleInput({ type: "scroll-down" }, ctx);
|
||||
return this.handleInput({ type: "scroll-down", timestampMs: event.timestampMs }, ctx);
|
||||
case "scroll-up":
|
||||
if (this.focusColumn === "playlist") {
|
||||
this.selectedQueueIndex = Math.max(0, this.selectedQueueIndex - 1);
|
||||
@@ -442,7 +421,7 @@ class VolumeModalLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "scroll-up") {
|
||||
this.adjust(2);
|
||||
} else if (event.type === "scroll-down") {
|
||||
@@ -471,7 +450,7 @@ class MusicRootLayer implements Layer {
|
||||
return this.yieldAtRoot.paint(ctx, paintBelow);
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click" && this.music.isPlaylistFocused()) {
|
||||
await this.music.handleInput(event, ctx);
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,10 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { ToolSpec, ToolResult } from "../../assistant/tool-registry";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { LocationTracker, type TrackedLocation } from "../../native/location-tracker";
|
||||
import {
|
||||
fetchRoute,
|
||||
@@ -178,7 +177,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
case "text-input":
|
||||
// Voice input / typed text sets a destination directly.
|
||||
@@ -614,7 +613,7 @@ function windowMenu(win: NavWindow): WindowMenu {
|
||||
return win.menu;
|
||||
}
|
||||
|
||||
function handleInput(win: NavWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(win: NavWindow, event: InputEvent, frameId: number): void {
|
||||
if (win.menu?.isOpen()) {
|
||||
win.menu
|
||||
.handleInput(event)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultLargeFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { DashboardInputEvent, Layer, LayerContext } from "../../ui/layers";
|
||||
import { InputEvent } from "../../ui/gestures";
|
||||
import { Layer, LayerContext } from "../../ui/layers";
|
||||
import { nightscoutBridge, type NightscoutState } from "../../native/nightscout-bridge";
|
||||
import {
|
||||
isNightscoutSettingsConfigured,
|
||||
@@ -361,7 +362,7 @@ export class NightscoutLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
// The menu lives on the window's long-press menu (see nightscoutMenuItems);
|
||||
// double-click at the app root is handled by the yield wrapper.
|
||||
if (event.type === "double-click") {
|
||||
|
||||
@@ -25,7 +25,6 @@ import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import { getStringSetting, setStringSetting } from "../../native/settings-store";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
@@ -349,7 +349,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -467,7 +467,7 @@ function windowMenu(window: PinballWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: PinballWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: PinballWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -484,7 +484,7 @@ function handleInput(window: PinballWindow, event: DashboardInputEvent, frameId:
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: PinballWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: PinballWindow, event: InputEvent, frameId: number): void {
|
||||
const ready = window.ballState === "ready";
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -530,7 +530,7 @@ function handlePlayingInput(window: PinballWindow, event: DashboardInputEvent, f
|
||||
}
|
||||
|
||||
/** Input while paused or game over. */
|
||||
function handleIdleInput(window: PinballWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: PinballWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "game-over") resetGame(window);
|
||||
|
||||
@@ -12,12 +12,11 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { truncateText, wrapText } from "../../graphics/textwrap";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import type { MenuItem } from "../../ui/menu";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { ToolResult, ToolSpec } from "../../assistant/tool-registry";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { DocumentView } from "../../ui/document/document-view";
|
||||
import { docNodePageLink, type DocNode } from "../../ui/document/document-model";
|
||||
import {
|
||||
@@ -173,7 +172,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
case "text-input":
|
||||
// Voice input / typed text becomes a new todo on the shown page.
|
||||
@@ -342,7 +341,7 @@ function menuItems(win: RoamWindow): MenuItem[] {
|
||||
return [...items, ...defaultWindowMenuItems(win.windowId, post)];
|
||||
}
|
||||
|
||||
function handleInput(win: RoamWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(win: RoamWindow, event: InputEvent, frameId: number): void {
|
||||
if (win.menu?.isOpen()) {
|
||||
win.menu
|
||||
.handleInput(event)
|
||||
|
||||
@@ -38,38 +38,14 @@ import { getDefaultSmallFont, getTerminalFontConfig } from "../../graphics/ui-fo
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { TERMINAL_ICON_GLYPHS } from "../../graphics/icons";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import {
|
||||
G2MirrorClient,
|
||||
type G2MirrorClientOptions,
|
||||
type G2MirrorSession,
|
||||
type G2MirrorState,
|
||||
} from "../../native/g2mirror-client";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { G2MirrorClient, type G2MirrorClientOptions, type G2MirrorSession, type G2MirrorState } from "../../native/g2mirror-client";
|
||||
import { onSettingsStoreChanged } from "../../native/settings-store";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import {
|
||||
terminalAutoReconnectSetting,
|
||||
terminalLaunchPresetsSetting,
|
||||
terminalNewConnectionSetting,
|
||||
terminalWakeOnBellSetting,
|
||||
} from "../../ui/dashboard-settings";
|
||||
import {
|
||||
connectionDisplayName,
|
||||
loadConnections,
|
||||
parseConnectionString,
|
||||
saveConnections,
|
||||
TERMINAL_CONNECTIONS_KEY,
|
||||
updateConnection,
|
||||
type TerminalConnection,
|
||||
} from "./connections";
|
||||
import { terminalAutoReconnectSetting, terminalLaunchPresetsSetting, terminalNewConnectionSetting, terminalWakeOnBellSetting } from "../../ui/dashboard-settings";
|
||||
import { connectionDisplayName, loadConnections, parseConnectionString, saveConnections, TERMINAL_CONNECTIONS_KEY, updateConnection, type TerminalConnection } from "./connections";
|
||||
import { TerminalEmulator } from "./terminal-emulator";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import {
|
||||
drawListScrollbar,
|
||||
drawSelectionHighlight,
|
||||
scrollToKeepSelectionVisible,
|
||||
type MenuItem,
|
||||
} from "../../ui/menu";
|
||||
import { drawListScrollbar, drawSelectionHighlight, scrollToKeepSelectionVisible, type MenuItem } from "../../ui/menu";
|
||||
import { lineStep, listRowHeight } from "../../ui/metrics";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import { appViewportSize } from "../../ui/shell/geometry";
|
||||
@@ -324,7 +300,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "text-input": {
|
||||
@@ -925,7 +901,7 @@ function windowMenuItems(window: TerminalWindow): MenuItem[] {
|
||||
return items;
|
||||
}
|
||||
|
||||
function handleInput(window: TerminalWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: TerminalWindow, event: InputEvent, frameId: number): void {
|
||||
if (window.kind === "view") activeViewId = window.windowId;
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
@@ -1281,7 +1257,7 @@ function clampHubSelection(window: HubWindow, items: HubItem[]): void {
|
||||
window.selectedIndex = index;
|
||||
}
|
||||
|
||||
function handleHubInput(window: HubWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleHubInput(window: HubWindow, event: InputEvent, frameId: number): void {
|
||||
if (window.mode === "add") {
|
||||
if (event.type === "click") {
|
||||
saveAddConnection(window);
|
||||
|
||||
@@ -15,15 +15,10 @@ import {
|
||||
fireTimerNotification,
|
||||
scheduleTimerNotification,
|
||||
} from "../../native/timer-notifications";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { ToolResult, ToolSpec } from "../../assistant/tool-registry";
|
||||
import {
|
||||
GESTURE_CLICK,
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_SCROLL,
|
||||
} from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
declare const global: any;
|
||||
@@ -165,7 +160,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -302,7 +297,7 @@ function windowMenu(window: TimerWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -338,7 +333,7 @@ function handleInput(window: TimerWindow, event: DashboardInputEvent, frameId: n
|
||||
}
|
||||
}
|
||||
|
||||
function handleStopwatchInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleStopwatchInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
if (event.type === "scroll-up" || event.type === "scroll-down") {
|
||||
const delta = event.type === "scroll-down" ? 1 : -1;
|
||||
window.stopwatchAction = clamp(window.stopwatchAction + delta, 0, 2);
|
||||
@@ -368,7 +363,7 @@ function handleStopwatchInput(window: TimerWindow, event: DashboardInputEvent, f
|
||||
renderAndSubmit(window, frameId);
|
||||
}
|
||||
|
||||
function handleTimersInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleTimersInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
syncExpiredTimers();
|
||||
const itemCount = timers.length + 2; // Stopwatch navigation + New timer + timers.
|
||||
if (event.type === "scroll-up" || event.type === "scroll-down") {
|
||||
@@ -395,7 +390,7 @@ function handleTimersInput(window: TimerWindow, event: DashboardInputEvent, fram
|
||||
renderAndSubmit(window, frameId);
|
||||
}
|
||||
|
||||
function handleEditorInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleEditorInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
if (event.type === "scroll-up" || event.type === "scroll-down") {
|
||||
const delta = event.type === "scroll-up" ? 1 : -1;
|
||||
if (window.editorField === 0) {
|
||||
|
||||
@@ -3,14 +3,14 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { writeTextToDownloads } from "../../native/file-access";
|
||||
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
/**
|
||||
* Live transcription view. Continuous mic capture is owned by the app wrapper
|
||||
* (createTranscribeAppWindow); this layer accumulates the transcript, shows
|
||||
* it, and saves it to Downloads on click.
|
||||
*/
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
export class TranscribeLayer implements Layer {
|
||||
private status = "Listening...";
|
||||
// Finalized utterances, plus the live (replace-semantics) partial appended
|
||||
@@ -56,7 +56,7 @@ export class TranscribeLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "click") {
|
||||
this.saveTranscript();
|
||||
ctx.actions.requestRender();
|
||||
|
||||
@@ -3,8 +3,8 @@ import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { type ForecastPeriod, type WeatherState } from "../../native/weather";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { drawSelectionHighlight, scrollToKeepSelectionVisible } from "../../ui/menu";
|
||||
import { lineStep, tightRowHeight } from "../../ui/metrics";
|
||||
|
||||
@@ -70,7 +70,7 @@ export class WeatherLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent): void {
|
||||
handleInput(event: InputEvent): void {
|
||||
const weather = this.state();
|
||||
if (event.type === "click") {
|
||||
// Refresh on the forecast view lives in the long-press menu; a tap
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GESTURE_DOUBLE_CLICK } from "./gestures";
|
||||
import { GESTURE_DOUBLE_CLICK, InputEvent } from "./gestures";
|
||||
import {
|
||||
getBooleanSetting,
|
||||
getStringSetting,
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { isLocalModelReady } from "../native/llama";
|
||||
import { drawRightValueMenuItem, drawToggleMenuItem, MenuItem, openModalMenu } from "./menu";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep } from "./metrics";
|
||||
import { DashboardInputEvent, Layer, type LayerContext } from "./layers";
|
||||
import { Layer, type LayerContext } from "./layers";
|
||||
import { GrayImage } from "~/graphics/image";
|
||||
|
||||
export type NightscoutSettings = {
|
||||
@@ -878,7 +878,7 @@ export class EditTextSettingLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
void ctx.actions.endTextSettingEdit();
|
||||
ctx.stack.pop();
|
||||
|
||||
@@ -2,7 +2,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { DashboardInputEvent, Layer, LayerContext, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerContext, PaintBelow } from "../layers";
|
||||
import { drawSelectionHighlight, isMenuItemDisabled, MenuItem, MenuLayer, openModalMenu } from "../menu";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../metrics";
|
||||
import { shell } from "../shell/shell";
|
||||
@@ -184,7 +185,7 @@ export class SettingsPanelLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (this.focus === "left") {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -263,7 +264,7 @@ export class SettingsDescriptionOverlayLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
return this.panel.handleInput(event, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ import {
|
||||
type BitmapFace,
|
||||
type UiFontSelection,
|
||||
} from "../graphics/ui-fonts";
|
||||
import { GESTURE_DOUBLE_CLICK } from "./gestures";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "./gestures";
|
||||
import { drawRightValueMenuItem, drawSelectionHighlight, openModalMenu, type MenuItem } from "./menu";
|
||||
import { LIST_ROW_TEXT_INSET, listRowHeight } from "./metrics";
|
||||
import type { DashboardInputEvent, Layer, LayerContext } from "./layers";
|
||||
import type { Layer, LayerContext } from "./layers";
|
||||
|
||||
const SIZE_CHOICES = [12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28] as const;
|
||||
const DEFAULT_TTF_SIZE = 16;
|
||||
@@ -162,7 +162,7 @@ export class FontPickerLayer implements Layer {
|
||||
return String(this.draft.size);
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.selectedRow = (this.selectedRow + ROWS.length - 1) % ROWS.length;
|
||||
|
||||
@@ -1,3 +1,103 @@
|
||||
/**
|
||||
* Where an input came from. The ring and the glasses' arms are the stock
|
||||
* sources; "watch" is the Wear OS remote, which components may treat with a
|
||||
* richer scheme (see isWatchInput) — the ring's semantics are never changed
|
||||
* by it.
|
||||
*/
|
||||
export type InputSource = "ring" | "left-arm" | "right-arm" | "watch";
|
||||
|
||||
/** Fields shared by every input event, whatever its type. */
|
||||
export type BaseInputEvent = {
|
||||
/**
|
||||
* When the event was received from the device (or synthesized), as a
|
||||
* Date.now() epoch-ms value. The G2 wire formats carry no device-side
|
||||
* clock, so this is phone receive time.
|
||||
*/
|
||||
timestampMs: number;
|
||||
};
|
||||
|
||||
/** The per-type part of InputEvent; makeInputEvent adds the BaseInputEvent fields. */
|
||||
export type InputEventPayload =
|
||||
| { type: "click"; source: InputSource }
|
||||
| { type: "double-click"; source: InputSource }
|
||||
/** Ring scroll (or a watch crown turn, then tagged source "watch"). */
|
||||
| { type: "scroll-up"; source?: InputSource }
|
||||
| { type: "scroll-down"; source?: InputSource }
|
||||
| { type: "long-press"; source: InputSource }
|
||||
| { type: "long-press-release"; source: InputSource }
|
||||
/**
|
||||
* Spatial (four-way) input, which only a watch can produce: the ring's
|
||||
* scroll is a one-dimensional cursor, these are directions. Components with
|
||||
* a spatial meaning for them opt in with Layer.acceptsDirectional /
|
||||
* ShellWindow.acceptsDirectional and must then handle all four; for the
|
||||
* rest, directionalFallback turns up/down into scroll, right into "select"
|
||||
* (click) and left into "back" (double-click), so a swipe always does
|
||||
* something sensible.
|
||||
*/
|
||||
| { type: "swipe-up"; source: "watch" }
|
||||
| { type: "swipe-down"; source: "watch" }
|
||||
| { type: "swipe-left"; source: "watch" }
|
||||
| { type: "swipe-right"; source: "watch" }
|
||||
/**
|
||||
* The stock display lifecycle woke while no EvenHub page was running. This
|
||||
* is wake-only, unlike a normal double-click (which turns an on screen off).
|
||||
*/
|
||||
| { type: "display-wake" }
|
||||
/**
|
||||
* The on-glasses "Hey Even" wakeword fired. Delivered on sid 0x07 by the
|
||||
* stock firmware regardless of CFW; the CFW additionally suppresses the stock
|
||||
* Even AI app so this is ours to handle. Its configured action may be applied
|
||||
* while the screen is off, unlike ordinary input events.
|
||||
*/
|
||||
| { type: "wakeword" }
|
||||
| { type: "unknown"; kind: string; eventSource: number; eventType: number };
|
||||
|
||||
export type InputEvent = BaseInputEvent & InputEventPayload;
|
||||
|
||||
/** Stamp an event payload into a full InputEvent, timestamped now. */
|
||||
export function makeInputEvent(payload: InputEventPayload): InputEvent {
|
||||
return { ...payload, timestampMs: Date.now() };
|
||||
}
|
||||
|
||||
/** True for input from the Wear OS remote (any type that carries a source). */
|
||||
export function isWatchInput(event: InputEvent): boolean {
|
||||
return "source" in event && event.source === "watch";
|
||||
}
|
||||
|
||||
export type DirectionalInputEvent = Extract<
|
||||
InputEvent,
|
||||
{ type: "swipe-up" | "swipe-down" | "swipe-left" | "swipe-right" }
|
||||
>;
|
||||
|
||||
export function isDirectionalInput(event: InputEvent): event is DirectionalInputEvent {
|
||||
return (
|
||||
event.type === "swipe-up" ||
|
||||
event.type === "swipe-down" ||
|
||||
event.type === "swipe-left" ||
|
||||
event.type === "swipe-right"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The ring-vocabulary equivalent of a directional swipe: up/down scroll,
|
||||
* right selects, left backs out.
|
||||
*/
|
||||
export function directionalFallback(event: InputEvent): InputEvent {
|
||||
const base = { timestampMs: event.timestampMs };
|
||||
switch (event.type) {
|
||||
case "swipe-up":
|
||||
return { ...base, type: "scroll-up" };
|
||||
case "swipe-down":
|
||||
return { ...base, type: "scroll-down" };
|
||||
case "swipe-right":
|
||||
return { ...base, type: "click", source: "ring" };
|
||||
case "swipe-left":
|
||||
return { ...base, type: "double-click", source: "ring" };
|
||||
default:
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compact glyphs for the ring gestures, used in on-glasses hint text instead
|
||||
* of spelling the gesture out. All codepoints exist in terminus12/16.
|
||||
|
||||
+3
-83
@@ -2,93 +2,13 @@ import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
|
||||
import { type Plane } from "../graphics/plane";
|
||||
import { spanCurrent } from "../native/frame-timings";
|
||||
import { type ConfigSettingBoolean, type ConfigSettingString } from "./dashboard-settings";
|
||||
import { directionalFallback, isDirectionalInput, type InputEvent } from "./gestures";
|
||||
|
||||
export type TextSettingsEditToggle = {
|
||||
setting: ConfigSettingBoolean;
|
||||
label: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Where an input came from. The ring and the glasses' arms are the stock
|
||||
* sources; "watch" is the Wear OS remote, which components may treat with a
|
||||
* richer scheme (see isWatchInput) — the ring's semantics are never changed
|
||||
* by it.
|
||||
*/
|
||||
export type InputSource = "ring" | "left-arm" | "right-arm" | "watch";
|
||||
|
||||
export type DashboardInputEvent =
|
||||
| { type: "click"; source: InputSource }
|
||||
| { type: "double-click"; source: InputSource }
|
||||
/** Ring scroll (or a watch crown turn, then tagged source "watch"). */
|
||||
| { type: "scroll-up"; source?: InputSource }
|
||||
| { type: "scroll-down"; source?: InputSource }
|
||||
| { type: "long-press"; source: InputSource }
|
||||
| { type: "long-press-release"; source: InputSource }
|
||||
/**
|
||||
* Spatial (four-way) input, which only a watch can produce: the ring's
|
||||
* scroll is a one-dimensional cursor, these are directions. Components with
|
||||
* a spatial meaning for them opt in with Layer.acceptsDirectional /
|
||||
* ShellWindow.acceptsDirectional and must then handle all four; for the
|
||||
* rest, directionalFallback turns up/down into scroll, right into "select"
|
||||
* (click) and left into "back" (double-click), so a swipe always does
|
||||
* something sensible.
|
||||
*/
|
||||
| { type: "swipe-up"; source: "watch" }
|
||||
| { type: "swipe-down"; source: "watch" }
|
||||
| { type: "swipe-left"; source: "watch" }
|
||||
| { type: "swipe-right"; source: "watch" }
|
||||
/**
|
||||
* The stock display lifecycle woke while no EvenHub page was running. This
|
||||
* is wake-only, unlike a normal double-click (which turns an on screen off).
|
||||
*/
|
||||
| { type: "display-wake" }
|
||||
/**
|
||||
* The on-glasses "Hey Even" wakeword fired. Delivered on sid 0x07 by the
|
||||
* stock firmware regardless of CFW; the CFW additionally suppresses the stock
|
||||
* Even AI app so this is ours to handle. Its configured action may be applied
|
||||
* while the screen is off, unlike ordinary input events.
|
||||
*/
|
||||
| { type: "wakeword" }
|
||||
| { type: "unknown"; kind: string; eventSource: number; eventType: number };
|
||||
|
||||
/** True for input from the Wear OS remote (any type that carries a source). */
|
||||
export function isWatchInput(event: DashboardInputEvent): boolean {
|
||||
return "source" in event && event.source === "watch";
|
||||
}
|
||||
|
||||
export type DirectionalInputEvent = Extract<
|
||||
DashboardInputEvent,
|
||||
{ type: "swipe-up" | "swipe-down" | "swipe-left" | "swipe-right" }
|
||||
>;
|
||||
|
||||
export function isDirectionalInput(event: DashboardInputEvent): event is DirectionalInputEvent {
|
||||
return (
|
||||
event.type === "swipe-up" ||
|
||||
event.type === "swipe-down" ||
|
||||
event.type === "swipe-left" ||
|
||||
event.type === "swipe-right"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The ring-vocabulary equivalent of a directional swipe: up/down scroll,
|
||||
* right selects, left backs out.
|
||||
*/
|
||||
export function directionalFallback(event: DashboardInputEvent): DashboardInputEvent {
|
||||
switch (event.type) {
|
||||
case "swipe-up":
|
||||
return { type: "scroll-up" };
|
||||
case "swipe-down":
|
||||
return { type: "scroll-down" };
|
||||
case "swipe-right":
|
||||
return { type: "click", source: "ring" };
|
||||
case "swipe-left":
|
||||
return { type: "double-click", source: "ring" };
|
||||
default:
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
export type LayerActions = {
|
||||
/** Ask for a dashboard repaint+transmit, e.g. when async data arrives. */
|
||||
requestRender: () => void;
|
||||
@@ -161,7 +81,7 @@ export interface LayerContext {
|
||||
export interface Layer {
|
||||
readonly paintOverBase?: boolean;
|
||||
paint(ctx: LayerContext, paintBelow: PaintBelow): GrayImage;
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> | void;
|
||||
handleInput(event: InputEvent, ctx: LayerContext): Promise<void> | void;
|
||||
/**
|
||||
* True when handleInput gives swipe-left / swipe-right a meaning of its own.
|
||||
* Otherwise the stack hands the layer directionalFallback(event) instead.
|
||||
@@ -286,7 +206,7 @@ export class LayerStack {
|
||||
return this.paintLayer(this.layers.length - 1);
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent): Promise<void> {
|
||||
async handleInput(event: InputEvent): Promise<void> {
|
||||
const top = this.layers[this.layers.length - 1]!;
|
||||
const delivered = isDirectionalInput(event) && !top.acceptsDirectional ? directionalFallback(event) : event;
|
||||
await top.handleInput(delivered, this.ctx);
|
||||
|
||||
+4
-4
@@ -2,9 +2,9 @@ import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage, type UiFont } from "../graphi
|
||||
import { wrapText } from "../graphics/textwrap";
|
||||
import { getDefaultSmallFont } from "../graphics/ui-fonts";
|
||||
import { clamp } from "../util/numeric-util";
|
||||
import { DashboardInputEvent, Layer, LayerContext, PaintBelow } from "./layers";
|
||||
import { Layer, LayerContext, PaintBelow } from "./layers";
|
||||
|
||||
import { GESTURE_DOUBLE_CLICK } from "./gestures";
|
||||
import { GESTURE_DOUBLE_CLICK, InputEvent } from "./gestures";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight, menuTitleHeight } from "./metrics";
|
||||
const DEFAULT_MENU_X = 8;
|
||||
const DEFAULT_MENU_Y = 8;
|
||||
@@ -280,7 +280,7 @@ export class MenuLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (!this.items.length) {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
@@ -358,7 +358,7 @@ export class TextPageLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ import {
|
||||
} from "../native/notification-icons";
|
||||
import { isNotificationListenerEnabled } from "../native/notification-access";
|
||||
import { noteStaleDataUsed, renderPassAllowsStaleData } from "../util/render-freshness";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext, type PaintBelow } from "./layers";
|
||||
import { type InputEvent } from "./gestures";
|
||||
import { type Layer, type LayerContext, type PaintBelow } from "./layers";
|
||||
|
||||
const PAGE_X = 12;
|
||||
const PAGE_Y = 12;
|
||||
@@ -119,7 +120,7 @@ export class NotificationsListLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
const notifications = readActiveNotifications(MAX_NOTIFICATIONS);
|
||||
const selectedIndex = this.resolveSelectedIndex(notifications);
|
||||
if (event.type === "double-click") {
|
||||
@@ -189,7 +190,7 @@ export class SingleNotificationLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
const notification = readActiveNotifications(MAX_NOTIFICATIONS).find((item) => item.key === this.notificationKey);
|
||||
if (!notification) {
|
||||
this.closeUnavailableNotification(ctx);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
|
||||
import { type BdfFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../gestures";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../gestures";
|
||||
import { drawSelectionHighlight } from "../menu";
|
||||
import { listRowHeight } from "../metrics";
|
||||
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../layers";
|
||||
import { Layer, type LayerActions, type LayerContext } from "../layers";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { MIN_WINDOW_HEIGHT, minWindowTop } from "./geometry";
|
||||
|
||||
@@ -134,7 +134,7 @@ export class AssistantLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
if (this.phase === "thinking") {
|
||||
if (event.type === "double-click") {
|
||||
this.callbacks.onCancel();
|
||||
|
||||
@@ -2,7 +2,8 @@ import { GrayImage } from "../../graphics/image";
|
||||
import { type Plane } from "../../graphics/plane";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import { beginRenderPass, endRenderPass } from "../../util/render-freshness";
|
||||
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { type MenuItem } from "../menu";
|
||||
import { WindowMenuLayer } from "../window-menu";
|
||||
import { windowIcon } from "./chrome-layer";
|
||||
@@ -249,7 +250,7 @@ export class YieldAtRootLayer implements Layer {
|
||||
return this.inner.paint(ctx, paintBelow);
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click") {
|
||||
shell.yieldFocusToSidebar();
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { flattenPlanes } from "../../graphics/plane";
|
||||
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry";
|
||||
|
||||
// The modal covers most of the min-height app viewport, leaving a little of
|
||||
@@ -59,7 +60,7 @@ export class ShellModalLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, _ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, _ctx: LayerContext): Promise<void> {
|
||||
await this.stack.handleInput(event);
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -4,16 +4,14 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { EvenAIStatus, EventSourceType, OsEventTypeList, WatchGestureType } from "../../g2/events";
|
||||
import type { RawInputEvent } from "../../native/faceclaw-communicator";
|
||||
import {
|
||||
DashboardInputEvent,
|
||||
directionalFallback,
|
||||
InputEvent,
|
||||
type InputEventPayload,
|
||||
type InputSource,
|
||||
isDirectionalInput,
|
||||
Layer,
|
||||
LayerActions,
|
||||
LayerContext,
|
||||
LayerStack,
|
||||
noopLayerActions,
|
||||
} from "../layers";
|
||||
makeInputEvent,
|
||||
} from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, noopLayerActions } from "../layers";
|
||||
import { MenuLayer, type MenuItem } from "../menu";
|
||||
import { VoiceInputLayer, type VoiceSendTarget } from "./voice-input";
|
||||
import { voiceActivity } from "./voice-activity";
|
||||
@@ -92,7 +90,7 @@ export type ShellWindow = {
|
||||
* tracking) passes to the window: it must eventually reach a frame submit
|
||||
* or a finishFrame call.
|
||||
*/
|
||||
handleInput: (event: DashboardInputEvent, frameId: number) => Promise<void> | void;
|
||||
handleInput: (event: InputEvent, frameId: number) => Promise<void> | void;
|
||||
/** Repaint and resubmit this window's surface. */
|
||||
requestRender: () => void;
|
||||
/**
|
||||
@@ -213,7 +211,7 @@ class ShellAlertLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
if (event.type === "click" || event.type === "double-click") {
|
||||
this.clearTimer();
|
||||
this.onDismiss();
|
||||
@@ -548,7 +546,7 @@ class Shell {
|
||||
return this.stack.paint();
|
||||
}
|
||||
|
||||
async receiveInput(event: DashboardInputEvent, frameId = 0): Promise<ShellInputOutcome> {
|
||||
async receiveInput(event: InputEvent, frameId = 0): Promise<ShellInputOutcome> {
|
||||
// The stock lifecycle has already interpreted the physical double tap as
|
||||
// "wake". Keep that directionality if delivery is delayed or duplicated.
|
||||
if (event.type === "display-wake") {
|
||||
@@ -698,7 +696,7 @@ class Shell {
|
||||
return this.screenOn && this.foregroundWindow()?.windowId === windowId;
|
||||
}
|
||||
|
||||
private handleSidebarInput(event: DashboardInputEvent): ShellInputOutcome {
|
||||
private handleSidebarInput(event: InputEvent): ShellInputOutcome {
|
||||
switch (event.type) {
|
||||
case "double-click":
|
||||
// A double-tap at the root (the app switcher selected) turns the
|
||||
@@ -1147,7 +1145,11 @@ function formatAssistantTime(date: Date): string {
|
||||
return `${day}, ${hours}:${minutes} ${meridiem}`;
|
||||
}
|
||||
|
||||
export function rawInputEventToInputEvent(event: RawInputEvent): DashboardInputEvent {
|
||||
export function rawInputEventToInputEvent(event: RawInputEvent): InputEvent {
|
||||
return makeInputEvent(rawInputEventToPayload(event));
|
||||
}
|
||||
|
||||
function rawInputEventToPayload(event: RawInputEvent): InputEventPayload {
|
||||
if (event.kind === "sys-event") {
|
||||
if (event.eventType === OsEventTypeList.CLICK_EVENT) {
|
||||
return {
|
||||
@@ -1210,7 +1212,7 @@ export function rawInputEventToInputEvent(event: RawInputEvent): DashboardInputE
|
||||
}
|
||||
|
||||
/** Scroll events only carry a source when it is the watch (the stock ones never needed one). */
|
||||
function scrollEvent(type: "scroll-up" | "scroll-down", eventSource: number): DashboardInputEvent {
|
||||
function scrollEvent(type: "scroll-up" | "scroll-down", eventSource: number): InputEventPayload {
|
||||
return eventSource === EventSourceType.TOUCH_EVENT_FROM_WATCH ? { type, source: "watch" } : { type };
|
||||
}
|
||||
|
||||
@@ -1227,7 +1229,7 @@ function eventSourceToString(eventSource: number): InputSource {
|
||||
return "ring";
|
||||
}
|
||||
|
||||
export function inputEventToString(event: DashboardInputEvent): string {
|
||||
export function inputEventToString(event: InputEvent): string {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
return `Click from ${event.source}`;
|
||||
|
||||
@@ -3,7 +3,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import type { ToolDebugEntry } from "../../assistant/tool-registry";
|
||||
import { DashboardInputEvent, Layer, LayerContext, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerContext, PaintBelow } from "../layers";
|
||||
import { MenuLayer, drawListScrollbar, type MenuItem } from "../menu";
|
||||
import { MIN_WINDOW_HEIGHT, minWindowTop, sidebarWidth, TOP_BAR_HEIGHT } from "./geometry";
|
||||
import { lineStep } from "../metrics";
|
||||
@@ -139,7 +140,7 @@ class ToolDetailLayer implements Layer {
|
||||
return lines;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.scrollRow = Math.max(0, this.scrollRow - 1);
|
||||
|
||||
@@ -5,10 +5,10 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
|
||||
import { refineDictation, type AnthropicStreamHandle } from "../../native/anthropic";
|
||||
import { anthropicApiKeySetting } from "../dashboard-settings";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, gestureHints } from "../gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, gestureHints, type InputEvent } from "../gestures";
|
||||
import { drawSelectionHighlight } from "../menu";
|
||||
import { listRowHeight } from "../metrics";
|
||||
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../layers";
|
||||
import { Layer, type LayerActions, type LayerContext } from "../layers";
|
||||
import { MIN_WINDOW_HEIGHT, minWindowTop } from "./geometry";
|
||||
|
||||
const DIALOG_X = 40;
|
||||
@@ -273,7 +273,7 @@ export class VoiceInputLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
switch (this.phase) {
|
||||
case "capturing":
|
||||
if (event.type === "double-click") {
|
||||
@@ -300,7 +300,7 @@ export class VoiceInputLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private handleMenuInput(event: DashboardInputEvent): void {
|
||||
private handleMenuInput(event: InputEvent): void {
|
||||
const rowCount = this.menuRows().length;
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { GrayImage } from "../graphics/image";
|
||||
import { singlePlane, type Plane } from "../graphics/plane";
|
||||
import {
|
||||
noopLayerActions,
|
||||
LayerStack,
|
||||
type DashboardInputEvent,
|
||||
type Layer,
|
||||
} from "./layers";
|
||||
import { type InputEvent } from "./gestures";
|
||||
import { type Layer, LayerStack, noopLayerActions } from "./layers";
|
||||
import { MenuLayer, type MenuItem, type MenuLayout } from "./menu";
|
||||
import type { WorkerAppReply } from "./shell/worker-window";
|
||||
|
||||
@@ -67,7 +63,7 @@ export class WindowMenu {
|
||||
}
|
||||
|
||||
/** Route an input event to the menu; the menu closes by popping itself. */
|
||||
async handleInput(event: DashboardInputEvent): Promise<void> {
|
||||
async handleInput(event: InputEvent): Promise<void> {
|
||||
const stack = this.stack;
|
||||
if (!stack) return;
|
||||
await stack.handleInput(event);
|
||||
|
||||
Reference in new issue
Block a user