Browse Source

docs(api): clarify `setSize`, `setMinSize`, `setMaxSize` and `setLocation`, closes #2660

Lucas Nogueira 3 years ago
parent
commit
a21f6b212c
2 changed files with 19 additions and 19 deletions
  1. 0 0
      core/tauri/scripts/bundle.js
  2. 19 19
      tooling/api/src/window.ts

File diff suppressed because it is too large
+ 0 - 0
core/tauri/scripts/bundle.js


+ 19 - 19
tooling/api/src/window.ts

@@ -795,14 +795,14 @@ class WindowManager extends WebviewWindowHandle {
   }
   }
 
 
   /**
   /**
-   * Resizes the window.
+   * Resizes the window with a new inner size.
    * @example
    * @example
    * ```typescript
    * ```typescript
    * import { appWindow, LogicalSize } from '@tauri-apps/api/window'
    * import { appWindow, LogicalSize } from '@tauri-apps/api/window'
    * await appWindow.setSize(new LogicalSize(600, 500))
    * await appWindow.setSize(new LogicalSize(600, 500))
    * ```
    * ```
    *
    *
-   * @param size The logical or physical size.
+   * @param size The logical or physical inner size.
    * @returns A promise indicating the success or failure of the operation.
    * @returns A promise indicating the success or failure of the operation.
    */
    */
   async setSize(size: LogicalSize | PhysicalSize): Promise<void> {
   async setSize(size: LogicalSize | PhysicalSize): Promise<void> {
@@ -833,18 +833,18 @@ class WindowManager extends WebviewWindowHandle {
   }
   }
 
 
   /**
   /**
-   * Sets the window min size. If the `size` argument is not provided, the min size is unset.
+   * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.
    * @example
    * @example
    * ```typescript
    * ```typescript
    * import { appWindow, PhysicalSize } from '@tauri-apps/api/window'
    * import { appWindow, PhysicalSize } from '@tauri-apps/api/window'
    * await appWindow.setMinSize(new PhysicalSize(600, 500))
    * await appWindow.setMinSize(new PhysicalSize(600, 500))
    * ```
    * ```
    *
    *
-   * @param size The logical or physical size.
+   * @param size The logical or physical inner size, or `null` to unset the constraint.
    * @returns A promise indicating the success or failure of the operation.
    * @returns A promise indicating the success or failure of the operation.
    */
    */
   async setMinSize(
   async setMinSize(
-    size: LogicalSize | PhysicalSize | undefined
+    size: LogicalSize | PhysicalSize | null | undefined
   ): Promise<void> {
   ): Promise<void> {
     if (size && size.type !== 'Logical' && size.type !== 'Physical') {
     if (size && size.type !== 'Logical' && size.type !== 'Physical') {
       throw new Error(
       throw new Error(
@@ -861,12 +861,12 @@ class WindowManager extends WebviewWindowHandle {
             type: 'setMinSize',
             type: 'setMinSize',
             payload: size
             payload: size
               ? {
               ? {
-                  type: size.type,
-                  data: {
-                    width: size.width,
-                    height: size.height
-                  }
+                type: size.type,
+                data: {
+                  width: size.width,
+                  height: size.height
                 }
                 }
+              }
               : null
               : null
           }
           }
         }
         }
@@ -875,18 +875,18 @@ class WindowManager extends WebviewWindowHandle {
   }
   }
 
 
   /**
   /**
-   * Sets the window max size. If the `size` argument is undefined, the max size is unset.
+   * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.
    * @example
    * @example
    * ```typescript
    * ```typescript
    * import { appWindow, LogicalSize } from '@tauri-apps/api/window'
    * import { appWindow, LogicalSize } from '@tauri-apps/api/window'
    * await appWindow.setMaxSize(new LogicalSize(600, 500))
    * await appWindow.setMaxSize(new LogicalSize(600, 500))
    * ```
    * ```
    *
    *
-   * @param size The logical or physical size.
+   * @param size The logical or physical inner size, or `null` to unset the constraint.
    * @returns A promise indicating the success or failure of the operation.
    * @returns A promise indicating the success or failure of the operation.
    */
    */
   async setMaxSize(
   async setMaxSize(
-    size: LogicalSize | PhysicalSize | undefined
+    size: LogicalSize | PhysicalSize | null | undefined
   ): Promise<void> {
   ): Promise<void> {
     if (size && size.type !== 'Logical' && size.type !== 'Physical') {
     if (size && size.type !== 'Logical' && size.type !== 'Physical') {
       throw new Error(
       throw new Error(
@@ -903,12 +903,12 @@ class WindowManager extends WebviewWindowHandle {
             type: 'setMaxSize',
             type: 'setMaxSize',
             payload: size
             payload: size
               ? {
               ? {
-                  type: size.type,
-                  data: {
-                    width: size.width,
-                    height: size.height
-                  }
+                type: size.type,
+                data: {
+                  width: size.width,
+                  height: size.height
                 }
                 }
+              }
               : null
               : null
           }
           }
         }
         }
@@ -917,7 +917,7 @@ class WindowManager extends WebviewWindowHandle {
   }
   }
 
 
   /**
   /**
-   * Sets the window position.
+   * Sets the window outer position.
    * @example
    * @example
    * ```typescript
    * ```typescript
    * import { appWindow, LogicalPosition } from '@tauri-apps/api/window'
    * import { appWindow, LogicalPosition } from '@tauri-apps/api/window'

Some files were not shown because too many files changed in this diff