feat(scrcpy): add class for crop option

This commit is contained in:
Simon Chan 2024-12-03 12:06:55 +08:00
parent c0d0695285
commit fdf674a9bc
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
2 changed files with 22 additions and 1 deletions

View file

@ -89,6 +89,24 @@ export namespace CodecOptions {
export type Init = CodecOptionsInit; 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 { export interface Init {
logLevel?: LogLevel; logLevel?: LogLevel;
@ -124,7 +142,7 @@ export interface Init {
*/ */
tunnelForward?: boolean; tunnelForward?: boolean;
crop?: string | undefined; crop?: Crop | undefined;
/** /**
* Send PTS so that the client may record properly * Send PTS so that the client may record properly

View file

@ -2,6 +2,7 @@ export {
BackOrScreenOnControlMessage as ScrcpyBackOrScreenOnControlMessage, BackOrScreenOnControlMessage as ScrcpyBackOrScreenOnControlMessage,
CaptureOrientation as ScrcpyCaptureOrientation, CaptureOrientation as ScrcpyCaptureOrientation,
CodecOptions as ScrcpyCodecOptions, CodecOptions as ScrcpyCodecOptions,
Crop as ScrcpyCrop,
InjectScrollControlMessage as ScrcpyInjectScrollControlMessage, InjectScrollControlMessage as ScrcpyInjectScrollControlMessage,
InjectTouchControlMessage as ScrcpyInjectTouchControlMessage, InjectTouchControlMessage as ScrcpyInjectTouchControlMessage,
InstanceId as ScrcpyInstanceId, InstanceId as ScrcpyInstanceId,
@ -13,3 +14,5 @@ export {
UHidCreateControlMessage as ScrcpyUHidCreateControlMessage, UHidCreateControlMessage as ScrcpyUHidCreateControlMessage,
UHidOutputDeviceMessage as ScrcpyUHidOutputDeviceMessage, UHidOutputDeviceMessage as ScrcpyUHidOutputDeviceMessage,
} from "./3_0/impl/index.js"; } from "./3_0/impl/index.js";
export { ScrcpyOptions3_0 as ScrcpyOptionsLatest } from "./3_0/index.js";