From fdc2e3158dc297bb4a44f7b1e9aa454724cbb0a6 Mon Sep 17 00:00:00 2001 From: Mason Malone Date: Wed, 24 Oct 2018 20:37:45 -0700 Subject: [PATCH] Prevent text from overlapping lines This adds a white background to text strings so that they're easier to read when crossing a line. --- src/theme-snap.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/theme-snap.js b/src/theme-snap.js index 3141b35..327d2a3 100644 --- a/src/theme-snap.js +++ b/src/theme-snap.js @@ -215,6 +215,10 @@ if (typeof Snap != 'undefined') { t.attr({x: x - bb.x, y: y - bb.y}); t.selectAll('tspan').attr({x: x}); + // To prevent text from overlapping lines, add a white background by creating a rect without + // the stroke attribute. + this.drawRect(x, y, bb.width, bb.height).attr('stroke', 'none'); + this.pushToStack(t); return t; },