force-graph 1.44.2 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -176,8 +176,8 @@ myGraph(<myDOMElement>)
176
176
  | <b>nodePointerAreaPaint</b>([<i>fn</i>]) | Callback function for painting a canvas area used to detect node pointer interactions. The provided paint color uniquely identifies the node and should be used to perform drawing operations on the provided canvas context. This painted area will not be visible, but instead be used to detect pointer interactions with the node. The callback function has the signature: `.nodePointerAreaPaint(<node>, <color>, <canvas context>, <current global scale>)`. | *default interaction area is a circle centered on the node and sized according to `val`.* |
177
177
  | <b>linkPointerAreaPaint</b>([<i>fn</i>]) | Callback function for painting a canvas area used to detect link pointer interactions. The provided paint color uniquely identifies the link and should be used to perform drawing operations on the provided canvas context. This painted area will not be visible, but instead be used to detect pointer interactions with the link. The callback function has the signature: `.linkPointerAreaPaint(<link>, <color>, <canvas context>, <current global scale>)`. | *default interaction area is a straight line between the source and target nodes.* |
178
178
  | <b>enableNodeDrag</b>([<i>boolean</i>]) | Getter/setter for whether to enable the user interaction to drag nodes by click-dragging. If enabled, every time a node is dragged the simulation is re-heated so the other nodes react to the changes. Only applicable if enablePointerInteraction is `true`. | `true` |
179
- | <b>enableZoomInteraction</b>([<i>boolean</i>]) | Getter/setter for whether to enable zooming user interactions. | `true` |
180
- | <b>enablePanInteraction</b>([<i>boolean</i>]) | Getter/setter for whether to enable panning user interactions. | `true` |
179
+ | <b>enableZoomInteraction</b>([<i>boolean</i> or <i>fn</i>]) | Getter/setter for whether to enable zooming user interactions. When a predicate function is provided, the mouse event is passed as an argument.| `true` |
180
+ | <b>enablePanInteraction</b>([<i>boolean</i> or <i>fn</i>]) | Getter/setter for whether to enable panning user interactions. When a predicate function is provided, the mouse event is passed as an argument.| `true` |
181
181
  | <b>enablePointerInteraction</b>([<i>boolean</i>]) | Getter/setter for whether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click/drag and tooltip labels, at the cost of performance. If you're looking for maximum gain in your graph performance it's recommended to switch off this property. | `true` |
182
182
 
183
183
  ### Utility
@@ -177,9 +177,9 @@ interface ForceGraphGenericInstance<ChainableInstance> {
177
177
  enableNodeDrag(): boolean;
178
178
  enableNodeDrag(enable: boolean): ChainableInstance;
179
179
  enableZoomInteraction(): boolean;
180
- enableZoomInteraction(enable: boolean): ChainableInstance;
180
+ enableZoomInteraction(enable: boolean | ((event: MouseEvent) => boolean)): ChainableInstance;
181
181
  enablePanInteraction(): boolean;
182
- enablePanInteraction(enable: boolean): ChainableInstance;
182
+ enablePanInteraction(enable: boolean | ((event: MouseEvent) => boolean)): ChainableInstance;
183
183
  enablePointerInteraction(): boolean;
184
184
  enablePointerInteraction(enable?: boolean): ChainableInstance;
185
185
 
@@ -1,4 +1,4 @@
1
- // Version 1.44.2 force-graph - https://github.com/vasturiano/force-graph
1
+ // Version 1.45.0 force-graph - https://github.com/vasturiano/force-graph
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -12253,7 +12253,7 @@
12253
12253
  state.zoom.filter(function (ev) {
12254
12254
  return (
12255
12255
  // disable zoom interaction
12256
- !ev.button && state.enableZoomPanInteraction && (state.enableZoomInteraction || ev.type !== 'wheel') && (state.enablePanInteraction || ev.type === 'wheel')
12256
+ !ev.button && state.enableZoomPanInteraction && (ev.type !== 'wheel' || index$2(state.enableZoomInteraction)(ev)) && (ev.type === 'wheel' || index$2(state.enablePanInteraction)(ev))
12257
12257
  );
12258
12258
  }).on('zoom', function (ev) {
12259
12259
  var t = ev.transform;