2023-08-30 19:46:37 +08:00
|
|
|
---
|
|
|
|
title: DragCanvasOptions
|
|
|
|
---
|
|
|
|
|
2023-10-11 20:33:18 +08:00
|
|
|
[Overview - v5.0.0-beta.21](../../README.en.md) / [Modules](../../modules.en.md) / [behaviors](../../modules/behaviors.en.md) / DragCanvasOptions
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
[behaviors](../../modules/behaviors.en.md).DragCanvasOptions
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
### direction
|
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
• `Optional` **direction**: `"x"` \| `"y"` \| `"both"`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
The direction to drag the canvas. 'both' by default.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:22](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L22)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### dragOnItems
|
|
|
|
|
|
|
|
• `Optional` **dragOnItems**: `boolean`
|
|
|
|
|
|
|
|
Whether allow trigger this behavior when drag start on nodes / edges / combos.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:14](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L14)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### enableOptimize
|
|
|
|
|
|
|
|
• `Optional` **enableOptimize**: `boolean`
|
|
|
|
|
|
|
|
Whether enable optimize strategies, which will hide all the shapes excluding node keyShape while dragging.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:10](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L10)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### eventName
|
|
|
|
|
|
|
|
• `Optional` **eventName**: `string`
|
|
|
|
|
|
|
|
The event name to trigger when drag end.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:48](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L48)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### scalableRange
|
|
|
|
|
|
|
|
• `Optional` **scalableRange**: `string` \| `number`
|
|
|
|
|
|
|
|
The range of canvas to limit dragging, 0 by default, which means the graph cannot be dragged totally out of the view port range.
|
|
|
|
If scalableRange is number or a string without 'px', means it is a ratio of the graph content.
|
|
|
|
If scalableRange is a string with 'px', it is regarded as pixels.
|
|
|
|
If scalableRange = 0, no constrains;
|
|
|
|
If scalableRange > 0, the graph can be dragged out of the view port range
|
|
|
|
If scalableRange < 0, the range is smaller than the view port.
|
|
|
|
Refer to https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*IFfoS67_HssAAAAAAAAAAAAAARQnAQ
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:44](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L44)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### secondaryKey
|
|
|
|
|
|
|
|
• `Optional` **secondaryKey**: `string`
|
|
|
|
|
|
|
|
The assistant secondary key on keyboard. If it is not assigned, the behavior will be triggered when trigger happens.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:26](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L26)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### secondaryKeyToDisable
|
|
|
|
|
|
|
|
• `Optional` **secondaryKeyToDisable**: `string`
|
|
|
|
|
|
|
|
The assistant secondary key on keyboard to prevent the behavior to be tiggered. 'shift' by default.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:30](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L30)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### shouldBegin
|
|
|
|
|
|
|
|
• `Optional` **shouldBegin**: (`event`: [`IG6GraphEvent`](IG6GraphEvent.en.md)) => `boolean`
|
|
|
|
|
|
|
|
#### Type declaration
|
|
|
|
|
|
|
|
▸ (`event`): `boolean`
|
|
|
|
|
|
|
|
Whether allow the behavior happen on the current item.
|
|
|
|
|
|
|
|
##### Parameters
|
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------------------------------------- |
|
2023-08-30 19:46:37 +08:00
|
|
|
| `event` | [`IG6GraphEvent`](IG6GraphEvent.en.md) |
|
|
|
|
|
|
|
|
##### Returns
|
|
|
|
|
|
|
|
`boolean`
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:52](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L52)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### speedUpKey
|
|
|
|
|
|
|
|
• `Optional` **speedUpKey**: `string`
|
|
|
|
|
|
|
|
The key on keyboard to speed up translating while pressing and drag-canvas by direction keys. The trigger should be 'directionKeys' for this option.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:34](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L34)
|
2023-08-30 19:46:37 +08:00
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
---
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
### trigger
|
|
|
|
|
2023-08-31 23:46:08 +08:00
|
|
|
• `Optional` **trigger**: `"drag"` \| `"directionKeys"`
|
2023-08-30 19:46:37 +08:00
|
|
|
|
|
|
|
The trigger for the behavior, 'drag' by default. 'directionKeys' means trigger this behavior by up / down / left / right keys on keyboard.
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-08-31 20:33:50 +08:00
|
|
|
[packages/g6/src/stdlib/behavior/drag-canvas.ts:18](https://github.com/antvis/G6/blob/61e525e59b/packages/g6/src/stdlib/behavior/drag-canvas.ts#L18)
|