Browse Source

configurable manual zoom speed (#3657)

develop
Ezekiel Victor 6 years ago
committed by Yotam Berkowitz
parent
commit
7a5686947a
3 changed files with 9 additions and 4 deletions
  1. +3
    -1
      docs/network/interaction.html
  2. +3
    -2
      lib/network/modules/InteractionHandler.js
  3. +3
    -1
      lib/network/options.js

+ 3
- 1
docs/network/interaction.html View File

@ -70,7 +70,8 @@ var options = {
selectable: true,
selectConnectedEdges: true,
tooltipDelay: 300,
zoomView: true
zoomView: true,
zoomSpeed: 1
}
}
@ -109,6 +110,7 @@ network.setOptions(options);
<tr><td>selectConnectedEdges</td> <td>Boolean</td><td><code>true</code></td><td>When true, on selecting a node, its connecting edges are highlighted.</td></tr>
<tr><td>tooltipDelay</td> <td>Number</td> <td><code>300</code></td> <td>When nodes or edges have a defined <code>'title'</code> field, this can be shown as a pop-up tooltip. The tooltip itself is an HTML element that can be fully styled using CSS. The delay is the amount of time in milliseconds it takes before the tooltip is shown.</td></tr>
<tr><td>zoomView</td> <td>Boolean</td> <td><code>true</code></td> <td>When true, the user can zoom in.</td></tr>
<tr><td>zoomSpeed</td> <td>Number</td> <td><code>1</code></td> <td>The default speed of "1" (arbitrary unit) is moderately fast. Speed changes apply only to manual zooming (e.g. with mouse scroll wheel).</td></tr>
</table>
</div>

+ 3
- 2
lib/network/modules/InteractionHandler.js View File

@ -53,7 +53,8 @@ class InteractionHandler {
},
navigationButtons: false,
tooltipDelay: 300,
zoomView: true
zoomView: true,
zoomSpeed: 1
};
util.extend(this.options,this.defaultOptions);
@ -520,7 +521,7 @@ class InteractionHandler {
// calculate the new scale
let scale = this.body.view.scale;
let zoom = delta / 10;
let zoom = delta * (this.options.zoomSpeed / 10);
if (delta < 0) {
zoom = zoom / (1 - zoom);
}

+ 3
- 1
lib/network/options.js View File

@ -167,6 +167,7 @@ let allOptions = {
hoverConnectedEdges: { boolean: bool },
tooltipDelay: { number },
zoomView: { boolean: bool },
zoomSpeed: { number },
__type__: { object }
},
layout: {
@ -572,7 +573,8 @@ let configureOptions = {
selectConnectedEdges: true,
hoverConnectedEdges: true,
tooltipDelay: [300, 0, 1000, 25],
zoomView: true
zoomView: true,
zoomSpeed: 1
},
manipulation: {
enabled: false,

Loading…
Cancel
Save