Skip to content

Commit

Permalink
Fieldmap: reimplement d3 rebind
Browse files Browse the repository at this point in the history
clicking on a plot is not working!
  • Loading branch information
dwaring87 committed Dec 12, 2023
1 parent 9ae4885 commit 2a90e18
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion js/source/entries/fieldmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,24 @@ export function init() {
}
});
};
return d3.rebind(cc, event, 'on');
return _rebind(cc, event, 'on');

// Copies a variable number of methods from source to target.
function _rebind(target, source) {
var i = 1, n = arguments.length, method;
while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
return target;
};

// Method is assumed to be a standard D3 getter-setter:
// If passed with no arguments, gets the value.
// If passed with arguments, sets the value and returns the target.
function d3_rebind(target, source, method) {
return function() {
var value = method.apply(source, arguments);
return arguments.length ? target : value;
};
}
}

heatmap_plot_click(plot, heatmap_object, trait_name) {
Expand Down

0 comments on commit 2a90e18

Please sign in to comment.