Merge pull request #1379 from spopida/bug/1362_NaN_rendering_ERD

Change ERD fontSize config to an integer to prevent NaN errors
This commit is contained in:
Knut Sveidqvist
2020-05-01 15:14:33 +02:00
committed by GitHub
2 changed files with 11 additions and 5 deletions

View File

@@ -45,10 +45,13 @@ const drawEntities = function(svgNode, entities, graph) {
.append('text') .append('text')
.attr('id', textId) .attr('id', textId)
.attr('x', 0) .attr('x', 0)
.attr('y', (conf.fontSize + 2 * conf.entityPadding) / 2) .attr('y', 0)
.attr('dominant-baseline', 'middle') .attr('dominant-baseline', 'middle')
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
.attr('style', 'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize) .attr(
'style',
'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
)
.text(id); .text(id);
// Calculate the width and height of the entity // Calculate the width and height of the entity
@@ -227,7 +230,10 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) {
.attr('y', labelPoint.y) .attr('y', labelPoint.y)
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
.attr('dominant-baseline', 'middle') .attr('dominant-baseline', 'middle')
.attr('style', 'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize) .attr(
'style',
'font-family: ' + getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
)
.text(rel.roleA); .text(rel.roleA);
// Figure out how big the opaque 'container' rectangle needs to be // Figure out how big the opaque 'container' rectangle needs to be

View File

@@ -525,9 +525,9 @@ const config = {
fill: 'honeydew', fill: 'honeydew',
/** /**
* Font size * Font size (expressed as an integer representing a number of pixels)
*/ */
fontSize: '12px' fontSize: 12
} }
}; };