From 50917bb1ab3c7ad4024a32bf73f5e2b5a8fae5af Mon Sep 17 00:00:00 2001 From: skanaar Date: Sun, 27 Oct 2019 18:14:50 +0100 Subject: [PATCH] fix bug in svg text color --- dist/nomnoml.js | 4 ++-- src/skanaar.svg.ts | 4 ++-- test/box.style.nomnoml | 2 +- test/index.html | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/nomnoml.js b/dist/nomnoml.js index 9ba0f8f..59c7b14 100644 --- a/dist/nomnoml.js +++ b/dist/nomnoml.js @@ -855,10 +855,10 @@ var nomnoml; return newElement('path', { d: '' }); }, fillText: function (text, x, y) { - var attr = { x: tX(x), y: tY(y), style: '' }; + var attr = { x: tX(x), y: tY(y), style: 'fill: ' + last(states).fill + ';' }; var font = lastDefined('font'); if (font.indexOf('bold') === -1) { - attr.style = 'font-weight:normal;'; + attr.style += 'font-weight:normal;'; } if (font.indexOf('italic') > -1) { attr.style += 'font-style:italic;'; diff --git a/src/skanaar.svg.ts b/src/skanaar.svg.ts index 5fb35ee..33db775 100644 --- a/src/skanaar.svg.ts +++ b/src/skanaar.svg.ts @@ -181,10 +181,10 @@ namespace nomnoml.skanaar { return newElement('path', {d:''}) }, fillText: function (text, x, y){ - var attr = { x: tX(x), y: tY(y), style: '' } + var attr = { x: tX(x), y: tY(y), style: 'fill: '+last(states).fill+';' } var font = lastDefined('font') if (font.indexOf('bold') === -1) { - attr.style = 'font-weight:normal;' + attr.style += 'font-weight:normal;' } if (font.indexOf('italic') > -1) { attr.style += 'font-style:italic;' diff --git a/test/box.style.nomnoml b/test/box.style.nomnoml index 4f45065..50ebb56 100644 --- a/test/box.style.nomnoml +++ b/test/box.style.nomnoml @@ -1 +1 @@ -#.box: fill=pink italic bold visual=rhomb \ No newline at end of file +#.box: fill=pink stroke=red italic bold visual=rhomb \ No newline at end of file diff --git a/test/index.html b/test/index.html index c79f65a..98f541e 100644 --- a/test/index.html +++ b/test/index.html @@ -67,7 +67,7 @@

Svg