From 7202eb49f758ae9be6aacf33f63243e9e1099264 Mon Sep 17 00:00:00 2001 From: Martin Czuchra Date: Mon, 11 Nov 2013 18:40:38 +0100 Subject: [PATCH] Restores labels in aggregations. --- app/assets/javascripts/timelines.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/assets/javascripts/timelines.js b/app/assets/javascripts/timelines.js index 62bac5d085..bbac6ae6f9 100644 --- a/app/assets/javascripts/timelines.js +++ b/app/assets/javascripts/timelines.js @@ -2954,6 +2954,29 @@ Timeline = { e.translate(x, y); }); + } else { + + + textColor = timeline.getLimunanceFor(color) > Timeline.PE_LUMINANCE_THRESHOLD ? + Timeline.PE_DARK_TEXT_COLOR : Timeline.PE_LIGHT_TEXT_COLOR; + + var text = this.subject; + label = timeline.paper.text(0, 0, text); + label.attr({ + 'font-size': 12, + 'fill': textColor, + 'stroke': 'none' + }); + + x = label_space.x + label_space.w/2; + y -= 4; + + while (text.length > 0 && label.getBBox().width > label_space.w) { + text = text.slice(0, -1); + label.attr({ 'text': text }); + } + + label.translate(x, y); } }