Commit 2c766b8c authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

js/model.js: extract saveClusters(), .clusters_copy is now a stack

parent e53edfd9
......@@ -143,6 +143,7 @@ Model.prototype = {
this.orderedSelectedClones=[];
this.clusters = [];
this.clusters_copy = [];
this.clones = [];
this.data = {}; // external data
this.data_info = {};
......@@ -1217,7 +1218,7 @@ changeCloneNotation: function(cloneNotationType) {
//save user cluster
if ( this.cluster_key==""){
this.clusters_copy = this.clusters
this.saveClusters()
this.clusters = []
}
......@@ -1279,14 +1280,22 @@ changeCloneNotation: function(cloneNotationType) {
this.update()
},
/**
* save clusters
* */
saveClusters: function () {
this.clusters_copy.push(this.clusters.slice())
},
/**
* restore clusters made by user
* restore previously saved clusters
* */
restoreClusters: function () {
this.cluster_key = ""
if ( typeof this.clusters_copy != 'undefined'){
this.clusters = this.clusters_copy
if (this.clusters_copy.length > 0){
this.clusters = this.clusters_copy.pop()
this.update()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment