> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
> Use this file to discover all available pages before exploring further.

# resizeLassoRect

> 调整套索框矩形大小。

<Note>
  必须套索之后才能调用该接口，否则会调用失败。
</Note>

```ts theme={null}
static resizeLassoRect(rect: Rect): Promise<APIResponse<boolean>>;
```

**参数**

| 参数     | 类型                                                      | 说明          |
| ------ | ------------------------------------------------------- | ----------- |
| `rect` | [`Rect`](/zh/api-reference/supernote-plugin/types/rect) | 套索框矩形（像素坐标） |

**返回**

* [`APIResponse<boolean>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result === true` 表示调整成功

## 示例

```ts wrap theme={null}
import { PluginCommAPI, type Rect } from 'sn-plugin-lib';

/**
 * 按等比例缩放调整套索框矩形的示例。
 */
export async function exampleResizeLassoRect() {
  const current = await PluginCommAPI.getLassoRect();
  if (!current.success) {
    throw new Error(current.error?.message ?? 'getLassoRect 调用失败');
  }

  const rect = current.result as Rect;
  const w = rect.right - rect.left;
  const h = rect.bottom - rect.top;
  const cx = rect.left + w / 2;
  const cy = rect.top + h / 2;
  const scale = 1.2;
  const nextRect: Rect = {
    left: cx - (w * scale) / 2,
    top: cy - (h * scale) / 2,
    right: cx + (w * scale) / 2,
    bottom: cy + (h * scale) / 2,
  };

  const res = await PluginCommAPI.resizeLassoRect(nextRect);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'resizeLassoRect 调用失败');
  }
  return res.result;
}
```
