Skip to content

Commit

Permalink
docs: add enable/disable doc
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshenhai committed Mar 10, 2024
1 parent fbfc107 commit cad484f
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export default defineConfig({
{ text: 'deleteElement', link: '/en-US/api/delete-element' },
{ text: 'moveElement', link: '/en-US/api/move-element' },
{ text: 'resize', link: '/en-US/api/resize' },
{ text: 'centerContent', link: '/en-US/api/center-content' }
{ text: 'centerContent', link: '/en-US/api/center-content' },
{ text: 'enable/disable', link: '/en-US/api/enable-disable' }
]
}
],
Expand Down Expand Up @@ -121,7 +122,8 @@ export default defineConfig({
{ text: 'deleteElement', link: '/zh-CN/api/delete-element' },
{ text: 'moveElement', link: '/zh-CN/api/move-element' },
{ text: 'resize', link: '/zh-CN/api/resize' },
{ text: 'centerContent', link: '/zh-CN/api/center-content' }
{ text: 'centerContent', link: '/zh-CN/api/center-content' },
{ text: 'enable/disable', link: '/zh-CN/api/enable-disable' }
]
}
],
Expand Down
50 changes: 50 additions & 0 deletions src/en-US/api/enable-disable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# enable/disable

## Introduction

- `enable(...)` Turn on a feature
- `disable(...)` Turn off a feature

## Arguments

- `{IDrawFeature}` `feat` Feature type
- `'ruler'`: Ruler feature
- `-` Other features are to be developed...

```ts
type IDrawFeature = 'ruler' | string; // TODO other features
```

## Returns

> N/A
## Usage

```js
import { iDraw } from 'idraw';

const app = document.querySelector('#app');
const options = {
width: 600,
height: 400,
devicePixelRatio: 2
};
const idraw = new iDraw(app, options);
idraw.setData(data);
idraw.disable('ruler');

setTimeout(() => {
idraw.enable('ruler');
}, 1000);
```

## Example

[More Demo >>](https://idrawjs.com/playground/?demo=api-enable)

<iframe class="idraw-playground-preview"
src="https://idrawjs.com/playground/?demo=api-enable&header=false&sider=false&default-editor-split=50"
width="1000" height="480" frameborder="no" border="0"
style="border: 1px solid #cecece; margin: 0px auto;"
></iframe>
2 changes: 1 addition & 1 deletion src/en-US/api/set-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ idraw.setMode('readOnly');

## Example

[More Demo >>](https://idrawjs.com/playground/?demo=api-resize)
[More Demo >>](https://idrawjs.com/playground/?demo=api-setMode)

<iframe class="idraw-playground-preview"
src="https://idrawjs.com/playground/?demo=api-setMode&header=false&sider=false&default-editor-split=50"
Expand Down
50 changes: 50 additions & 0 deletions src/zh-CN/api/enable-disable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# enable/disable

## 说明

- `enable(...)` 开启某个功能
- `disable(...)` 关闭某个功能

## 参数

- `{IDrawFeature}` `feat` 功能类型
- `'ruler'`: 标尺功能
- `-` 其它功能待开发 ...

```ts
type IDrawFeature = 'ruler' | string; // TODO other feature
```

## 返回值

> 无返回值
## 用法

```js
import { iDraw } from 'idraw';

const app = document.querySelector('#app');
const options = {
width: 600,
height: 400,
devicePixelRatio: 2
};
const idraw = new iDraw(app, options);
idraw.setData(data);
idraw.disable('ruler');

setTimeout(() => {
idraw.enable('ruler');
}, 1000);
```

## 示例

[Demo完整预览 Playground >>](https://idrawjs.com/playground/?demo=api-enable)

<iframe class="idraw-playground-preview"
src="https://idrawjs.com/playground/?demo=api-enable&header=false&sider=false&default-editor-split=50"
width="1000" height="480" frameborder="no" border="0"
style="border: 1px solid #cecece; margin: 0px auto;"
></iframe>
2 changes: 1 addition & 1 deletion src/zh-CN/api/set-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ idraw.setMode('readOnly');

## 示例

[Demo完整预览 Playground >>](https://idrawjs.com/playground/?demo=api-resize)
[Demo完整预览 Playground >>](https://idrawjs.com/playground/?demo=api-setMode)

<iframe class="idraw-playground-preview"
src="https://idrawjs.com/playground/?demo=api-setMode&header=false&sider=false&default-editor-split=50"
Expand Down

0 comments on commit cad484f

Please sign in to comment.