Cleanup match info data
Change-Id: I815cf976fbb78223968274fa4955a52f708a03dc
diff --git a/dev/js/src/match/tree.js b/dev/js/src/match/tree.js
index 88f0542..c17fe20 100644
--- a/dev/js/src/match/tree.js
+++ b/dev/js/src/match/tree.js
@@ -188,6 +188,9 @@
},
+ /**
+ * Create svg and serialize as base64
+ */
toBase64 : function () {
// First clone element
@@ -310,6 +313,16 @@
canvas.setAttribute('width', g.graph().width);
canvas.setAttribute('height', height);
return this._element;
+ },
+
+ downloadLink : function () {
+ var a = document.createElement('a');
+ a.setAttribute('href-lang', 'image/svg+xml');
+ a.setAttribute('href', 'data:image/svg+xml;base64,' + this.toBase64());
+ a.setAttribute('download', 'tree.svg');
+ a.target = '_blank';
+ a.setAttribute('rel', 'noopener noreferrer');
+ return a;
}
};
});