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