From 860c49e2b8418c1c741551567b10521c80cf51db Mon Sep 17 00:00:00 2001 From: Samuel Tallet Date: Thu, 22 Apr 2021 11:30:33 +0200 Subject: [PATCH] Improve user experience --- .../HTML Dialogs/nodes-editor.js | 19 +++++++------------ .../Resources/fr/pmg.translation | 1 - source/parametric_modeling/nodes_editor.rb | 1 - 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/source/parametric_modeling/HTML Dialogs/nodes-editor.js b/source/parametric_modeling/HTML Dialogs/nodes-editor.js index c736f60..db354d4 100644 --- a/source/parametric_modeling/HTML Dialogs/nodes-editor.js +++ b/source/parametric_modeling/HTML Dialogs/nodes-editor.js @@ -1709,6 +1709,13 @@ PMG.NodesEditor.loadToolbarIcons = () => { PMG.NodesEditor.adaptNumberInputStep = input => { + if ( input.value === '' ) { + + input.step = 1 + return + + } + if ( isNaN(parseFloat(input.step)) ) { input.step = 1 } @@ -1938,14 +1945,6 @@ PMG.NodesEditor.showOrHideMinimap = () => { } -PMG.NodesEditor.resetNumberInputsStep = () => { - - document.querySelectorAll('input[type="number"]').forEach(numberInputElement => { - numberInputElement.step = 1 - }) - -} - PMG.NodesEditor.setGlobalContextMenu = () => { var contextMenuOptions = [ @@ -1965,10 +1964,6 @@ PMG.NodesEditor.setGlobalContextMenu = () => { name: t('Show or hide minimap'), fn: () => { PMG.NodesEditor.showOrHideMinimap() } }, - { - name: t('Reset increment values'), - fn: () => { PMG.NodesEditor.resetNumberInputsStep() } - }, { name: t('Remove all nodes'), fn: () => { PMG.NodesEditor.editor.clear() } diff --git a/source/parametric_modeling/Resources/fr/pmg.translation b/source/parametric_modeling/Resources/fr/pmg.translation index 9e179a5..bf88a93 100644 --- a/source/parametric_modeling/Resources/fr/pmg.translation +++ b/source/parametric_modeling/Resources/fr/pmg.translation @@ -129,7 +129,6 @@ "Export schema to a file"="Exporter le schéma vers un fichier"; "Freeze parametric entities"="Geler les entités paramétriques"; "Show or hide minimap"="Afficher ou masquer la mini-carte"; -"Reset increment values"="Réinitialiser les valeurs d'incrément"; "Remove all nodes"="Supprimer tous les nœuds"; "Access online help"="Accéder à l'aide en ligne"; "Error: Nodes Editor schema is incompatible."="Erreur : Le schéma de l'éditeur de nœuds est incompatible."; diff --git a/source/parametric_modeling/nodes_editor.rb b/source/parametric_modeling/nodes_editor.rb index 441ccc3..765962c 100644 --- a/source/parametric_modeling/nodes_editor.rb +++ b/source/parametric_modeling/nodes_editor.rb @@ -208,7 +208,6 @@ def self.translation "Export schema to a file": TRANSLATE['Export schema to a file'], "Freeze parametric entities": TRANSLATE['Freeze parametric entities'], "Show or hide minimap": TRANSLATE['Show or hide minimap'], - "Reset increment values": TRANSLATE['Reset increment values'], "Remove all nodes": TRANSLATE['Remove all nodes'] }