mirror of
https://gitee.com/antv/g6.git
synced 2024-12-16 02:21:25 +08:00
794 B
794 B
title | order |
---|---|
Set/Get Mode | 8 |
graph.setMode(mode)
Switch the interaction mode of graph. For example, switch from edit mode to read-only mode.
Parameters
Name | Type | Required | Description |
---|---|---|---|
mode | string | true | The name of the mode. |
Usage
const graph = new G6.Graph({
container: div,
width: 500,
height: 500,
modes: {
default: [...],
custom: [...]
}
})
graph.setMode('custom')
graph.getCurrentMode()
Get the current mode.
Return
- Type of return value: string;
- The return value indicates the current mode.
Usage
// The return value is the current interaction mode
const mode = graph.getCurrentMode();