Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b5479d6 authored by Simon Chan's avatar Simon Chan
Browse files

feat(demo): keep focus in device view

parent 2bb2af31
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ function handlePointerDown(e: PointerEvent<HTMLDivElement>) {
        return false;
    }

    STATE.fullScreenContainer!.focus();
    e.currentTarget.setPointerCapture(e.pointerId);
    e.preventDefault();
    e.stopPropagation();
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ function handleWheel(e: WheelEvent) {
        return;
    }

    STATE.fullScreenContainer!.focus();
    e.preventDefault();
    e.stopPropagation();

@@ -70,6 +71,7 @@ function handlePointerDown(e: PointerEvent<HTMLDivElement>) {
        return;
    }

    STATE.fullScreenContainer!.focus();
    e.preventDefault();
    e.stopPropagation();

@@ -82,6 +84,7 @@ function handlePointerMove(e: PointerEvent<HTMLDivElement>) {
        return;
    }

    STATE.fullScreenContainer!.focus();
    e.preventDefault();
    e.stopPropagation();
    injectTouch(
@@ -97,6 +100,7 @@ function handlePointerUp(e: PointerEvent<HTMLDivElement>) {
        return;
    }

    STATE.fullScreenContainer!.focus();
    e.preventDefault();
    e.stopPropagation();
    injectTouch(AndroidMotionEventAction.Up, e);
@@ -107,8 +111,10 @@ function handlePointerLeave(e: PointerEvent<HTMLDivElement>) {
        return;
    }

    STATE.fullScreenContainer!.focus();
    e.preventDefault();
    e.stopPropagation();

    // Because pointer capture on pointer down, this event only happens for hovering mouse and pen.
    // Release the injected pointer, otherwise it will stuck at the last position.
    injectTouch(AndroidMotionEventAction.HoverExit, e);
+1 −6
Original line number Diff line number Diff line
import { ICommandBarItemProps, Stack, StackItem } from "@fluentui/react";
import { makeStyles, mergeClasses, shorthands } from "@griffel/react";
import { AdbCommand, decodeUtf8 } from "@yume-chan/adb";
import {
    action,
    autorun,
    makeAutoObservable,
    runInAction
} from "mobx";
import { action, autorun, makeAutoObservable, runInAction } from "mobx";
import { observer } from "mobx-react-lite";
import { NextPage } from "next";
import Head from "next/head";