Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs:补充 en-US.md 和 zh-CN.md 文档内容 #826

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions docs/en-US/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,63 @@ collapseNode = (string) => {}
```js
expandNode = (string) => {}
```

## Event Handling:

### [baseNode]:

#### Mousedown Event:

Support for passing in custom `canMouseDown` function.

*params*

* `event`:DOM event object

*returned value*

* `true`:Indicates that the built-in drag event handling will be performed
* `false`:Indicates that the built-in drag event handling will not be performed

#### Click Event:

Support for passing in custom `canClick` function.

*params*

* `event`:DOM event object

*returned value*

* `true`:Indicates that the built-in click event handling will be performed
* `false`:Indicates that the built-in drag event handling will not be performed

### Example:
```js
class BaseNode extends Node {
constructor(opts) {
super(opts);
}
canMouseDown = (event) => {
if (...) {
... // Custom event handling
return true;
} else {
... // Custom event handling
return false;
}

}
canClick = (event) => {
if (...) {
... // Custom event handling
return true;
} else {
... // Custom event handling
return false;
}
}
...
}
```

59 changes: 59 additions & 0 deletions docs/zh-CN/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,62 @@ collapseNode = (string) => {}
```js
expandNode = (string) => {}
```

## 事件处理:

### [baseNode]:

#### mousedown事件:

支持传入自定义的名为 `canMouseDown` 的函数。

*参数*

* `event`:DOM事件对象

*返回值*

* `true`:表示执行内置的拖拽事件处理
* `false`:表示不执行内置的拖拽事件处理

#### click事件:

支持传入自定义的名为 `canClick` 的函数。

*参数*

* `event`:DOM事件对象

*返回值*

* `true`:表示执行内置的点击事件处理
* `false`:表示不执行内置的点击事件处理

#### 示例:
```js
class BaseNode extends Node {
constructor(opts) {
super(opts);
}
canMouseDown = (event) => {
if (...) {
... // 自定义的事件处理
return true;
} else {
... // 自定义的事件处理
return false;
}

}
canClick = (event) => {
if (...) {
... // 自定义的事件处理
return true;
} else {
... // 自定义的事件处理
return false;
}
}
...
}
```