From ea66a94f99d238b8758d28ce5e59dbadbe938393 Mon Sep 17 00:00:00 2001 From: Matan Sar-Shalom Date: Sun, 29 Aug 2021 11:10:44 +0300 Subject: [PATCH] =?UTF-8?q?feat(interaction-handler):=20add=20the=20abilit?= =?UTF-8?q?y=20to=20skip=20highlight=20when=20bin=E2=80=A6=20(#1537)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: Tomina --- docs-kr/network/interaction.html | 3 ++- docs/network/interaction.html | 12 +++++++++++- lib/network/modules/InteractionHandler.js | 2 ++ lib/network/options.ts | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs-kr/network/interaction.html b/docs-kr/network/interaction.html index 36b5ba45d4..c539c31447 100644 --- a/docs-kr/network/interaction.html +++ b/docs-kr/network/interaction.html @@ -156,7 +156,8 @@

옵션

keyboard: { enabled: false, speed: {x: 10, y: 10, zoom: 0.02}, - bindToWindow: true + bindToWindow: true, + autoFocus: true, }, multiselect: false, navigationButtons: false, diff --git a/docs/network/interaction.html b/docs/network/interaction.html index 42de4bb7c0..a93551b0ef 100644 --- a/docs/network/interaction.html +++ b/docs/network/interaction.html @@ -156,7 +156,8 @@

Options

keyboard: { enabled: false, speed: {x: 10, y: 10, zoom: 0.02}, - bindToWindow: true + bindToWindow: true, + autoFocus: true, }, multiselect: false, navigationButtons: false, @@ -317,6 +318,15 @@

Options

keyboard shortcuts only work on the network that has the focus. + + keyboard.autoFocus + Boolean + true + + When keyboard.bindToWindow=false this option allows you + to skip auto focusing the network on hover. + + multiselect Boolean diff --git a/lib/network/modules/InteractionHandler.js b/lib/network/modules/InteractionHandler.js index 9641080d05..7cc8a1ed05 100644 --- a/lib/network/modules/InteractionHandler.js +++ b/lib/network/modules/InteractionHandler.js @@ -55,6 +55,7 @@ class InteractionHandler { enabled: false, speed: { x: 10, y: 10, zoom: 0.02 }, bindToWindow: true, + autoFocus: true, }, navigationButtons: false, tooltipDelay: 300, @@ -647,6 +648,7 @@ class InteractionHandler { // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over. if ( + this.options.keyboard.autoFocus && this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true ) { diff --git a/lib/network/options.ts b/lib/network/options.ts index 7347e90879..6c85e3e338 100644 --- a/lib/network/options.ts +++ b/lib/network/options.ts @@ -420,6 +420,7 @@ const allOptions: OptionsConfig = { __type__: { object }, }, bindToWindow: { boolean: bool }, + autoFocus: { boolean: bool }, __type__: { object, boolean: bool }, }, multiselect: { boolean: bool }, @@ -759,6 +760,7 @@ const configureOptions: ConfiguratorConfig = { zoom: [0.02, 0, 0.1, 0.005], }, bindToWindow: true, + autoFocus: true, }, multiselect: false, navigationButtons: false,