From 738dc34611e3ed2d03d697fc0ae3e478eae1ea93 Mon Sep 17 00:00:00 2001 From: l00574490 Date: Sat, 14 Jan 2023 14:43:46 +0800 Subject: [PATCH] add interface of window: setAspectRatio Signed-off-by: l00574490 Change-Id: I843aa049c396cce252509cab2986c45ee64fa8e4 --- api/@ohos.window.d.ts | 44 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 713af9693a..42aa736abd 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1609,7 +1609,7 @@ declare namespace window { * @since 9 */ off(type: 'dialogTargetTouch', callback?: Callback): void; - + /** * Register the callback of windowEvent * @param type: 'windowEvent' - window event @@ -1629,7 +1629,7 @@ declare namespace window { * @since 10 */ off(type: 'windowEvent', callback: Callback): void; - + /** * Bind dialog to the target window. * @param token token of the target window. @@ -2245,6 +2245,46 @@ declare namespace window { * @since 10 */ raiseToAppTop(): Promise; + + /** + * Sets the aspect ratio of window + * @param { number } ratio - The aspect ratio of window except decoration + * @param { AsyncCallback } callback - The callback of setAspectRatio. + * @throws { BusinessError } 401 - If param is invalid + * @throws { BusinessError } 1300002 - If window state is abnormally + * @throws { BusinessError } 1300004 - If this window can not set aspect ratio + * @since 10 + */ + setAspectRatio(ratio: number, callback: AsyncCallback): void; + + /** + * Sets the aspect ratio of window + * @param { number } ratio - The aspect ratio of window except decoration + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 401 - If param is invalid + * @throws { BusinessError } 1300002 - If window state is abnormally + * @throws { BusinessError } 1300004 - If this window can not set aspect ratio + * @since 10 + */ + setAspectRatio(ratio: number): Promise; + + /** + * Resets the aspect ratio of window + * @param { AsyncCallback } callback - The callback of setAspectRatio. + * @throws { BusinessError } 1300002 - If window state is abnormally + * @throws { BusinessError } 1300004 - If this window can not reset aspect ratio + * @since 10 + */ + resetAspectRatio(callback: AsyncCallback): void; + + /** + * Resets the aspect ratio of window + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 1300002 - If window state is abnormally + * @throws { BusinessError } 1300004 - If this window can not reset aspect ratio + * @since 10 + */ + resetAspectRatio(): Promise; } /** * Window stage callback event type -- Gitee