debounce node and edge edition instead of throttle
authorymh <ymh.work@gmail.com>
Wed, 29 Jun 2016 22:48:10 +0200
changeset 625 4d67ae41b9b3
parent 624 c9fcbbf219bc
child 626 112912309726
debounce node and edge edition instead of throttle
client/js/renderer/edgeeditor.js
client/js/renderer/nodeeditor.js
--- a/client/js/renderer/edgeeditor.js	Fri Jun 24 13:13:41 2016 +0200
+++ b/client/js/renderer/edgeeditor.js	Wed Jun 29 22:48:10 2016 +0200
@@ -60,7 +60,7 @@
 
             if (this.renderer.isEditable()) {
 
-                var onFieldChange = _.throttle(function() {
+                var onFieldChange = _.debounce(function() {
                     _.defer(function() {
                         if (_this.renderer.isEditable()) {
                             var _data = {
@@ -81,7 +81,7 @@
                             closeEditor();
                         }
                     });
-                },500);
+                },1000);
 
                 this.editor_$.on("keyup", function(_e) {
                     if (_e.keyCode === 27) {
--- a/client/js/renderer/nodeeditor.js	Fri Jun 24 13:13:41 2016 +0200
+++ b/client/js/renderer/nodeeditor.js	Wed Jun 29 22:48:10 2016 +0200
@@ -100,7 +100,7 @@
 
             if (this.renderer.isEditable()) {
 
-                var onFieldChange = _.throttle(function() {
+                var onFieldChange = _.debounce(function() {
                   _.defer(function() {
                     if (_this.renderer.isEditable()) {
                         var _data = {};