useMaxWidth should make height 100% too.

This commit is contained in:
Yusuke Wada
2021-09-14 18:28:15 +09:00
parent 0d91eee5e0
commit 20aaf644fa

View File

@@ -778,12 +778,13 @@ const d3Attrs = function (d3Elem, attrs) {
export const calculateSvgSizeAttrs = function (height, width, useMaxWidth) { export const calculateSvgSizeAttrs = function (height, width, useMaxWidth) {
let attrs = new Map(); let attrs = new Map();
attrs.set('height', height);
if (useMaxWidth) { if (useMaxWidth) {
attrs.set('width', '100%'); attrs.set('width', '100%');
attrs.set('height', '100%');
attrs.set('style', `max-width: ${width}px;`); attrs.set('style', `max-width: ${width}px;`);
} else { } else {
attrs.set('width', width); attrs.set('width', width);
attrs.set('height', height);
} }
return attrs; return attrs;
}; };