force-graph 1.44.2 → 1.46.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
@@ -1,10 +1,11 @@
1
- interface GraphData {
2
- nodes: NodeObject[];
3
- links: LinkObject[];
1
+ interface GraphData<N = NodeObject, L = LinkObject<N>> {
2
+ nodes: N[];
3
+ links: L[];
4
4
  }
5
5
 
6
6
  interface NodeObject {
7
7
  id?: string | number;
8
+ index?: number;
8
9
  x?: number;
9
10
  y?: number;
10
11
  vx?: number;
@@ -13,14 +14,14 @@ interface NodeObject {
13
14
  fy?: number;
14
15
  }
15
16
 
16
- interface LinkObject {
17
- source?: string | number | NodeObject;
18
- target?: string | number | NodeObject;
17
+ interface LinkObject<N = NodeObject> {
18
+ source?: string | number | N;
19
+ target?: string | number | N;
19
20
  }
20
21
 
21
22
  type Accessor<In, Out> = Out | string | ((obj: In) => Out);
22
- type NodeAccessor<T> = Accessor<NodeObject, T>;
23
- type LinkAccessor<T> = Accessor<LinkObject, T>;
23
+ type NodeAccessor<T, N> = Accessor<N, T>;
24
+ type LinkAccessor<T, N, L> = Accessor<L, T>;
24
25
 
25
26
  type CanvasCustomRenderMode = 'replace' | 'before' | 'after';
26
27
  type CanvasCustomRenderModeFn<T> = (obj: T) => CanvasCustomRenderMode | any;
@@ -29,20 +30,20 @@ type CanvasPointerAreaPaintFn<T> = (obj: T, paintColor: string, canvasContext: C
29
30
 
30
31
  type DagMode = 'td' | 'bu' | 'lr' | 'rl' | 'radialout' | 'radialin';
31
32
 
32
- interface ForceFn {
33
+ interface ForceFn<N = NodeObject> {
33
34
  (alpha: number): void;
34
- initialize?: (nodes: NodeObject[], ...args: any[]) => void;
35
+ initialize?: (nodes: N[], ...args: any[]) => void;
35
36
  [key: string]: any;
36
37
  }
37
38
 
38
- interface ForceGraphGenericInstance<ChainableInstance> {
39
+ interface ForceGraphGenericInstance<ChainableInstance, N extends NodeObject = NodeObject, L extends LinkObject<N> = LinkObject<N>> {
39
40
  (element: HTMLElement): ChainableInstance;
40
41
  resetProps(): ChainableInstance;
41
42
  _destructor(): void;
42
43
 
43
44
  // Data input
44
- graphData(): GraphData;
45
- graphData(data: GraphData): ChainableInstance;
45
+ graphData(): GraphData<N, L>;
46
+ graphData(data: GraphData<N, L>): ChainableInstance;
46
47
  nodeId(): string;
47
48
  nodeId(id: string): ChainableInstance;
48
49
  linkSource(): string;
@@ -61,59 +62,59 @@ interface ForceGraphGenericInstance<ChainableInstance> {
61
62
  // Node styling
62
63
  nodeRelSize(): number;
63
64
  nodeRelSize(size: number): ChainableInstance;
64
- nodeVal(): NodeAccessor<number>;
65
- nodeVal(valAccessor: NodeAccessor<number>): ChainableInstance;
66
- nodeLabel(): NodeAccessor<string>;
67
- nodeLabel(labelAccessor: NodeAccessor<string>): ChainableInstance;
68
- nodeVisibility(): NodeAccessor<boolean>;
69
- nodeVisibility(visibilityAccessor: NodeAccessor<boolean>): ChainableInstance;
70
- nodeColor(): NodeAccessor<string>;
71
- nodeColor(colorAccessor: NodeAccessor<string>): ChainableInstance;
72
- nodeAutoColorBy(): NodeAccessor<string | null>;
73
- nodeAutoColorBy(colorByAccessor: NodeAccessor<string | null>): ChainableInstance;
74
- nodeCanvasObject(): CanvasCustomRenderFn<NodeObject>;
75
- nodeCanvasObject(renderFn: CanvasCustomRenderFn<NodeObject>): ChainableInstance;
76
- nodeCanvasObjectMode(): string | CanvasCustomRenderModeFn<NodeObject>;
77
- nodeCanvasObjectMode(modeAccessor: string | CanvasCustomRenderModeFn<NodeObject>): ChainableInstance;
78
- nodePointerAreaPaint(): CanvasPointerAreaPaintFn<NodeObject>;
79
- nodePointerAreaPaint(renderFn: CanvasPointerAreaPaintFn<NodeObject>): ChainableInstance;
65
+ nodeVal(): NodeAccessor<number, N>;
66
+ nodeVal(valAccessor: NodeAccessor<number, N>): ChainableInstance;
67
+ nodeLabel(): NodeAccessor<string, N>;
68
+ nodeLabel(labelAccessor: NodeAccessor<string, N>): ChainableInstance;
69
+ nodeVisibility(): NodeAccessor<boolean, N>;
70
+ nodeVisibility(visibilityAccessor: NodeAccessor<boolean, N>): ChainableInstance;
71
+ nodeColor(): NodeAccessor<string, N>;
72
+ nodeColor(colorAccessor: NodeAccessor<string, N>): ChainableInstance;
73
+ nodeAutoColorBy(): NodeAccessor<string | null, N>;
74
+ nodeAutoColorBy(colorByAccessor: NodeAccessor<string | null, N>): ChainableInstance;
75
+ nodeCanvasObject(): CanvasCustomRenderFn<N>;
76
+ nodeCanvasObject(renderFn: CanvasCustomRenderFn<N>): ChainableInstance;
77
+ nodeCanvasObjectMode(): string | CanvasCustomRenderModeFn<N>;
78
+ nodeCanvasObjectMode(modeAccessor: string | CanvasCustomRenderModeFn<N>): ChainableInstance;
79
+ nodePointerAreaPaint(): CanvasPointerAreaPaintFn<N>;
80
+ nodePointerAreaPaint(renderFn: CanvasPointerAreaPaintFn<N>): ChainableInstance;
80
81
 
81
82
  // Link styling
82
- linkLabel(): LinkAccessor<string>;
83
- linkLabel(labelAccessor: LinkAccessor<string>): ChainableInstance;
84
- linkVisibility(): LinkAccessor<boolean>;
85
- linkVisibility(visibilityAccessor: LinkAccessor<boolean>): ChainableInstance;
86
- linkColor(): LinkAccessor<string>;
87
- linkColor(colorAccessor: LinkAccessor<string>): ChainableInstance;
88
- linkAutoColorBy(): LinkAccessor<string | null>;
89
- linkAutoColorBy(colorByAccessor: LinkAccessor<string | null>): ChainableInstance;
90
- linkLineDash(): LinkAccessor<number[] | null>;
91
- linkLineDash(linkLineDashAccessor: LinkAccessor<number[] | null>): ChainableInstance;
92
- linkWidth(): LinkAccessor<number>;
93
- linkWidth(widthAccessor: LinkAccessor<number>): ChainableInstance;
94
- linkCurvature(): LinkAccessor<number>;
95
- linkCurvature(curvatureAccessor: LinkAccessor<number>): ChainableInstance;
96
- linkCanvasObject(): CanvasCustomRenderFn<LinkObject>;
97
- linkCanvasObject(renderFn: CanvasCustomRenderFn<LinkObject>): ChainableInstance;
98
- linkCanvasObjectMode(): string | CanvasCustomRenderModeFn<LinkObject>;
99
- linkCanvasObjectMode(modeAccessor: string | CanvasCustomRenderModeFn<LinkObject>): ChainableInstance;
100
- linkDirectionalArrowLength(): LinkAccessor<number>;
101
- linkDirectionalArrowLength(lengthAccessor: LinkAccessor<number>): ChainableInstance;
102
- linkDirectionalArrowColor(): LinkAccessor<string>;
103
- linkDirectionalArrowColor(colorAccessor: LinkAccessor<string>): ChainableInstance;
104
- linkDirectionalArrowRelPos(): LinkAccessor<number>;
105
- linkDirectionalArrowRelPos(fractionAccessor: LinkAccessor<number>): ChainableInstance;
106
- linkDirectionalParticles(): LinkAccessor<number>;
107
- linkDirectionalParticles(numParticlesAccessor: LinkAccessor<number>): ChainableInstance;
108
- linkDirectionalParticleSpeed(): LinkAccessor<number>;
109
- linkDirectionalParticleSpeed(relDistancePerFrameAccessor: LinkAccessor<number>): ChainableInstance;
110
- linkDirectionalParticleWidth(): LinkAccessor<number>;
111
- linkDirectionalParticleWidth(widthAccessor: LinkAccessor<number>): ChainableInstance;
112
- linkDirectionalParticleColor(): LinkAccessor<string>;
113
- linkDirectionalParticleColor(colorAccessor: LinkAccessor<string>): ChainableInstance;
114
- emitParticle(link: LinkObject): ChainableInstance;
115
- linkPointerAreaPaint(): CanvasPointerAreaPaintFn<LinkObject>;
116
- linkPointerAreaPaint(renderFn: CanvasPointerAreaPaintFn<LinkObject>): ChainableInstance;
83
+ linkLabel(): LinkAccessor<string, N, L>;
84
+ linkLabel(labelAccessor: LinkAccessor<string, N, L>): ChainableInstance;
85
+ linkVisibility(): LinkAccessor<boolean, N, L>;
86
+ linkVisibility(visibilityAccessor: LinkAccessor<boolean, N, L>): ChainableInstance;
87
+ linkColor(): LinkAccessor<string, N, L>;
88
+ linkColor(colorAccessor: LinkAccessor<string, N, L>): ChainableInstance;
89
+ linkAutoColorBy(): LinkAccessor<string | null, N, L>;
90
+ linkAutoColorBy(colorByAccessor: LinkAccessor<string | null, N, L>): ChainableInstance;
91
+ linkLineDash(): LinkAccessor<number[] | null, N, L>;
92
+ linkLineDash(linkLineDashAccessor: LinkAccessor<number[] | null, N, L>): ChainableInstance;
93
+ linkWidth(): LinkAccessor<number, N, L>;
94
+ linkWidth(widthAccessor: LinkAccessor<number, N, L>): ChainableInstance;
95
+ linkCurvature(): LinkAccessor<number, N, L>;
96
+ linkCurvature(curvatureAccessor: LinkAccessor<number, N, L>): ChainableInstance;
97
+ linkCanvasObject(): CanvasCustomRenderFn<L>;
98
+ linkCanvasObject(renderFn: CanvasCustomRenderFn<L>): ChainableInstance;
99
+ linkCanvasObjectMode(): string | CanvasCustomRenderModeFn<L>;
100
+ linkCanvasObjectMode(modeAccessor: string | CanvasCustomRenderModeFn<L>): ChainableInstance;
101
+ linkDirectionalArrowLength(): LinkAccessor<number, N, L>;
102
+ linkDirectionalArrowLength(lengthAccessor: LinkAccessor<number, N, L>): ChainableInstance;
103
+ linkDirectionalArrowColor(): LinkAccessor<string, N, L>;
104
+ linkDirectionalArrowColor(colorAccessor: LinkAccessor<string, N, L>): ChainableInstance;
105
+ linkDirectionalArrowRelPos(): LinkAccessor<number, N, L>;
106
+ linkDirectionalArrowRelPos(fractionAccessor: LinkAccessor<number, N, L>): ChainableInstance;
107
+ linkDirectionalParticles(): LinkAccessor<number, N, L>;
108
+ linkDirectionalParticles(numParticlesAccessor: LinkAccessor<number, N, L>): ChainableInstance;
109
+ linkDirectionalParticleSpeed(): LinkAccessor<number, N, L>;
110
+ linkDirectionalParticleSpeed(relDistancePerFrameAccessor: LinkAccessor<number, N, L>): ChainableInstance;
111
+ linkDirectionalParticleWidth(): LinkAccessor<number, N, L>;
112
+ linkDirectionalParticleWidth(widthAccessor: LinkAccessor<number, N, L>): ChainableInstance;
113
+ linkDirectionalParticleColor(): LinkAccessor<string, N, L>;
114
+ linkDirectionalParticleColor(colorAccessor: LinkAccessor<string, N, L>): ChainableInstance;
115
+ emitParticle(link: L): ChainableInstance;
116
+ linkPointerAreaPaint(): CanvasPointerAreaPaintFn<L>;
117
+ linkPointerAreaPaint(renderFn: CanvasPointerAreaPaintFn<L>): ChainableInstance;
117
118
 
118
119
  // Render control
119
120
  autoPauseRedraw(): boolean;
@@ -124,7 +125,7 @@ interface ForceGraphGenericInstance<ChainableInstance> {
124
125
  centerAt(x?: number, y?: number, durationMs?: number): ChainableInstance;
125
126
  zoom(): number;
126
127
  zoom(scale: number, durationMs?: number): ChainableInstance;
127
- zoomToFit(durationMs?: number, padding?: number, nodeFilter?: (node: NodeObject) => boolean): ChainableInstance;
128
+ zoomToFit(durationMs?: number, padding?: number, nodeFilter?: (node: N) => boolean): ChainableInstance;
128
129
  minZoom(): number;
129
130
  minZoom(scale: number): ChainableInstance;
130
131
  maxZoom(): number;
@@ -137,8 +138,8 @@ interface ForceGraphGenericInstance<ChainableInstance> {
137
138
  dagMode(mode: DagMode | null): ChainableInstance;
138
139
  dagLevelDistance(): number | null;
139
140
  dagLevelDistance(distance: number): ChainableInstance;
140
- dagNodeFilter(): (node: NodeObject) => boolean;
141
- dagNodeFilter(filterFn: (node: NodeObject) => boolean): ChainableInstance;
141
+ dagNodeFilter(): (node: N) => boolean;
142
+ dagNodeFilter(filterFn: (node: N) => boolean): ChainableInstance;
142
143
  onDagError(): (loopNodeIds: (string | number)[]) => void;
143
144
  onDagError(errorHandleFn: (loopNodeIds: (string | number)[]) => void): ChainableInstance;
144
145
  d3AlphaMin(): number;
@@ -147,8 +148,8 @@ interface ForceGraphGenericInstance<ChainableInstance> {
147
148
  d3AlphaDecay(alphaDecay: number): ChainableInstance;
148
149
  d3VelocityDecay(): number;
149
150
  d3VelocityDecay(velocityDecay: number): ChainableInstance;
150
- d3Force(forceName: 'link' | 'charge' | 'center' | string): ForceFn | undefined;
151
- d3Force(forceName: 'link' | 'charge' | 'center' | string, forceFn: ForceFn | null): ChainableInstance;
151
+ d3Force(forceName: 'link' | 'charge' | 'center' | string): ForceFn<N> | undefined;
152
+ d3Force(forceName: 'link' | 'charge' | 'center' | string, forceFn: ForceFn<N> | null): ChainableInstance;
152
153
  d3ReheatSimulation(): ChainableInstance;
153
154
  warmupTicks(): number;
154
155
  warmupTicks(ticks: number): ChainableInstance;
@@ -160,14 +161,14 @@ interface ForceGraphGenericInstance<ChainableInstance> {
160
161
  onEngineStop(callback: () => void): ChainableInstance;
161
162
 
162
163
  // Interaction
163
- onNodeClick(callback: (node: NodeObject, event: MouseEvent) => void): ChainableInstance;
164
- onNodeRightClick(callback: (node: NodeObject, event: MouseEvent) => void): ChainableInstance;
165
- onNodeHover(callback: (node: NodeObject | null, previousNode: NodeObject | null) => void): ChainableInstance;
166
- onNodeDrag(callback: (node: NodeObject, translate: { x: number, y: number }) => void): ChainableInstance;
167
- onNodeDragEnd(callback: (node: NodeObject, translate: { x: number, y: number }) => void): ChainableInstance;
168
- onLinkClick(callback: (link: LinkObject, event: MouseEvent) => void): ChainableInstance;
169
- onLinkRightClick(callback: (link: LinkObject, event: MouseEvent) => void): ChainableInstance;
170
- onLinkHover(callback: (link: LinkObject | null, previousLink: LinkObject | null) => void): ChainableInstance;
164
+ onNodeClick(callback: (node: N, event: MouseEvent) => void): ChainableInstance;
165
+ onNodeRightClick(callback: (node: N, event: MouseEvent) => void): ChainableInstance;
166
+ onNodeHover(callback: (node: N | null, previousNode: N | null) => void): ChainableInstance;
167
+ onNodeDrag(callback: (node: N, translate: { x: number, y: number }) => void): ChainableInstance;
168
+ onNodeDragEnd(callback: (node: N, translate: { x: number, y: number }) => void): ChainableInstance;
169
+ onLinkClick(callback: (link: L, event: MouseEvent) => void): ChainableInstance;
170
+ onLinkRightClick(callback: (link: L, event: MouseEvent) => void): ChainableInstance;
171
+ onLinkHover(callback: (link: L | null, previousLink: L | null) => void): ChainableInstance;
171
172
  linkHoverPrecision(): number;
172
173
  linkHoverPrecision(precision: number): ChainableInstance;
173
174
  onBackgroundClick(callback: (event: MouseEvent) => void): ChainableInstance;
@@ -177,20 +178,20 @@ interface ForceGraphGenericInstance<ChainableInstance> {
177
178
  enableNodeDrag(): boolean;
178
179
  enableNodeDrag(enable: boolean): ChainableInstance;
179
180
  enableZoomInteraction(): boolean;
180
- enableZoomInteraction(enable: boolean): ChainableInstance;
181
+ enableZoomInteraction(enable: boolean | ((event: MouseEvent) => boolean)): ChainableInstance;
181
182
  enablePanInteraction(): boolean;
182
- enablePanInteraction(enable: boolean): ChainableInstance;
183
+ enablePanInteraction(enable: boolean | ((event: MouseEvent) => boolean)): ChainableInstance;
183
184
  enablePointerInteraction(): boolean;
184
185
  enablePointerInteraction(enable?: boolean): ChainableInstance;
185
186
 
186
187
  // Utility
187
- getGraphBbox(nodeFilter?: (node: NodeObject) => boolean): { x: [number, number], y: [number, number] };
188
+ getGraphBbox(nodeFilter?: (node: N) => boolean): { x: [number, number], y: [number, number] };
188
189
  screen2GraphCoords(x: number, y: number): { x: number, y: number };
189
190
  graph2ScreenCoords(x: number, y: number): { x: number, y: number };
190
191
  }
191
192
 
192
- type ForceGraphInstance = ForceGraphGenericInstance<ForceGraphInstance>;
193
+ type ForceGraphInstance<NodeType = NodeObject, LinkType = LinkObject<NodeType>> = ForceGraphGenericInstance<ForceGraphInstance<NodeType, LinkType>, NodeType, LinkType>;
193
194
 
194
- declare function ForceGraph(): ForceGraphInstance;
195
+ declare function ForceGraph<NodeType = NodeObject, LinkType = LinkObject<NodeType>>(): ForceGraphInstance<NodeType, LinkType>;
195
196
 
196
197
  export { type CanvasCustomRenderFn, type CanvasCustomRenderModeFn, type CanvasPointerAreaPaintFn, type ForceGraphGenericInstance, type ForceGraphInstance, type GraphData, type LinkObject, type NodeObject, ForceGraph as default };
@@ -1,4 +1,4 @@
1
- // Version 1.44.2 force-graph - https://github.com/vasturiano/force-graph
1
+ // Version 1.46.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) :
@@ -5410,6 +5410,22 @@
5410
5410
  */
5411
5411
  TWEEN.update.bind(TWEEN);
5412
5412
 
5413
+ function _arrayLikeToArray$2(r, a) {
5414
+ (null == a || a > r.length) && (a = r.length);
5415
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
5416
+ return n;
5417
+ }
5418
+ function _arrayWithHoles$1(r) {
5419
+ if (Array.isArray(r)) return r;
5420
+ }
5421
+ function _classCallCheck$1(a, n) {
5422
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
5423
+ }
5424
+ function _createClass$1(e, r, t) {
5425
+ return Object.defineProperty(e, "prototype", {
5426
+ writable: !1
5427
+ }), e;
5428
+ }
5413
5429
  function _iterableToArrayLimit$1(r, l) {
5414
5430
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
5415
5431
  if (null != t) {
@@ -5434,39 +5450,19 @@
5434
5450
  return a;
5435
5451
  }
5436
5452
  }
5437
- function _classCallCheck$1(instance, Constructor) {
5438
- if (!(instance instanceof Constructor)) {
5439
- throw new TypeError("Cannot call a class as a function");
5440
- }
5441
- }
5442
- function _createClass$1(Constructor, protoProps, staticProps) {
5443
- Object.defineProperty(Constructor, "prototype", {
5444
- writable: false
5445
- });
5446
- return Constructor;
5447
- }
5448
- function _slicedToArray$1(arr, i) {
5449
- return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$1();
5450
- }
5451
- function _arrayWithHoles$1(arr) {
5452
- if (Array.isArray(arr)) return arr;
5453
- }
5454
- function _unsupportedIterableToArray$2(o, minLen) {
5455
- if (!o) return;
5456
- if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
5457
- var n = Object.prototype.toString.call(o).slice(8, -1);
5458
- if (n === "Object" && o.constructor) n = o.constructor.name;
5459
- if (n === "Map" || n === "Set") return Array.from(o);
5460
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
5461
- }
5462
- function _arrayLikeToArray$2(arr, len) {
5463
- if (len == null || len > arr.length) len = arr.length;
5464
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
5465
- return arr2;
5466
- }
5467
5453
  function _nonIterableRest$1() {
5468
5454
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5469
5455
  }
5456
+ function _slicedToArray$1(r, e) {
5457
+ return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest$1();
5458
+ }
5459
+ function _unsupportedIterableToArray$2(r, a) {
5460
+ if (r) {
5461
+ if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
5462
+ var t = {}.toString.call(r).slice(8, -1);
5463
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
5464
+ }
5465
+ }
5470
5466
 
5471
5467
  var Prop = /*#__PURE__*/_createClass$1(function Prop(name, _ref) {
5472
5468
  var _ref$default = _ref["default"],
@@ -12253,7 +12249,7 @@
12253
12249
  state.zoom.filter(function (ev) {
12254
12250
  return (
12255
12251
  // disable zoom interaction
12256
- !ev.button && state.enableZoomPanInteraction && (state.enableZoomInteraction || ev.type !== 'wheel') && (state.enablePanInteraction || ev.type === 'wheel')
12252
+ !ev.button && state.enableZoomPanInteraction && (ev.type !== 'wheel' || index$2(state.enableZoomInteraction)(ev)) && (ev.type === 'wheel' || index$2(state.enablePanInteraction)(ev))
12257
12253
  );
12258
12254
  }).on('zoom', function (ev) {
12259
12255
  var t = ev.transform;