about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2017-08-29 20:13:02 +0200
committersternenseemann <git@lukasepple.de>2017-08-29 20:13:02 +0200
commit1fa245934f13b50ef26d0c1e75b3ab5a3b85049e (patch)
treef982e93a1b7f044352022e521446ce7042147b99 /web
parentdb867465ce1639fd603ffe5ff27b1ba7d74f8622 (diff)
Fixed bugs related to JSON serialization
1. Fixed a bug which caused the octave attribute of Music to always be a
   string, thus causing parsing problems
2. Fixed a bug which caused edges to only being added to the edgeData
   map after the editing it, because vis.js only adds the default ID to
   an edge after the callback has been called.
   (See https://github.com/almende/vis/blob/master/lib/network/modules/ManipulationSystem.js#L1097-L1099)
Diffstat (limited to 'web')
-rw-r--r--web/source/main.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/web/source/main.js b/web/source/main.js
index 99da938..8dab68f 100644
--- a/web/source/main.js
+++ b/web/source/main.js
@@ -121,7 +121,7 @@ function genericEditNode(data, callback) {
         var duration = new Rational(document.getElementById('numerator').value,
             document.getElementById('denominator').value);
         var music = new Music(duration, document.getElementById('pitch').value,
-            document.getElementById('octave').value);
+            Number(document.getElementById('octave').value));
         nodeData = nodeData.set(data.id, { music: music, nodeData: data });
         data.label = music.toString();
         clearOverlay();
@@ -165,9 +165,9 @@ function genericEditEdge(data, callback) {
 
         var prob = document.getElementById('prob').value / 100;
         data.label = `${prob * 100}%`;
-        edgeData = edgeData.set(data.id, { prob: prob, edgeData: data } );
         clearOverlay();
         callback(data);
+        edgeData = edgeData.set(data.id, { prob: prob, edgeData: data } );
     }
 
     function discardEdge(callback) {