Skip to content

Commit

Permalink
crop matrix now has an undo button
Browse files Browse the repository at this point in the history
  • Loading branch information
cornhundred committed Dec 16, 2016
1 parent 570eba6 commit ffbc721
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
29 changes: 21 additions & 8 deletions clustergrammer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/config/set_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ console.log('set_defaults')
max_allow_fs: 20,
dendro_filter:{'row':false, 'col':false},
cat_filter:{'row':false, 'col':false},
// crop_filter:{'row':false, 'col':false},
crop_filter_nodes:{'row':false, 'col':false},
row_tip_callback:null,
col_tip_callback:null,
tile_tip_callback:null,
Expand Down
5 changes: 5 additions & 0 deletions src/dendrogram/click_filter_cats.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = function click_filter_cats(cgm, inst_data, inst_selection, inst
var inst_col_nodes = cgm.params.network_data.col_nodes;

// run filtering using found names
console.log('filter with cat')
cgm.filter_viz_using_names(filter_names);

// save backup of the inst_view
Expand All @@ -47,6 +48,10 @@ module.exports = function click_filter_cats(cgm, inst_data, inst_selection, inst
filter_names = cgm.params.cat_filter[inst_rc];

// reset filter
console.log('reset filter with cat')

console.log(filter_names)

cgm.filter_viz_using_names(filter_names);
// must set this after filtering has been run
cgm.params.cat_filter[inst_rc] = false;
Expand Down
3 changes: 3 additions & 0 deletions src/network/filter_viz_using_names.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = function filter_viz_using_names(names, external_cgm = false){
var new_nodes = {};
var found_nodes;

console.log(names)
_.each(['row', 'col'], function(inst_rc){

// I'm requiring view 0
Expand All @@ -38,6 +39,8 @@ module.exports = function filter_viz_using_names(names, external_cgm = false){

});

console.log('new nodes')
console.log(new_nodes)
// new_nodes.col_nodes = params.network_data.col_nodes;

var new_network_data = filter_network_using_new_nodes(cgm.config, new_nodes);
Expand Down
2 changes: 1 addition & 1 deletion src/params/ini_label_params.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function set_label_params(params){
module.exports = function ini_label_params(params){

var labels = {};
labels.super_label_scale = params.super_label_scale;
Expand Down
13 changes: 10 additions & 3 deletions src/sidebar/make_icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ module.exports = function make_icons(cgm, sidebar){
if (is_crop){

// keep list of names to return to state
cgm.params.crop_filter = {}
cgm.params.crop_filter.row = cgm.params.network_data.row_nodes_names;
cgm.params.crop_filter.col = cgm.params.network_data.col_nodes_names;
cgm.params.crop_filter_nodes = {}
cgm.params.crop_filter_nodes.row_nodes = cgm.params.network_data.row_nodes;
cgm.params.crop_filter_nodes.col_nodes = cgm.params.network_data.col_nodes;

cgm.crop_matrix();

Expand All @@ -134,6 +134,13 @@ module.exports = function make_icons(cgm, sidebar){
.classed('fa-crop', true)
.classed('fa-undo', false);


console.log('****** reset to previous state')
console.log(cgm.params.crop_filter_nodes)
// cgm.filter_viz_using_names(cgm.params.crop_filter_nodes);
cgm.filter_viz_using_nodes(cgm.params.crop_filter_nodes);


}

two_translate_zoom(params, 0, 0, 1);
Expand Down
6 changes: 3 additions & 3 deletions src/update/update_viz_with_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function update_viz_with_network(cgm, new_network_data){
console.log('update viz ')

var inst_group_level = cgm.params.group_level;
var inst_crop_fitler = cgm.params.crop_filter;
var inst_crop_fitler = cgm.params.crop_filter_nodes;

// make tmp config to make new params
var tmp_config = jQuery.extend(true, {}, cgm.config);
Expand Down Expand Up @@ -66,8 +66,8 @@ module.exports = function update_viz_with_network(cgm, new_network_data){
// have persistent group levels while updating
cgm.params.group_level = inst_group_level;

// have persistent crop_filter while updating
cgm.params.crop_filter = inst_crop_fitler;
// have persistent crop_filter_nodes while updating
cgm.params.crop_filter_nodes = inst_crop_fitler;

enter_exit_update(cgm, new_network_data, delays);

Expand Down

0 comments on commit ffbc721

Please sign in to comment.