Skip to content

Commit ea66a94

Browse files
msarshaMatan Sar-ShalomThomaash
authored
feat(interaction-handler): add the ability to skip highlight when bin… (#1537)
* feat(interaction-handler): add the ability to skip highlight when bindToWindow is false * feat(interaction-handler): add skipHighlight to the docs * refactor(interaction-handler): rename skipHighlight to autoFocus that defaults to true Co-authored-by: Matan Sar-Shalom <matan.sarshalom@siemplify.co> Co-authored-by: Tomina <tom.vycital@gmail.com>
1 parent 8455e39 commit ea66a94

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

docs-kr/network/interaction.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ <h3>옵션</h3>
156156
keyboard: {
157157
enabled: false,
158158
speed: {x: 10, y: 10, zoom: 0.02},
159-
bindToWindow: true
159+
bindToWindow: true,
160+
autoFocus: true,
160161
},
161162
multiselect: false,
162163
navigationButtons: false,

docs/network/interaction.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ <h3>Options</h3>
156156
keyboard: {
157157
enabled: false,
158158
speed: {x: 10, y: 10, zoom: 0.02},
159-
bindToWindow: true
159+
bindToWindow: true,
160+
autoFocus: true,
160161
},
161162
multiselect: false,
162163
navigationButtons: false,
@@ -317,6 +318,15 @@ <h3>Options</h3>
317318
keyboard shortcuts only work on the network that has the focus.
318319
</td>
319320
</tr>
321+
<tr parent="keyboard" class="hidden">
322+
<td class="indent">keyboard.autoFocus</td>
323+
<td>Boolean</td>
324+
<td><code>true</code></td>
325+
<td>
326+
When <code>keyboard.bindToWindow=false</code> this option allows you
327+
to skip auto focusing the network on hover.
328+
</td>
329+
</tr>
320330
<tr>
321331
<td>multiselect</td>
322332
<td>Boolean</td>

lib/network/modules/InteractionHandler.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class InteractionHandler {
5555
enabled: false,
5656
speed: { x: 10, y: 10, zoom: 0.02 },
5757
bindToWindow: true,
58+
autoFocus: true,
5859
},
5960
navigationButtons: false,
6061
tooltipDelay: 300,
@@ -647,6 +648,7 @@ class InteractionHandler {
647648

648649
// if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over.
649650
if (
651+
this.options.keyboard.autoFocus &&
650652
this.options.keyboard.bindToWindow === false &&
651653
this.options.keyboard.enabled === true
652654
) {

lib/network/options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ const allOptions: OptionsConfig = {
420420
__type__: { object },
421421
},
422422
bindToWindow: { boolean: bool },
423+
autoFocus: { boolean: bool },
423424
__type__: { object, boolean: bool },
424425
},
425426
multiselect: { boolean: bool },
@@ -759,6 +760,7 @@ const configureOptions: ConfiguratorConfig = {
759760
zoom: [0.02, 0, 0.1, 0.005],
760761
},
761762
bindToWindow: true,
763+
autoFocus: true,
762764
},
763765
multiselect: false,
764766
navigationButtons: false,

0 commit comments

Comments
 (0)