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

Unverified Commit fdf674a9 authored by Simon Chan's avatar Simon Chan
Browse files

feat(scrcpy): add class for crop option

parent c0d06952
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -89,6 +89,24 @@ export namespace CodecOptions {
    export type Init = CodecOptionsInit;
}

export class Crop implements ScrcpyOptionValue {
    width: number;
    height: number;
    x: number;
    y: number;

    constructor(width: number, height: number, x: number, y: number) {
        this.width = width;
        this.height = height;
        this.x = x;
        this.y = y;
    }

    toOptionValue(): string | undefined {
        return `${this.width}:${this.height}:${this.x}:${this.y}`;
    }
}

export interface Init {
    logLevel?: LogLevel;

@@ -124,7 +142,7 @@ export interface Init {
     */
    tunnelForward?: boolean;

    crop?: string | undefined;
    crop?: Crop | undefined;

    /**
     * Send PTS so that the client may record properly
+3 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ export {
    BackOrScreenOnControlMessage as ScrcpyBackOrScreenOnControlMessage,
    CaptureOrientation as ScrcpyCaptureOrientation,
    CodecOptions as ScrcpyCodecOptions,
    Crop as ScrcpyCrop,
    InjectScrollControlMessage as ScrcpyInjectScrollControlMessage,
    InjectTouchControlMessage as ScrcpyInjectTouchControlMessage,
    InstanceId as ScrcpyInstanceId,
@@ -13,3 +14,5 @@ export {
    UHidCreateControlMessage as ScrcpyUHidCreateControlMessage,
    UHidOutputDeviceMessage as ScrcpyUHidOutputDeviceMessage,
} from "./3_0/impl/index.js";

export { ScrcpyOptions3_0 as ScrcpyOptionsLatest } from "./3_0/index.js";