From 36a9767255994bbf0e532559a65c9fac2f5518c8 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Tue, 15 Mar 2016 10:49:40 +0100 Subject: [PATCH] [experiments] Fix and improve block sorting on experiment setup page (closes #413) --- beat/web/experiments/static/experiments/js/panels.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beat/web/experiments/static/experiments/js/panels.js b/beat/web/experiments/static/experiments/js/panels.js index 19b38c2ea..9e0f1fd5b 100644 --- a/beat/web/experiments/static/experiments/js/panels.js +++ b/beat/web/experiments/static/experiments/js/panels.js @@ -262,10 +262,10 @@ beat.experiments.panels.Settings.prototype._initializeAlgorithmComponents = func function _custom_cmp(a, b) { - var dist_a = Math.pow(a.representation.row - origin.row, 2) + Math.pow(a.representation.col - origin.col, 2); - var dist_b = Math.pow(b.representation.row - origin.row, 2) + Math.pow(b.representation.col - origin.col, 2); + var dist_a = Math.pow(a.representation.col - origin.col, 2) + 0.1*Math.abs(a.representation.row - origin.row); + var dist_b = Math.pow(b.representation.col - origin.col, 2) + 0.1*Math.abs(b.representation.row - origin.row); - return dist_a > dist_b; + return dist_a - dist_b; } var components_sorted_by_position = [].concat(components); -- GitLab