diff options
author | emkael <emkael@tlen.pl> | 2017-02-26 12:00:29 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-02-26 12:00:29 +0100 |
commit | 94a98d21431d6ae03b81cf76c16c8ee3ce7f8b46 (patch) | |
tree | 139122b6fc423dc80906f230dafc0093b49ab52c /playoff.js | |
parent | 82098a333b2a128c415653a6c67cefcccf7441bf (diff) |
Visual fixes (margins for connectors)
Diffstat (limited to 'playoff.js')
-rw-r--r-- | playoff.js | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -1,8 +1,8 @@ var playoff = { settings: { - 'winner_h_offset': 10, - 'loser_h_offset': 20, + 'winner_h_offset': 8, + 'loser_h_offset': 14, 'winner_v_offset': -6, 'loser_v_offset': 6, 'loser_colour': '#ff0000', @@ -48,12 +48,11 @@ var playoff = { for (var f = 0; f < from.length; f++) { var box = boxes_idx[from[f]]; var line = [ - parseInt(box.style.left) + parseInt(box.clientWidth), - parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset'], - parseInt(box.style.left) + parseInt(box.clientWidth) + this.settings[type + '_h_offset'], - parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset'] + Math.floor(parseInt(box.style.left) + parseInt(box.clientWidth)), + Math.floor(parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset']), + Math.floor(parseInt(box.style.left) + parseInt(box.clientWidth) + this.settings[type + '_h_offset']), + Math.floor(parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset']) ]; - console.log(from, line); horizontal_from.push(line); for (var l in horizontal_from) { if (horizontal_from[l][2] < line[2]) { @@ -79,9 +78,9 @@ var playoff = { var box = boxes_idx[to[t]]; var line = [ parseInt(box.style.left), - parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset'], - parseInt(box.style.left) - this.settings[type + '_h_offset'], - parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset'] + Math.floor(parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset']), + Math.floor(parseInt(box.style.left) - this.settings[type + '_h_offset']), + Math.floor(parseInt(box.style.top) + 0.5 * parseInt(box.clientHeight) + this.settings[type + '_v_offset']) ]; horizontal_to.push(line); for (var l in horizontal_to) { @@ -108,11 +107,11 @@ var playoff = { (vertical_from[1] + vertical_from[3]) / 2 ], [ - this.settings[type + '_v_offset'] + (vertical_from[0] + vertical_from[2] + vertical_to[0] + vertical_to[2]) / 4, + this.settings[type + '_h_offset'] / 2 + (vertical_from[0] + vertical_from[2] + vertical_to[0] + vertical_to[2]) / 4, (vertical_from[1] + vertical_from[3]) / 2 ], [ - this.settings[type + '_v_offset'] + (vertical_from[0] + vertical_from[2] + vertical_to[0] + vertical_to[2]) / 4, + this.settings[type + '_h_offset'] / 2 + (vertical_from[0] + vertical_from[2] + vertical_to[0] + vertical_to[2]) / 4, (vertical_to[1] + vertical_to[3]) / 2 ], [ |