You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/site/docs/manual/middle/states/defaultBehavior.en.md
+50-1
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,10 @@ const graph = new G6.Graph({
106
106
-`direction`: The direction of dragging that is allowed. Options: `'x'`, `'y'`, `'both'`. `'both'` by default;
107
107
-`enableOptimize`: whether enable optimization, `false` by default. `enableOptimize: true` means hiding all edges and the shapes beside keyShapes of nodes while dragging canvas;
108
108
-`shouldBegin(e)`: Whether allow the behavior happen on the current item (e.item);
109
-
-`scalableRange`: scaleable range when drag canvas, `zero` by default;
109
+
-`scalableRange`: scalable range when drag canvas, `zero` by default. -1 to 1 means the scalable percentage of the viewport; the image bellow illustrate the situation when it is smaller than -1 or bigger than 1:
-`allowDragOnItem`: whether response when the users drag on items(node/edge/combo), `false` by default;
111
114
- Related timing events:
112
115
-`canvas:dragstart`: Triggered when drag start. Listened by `graph.on('canvas:dragstart', e => {...})`;
@@ -142,6 +145,51 @@ const graph = new G6.Graph({
142
145
143
146
The canvas can be dragged along x direction only.<br /><imgsrc='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*54yxRrW1A7sAAAAAAAAAAABkARQnAQ'width=400alt='img'/>
144
147
148
+
149
+
### scroll-canvas
150
+
151
+
- Description: Scroll the canvas by wheeling, *supported after v4.2.6*;
152
+
- Configurations:
153
+
-`type: 'scroll-canvas'`;
154
+
-`direction`: The direction of dragging that is allowed. Options: `'x'`, `'y'`, `'both'`. `'both'` by default;
155
+
-`enableOptimize`: whether enable optimization, `false` by default. `enableOptimize: true` means hiding all edges and the shapes beside keyShapes of nodes while dragging canvas;
156
+
-`zoomKey`: switch to zooming while pressing the key and wheeling. Options: `'shift'`, `'ctrl'`, `'alt'`, `'control'`;
157
+
-`scalableRange`: scalable range when drag canvas, `zero` by default. -1 to 1 means the scalable percentage of the viewport; the image bellow illustrate the situation when it is smaller than -1 or bigger than 1:
-`wheel`: Triggered when wheeling. Listened by `graph.on('wheel', e => {...})`.
163
+
164
+
**Using Default Configuration**
165
+
166
+
```javascript
167
+
constgraph=newG6.Graph({
168
+
modes: {
169
+
default: ['drag-canvas'],
170
+
},
171
+
});
172
+
```
173
+
174
+
By default, the x and y directions are both allowed.
175
+
176
+
**Using Customized Configuration**
177
+
178
+
```javascript
179
+
constgraph=newG6.Graph({
180
+
modes: {
181
+
default: [
182
+
{
183
+
type:'drag-canvas',
184
+
direction:'x',
185
+
},
186
+
],
187
+
},
188
+
});
189
+
```
190
+
191
+
The canvas can be dragged along x direction only.<br /><imgsrc='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*54yxRrW1A7sAAAAAAAAAAABkARQnAQ'width=400alt='img'/>
192
+
145
193
### zoom-canvas
146
194
147
195
- Description: Zoom the canvas;
@@ -163,6 +211,7 @@ The canvas can be dragged along x direction only.<br /><img src='https://gw.alip
163
211
164
212
**Tips: Assign values for `minZoom` and `maxZoom` on the graph to limit the zooming ratio.**
0 commit comments