victory-core
Advanced tools
Comparing version 36.6.10 to 36.6.11
# victory-core | ||
## 36.6.11 | ||
### Patch Changes | ||
- Fix text size regression when using line-height ([#2615](https://github.com/FormidableLabs/victory/pull/2615)) | ||
## 36.6.10 | ||
@@ -4,0 +10,0 @@ |
@@ -283,2 +283,5 @@ import _memoize from "lodash/memoize"; | ||
element.setAttribute("xlink", "http://www.w3.org/1999/xlink"); | ||
element.setAttribute("width", "300"); | ||
element.setAttribute("height", "300"); | ||
element.setAttribute("viewBox", "0 0 300 300"); | ||
var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text"); | ||
@@ -318,3 +321,2 @@ element.appendChild(containerElement); | ||
textElement.style.fontFamily = params.fontFamily; | ||
textElement.style.transform = "rotate(".concat(params.angle, ")"); | ||
textElement.style.fontSize = "".concat(params.fontSize, "px"); | ||
@@ -327,14 +329,13 @@ textElement.style.lineHeight = params.lineHeight; | ||
textElement.setAttribute("y", "".concat(heightAcc)); | ||
heightAcc += params.lineHeight * params.fontSize; | ||
containerElement.appendChild(textElement); | ||
heightAcc += params.lineHeight * textElement.getBoundingClientRect().height; | ||
} | ||
var _containerElement$get = containerElement.getBoundingClientRect(), | ||
width = _containerElement$get.width, | ||
height = _containerElement$get.height; | ||
width = _containerElement$get.width; | ||
containerElement.innerHTML = ""; | ||
return { | ||
width: width, | ||
height: height | ||
width: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(width, heightAcc, style === null || style === void 0 ? void 0 : style.angle) : width, | ||
height: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(heightAcc, width, style === null || style === void 0 ? void 0 : style.angle) : heightAcc | ||
}; | ||
@@ -341,0 +342,0 @@ }, function (text, style) { |
@@ -294,2 +294,5 @@ "use strict"; | ||
element.setAttribute("xlink", "http://www.w3.org/1999/xlink"); | ||
element.setAttribute("width", "300"); | ||
element.setAttribute("height", "300"); | ||
element.setAttribute("viewBox", "0 0 300 300"); | ||
var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text"); | ||
@@ -329,3 +332,2 @@ element.appendChild(containerElement); | ||
textElement.style.fontFamily = params.fontFamily; | ||
textElement.style.transform = "rotate(".concat(params.angle, ")"); | ||
textElement.style.fontSize = "".concat(params.fontSize, "px"); | ||
@@ -338,14 +340,13 @@ textElement.style.lineHeight = params.lineHeight; | ||
textElement.setAttribute("y", "".concat(heightAcc)); | ||
heightAcc += params.lineHeight * params.fontSize; | ||
containerElement.appendChild(textElement); | ||
heightAcc += params.lineHeight * textElement.getBoundingClientRect().height; | ||
} | ||
var _containerElement$get = containerElement.getBoundingClientRect(), | ||
width = _containerElement$get.width, | ||
height = _containerElement$get.height; | ||
width = _containerElement$get.width; | ||
containerElement.innerHTML = ""; | ||
return { | ||
width: width, | ||
height: height | ||
width: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(width, heightAcc, style === null || style === void 0 ? void 0 : style.angle) : width, | ||
height: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(heightAcc, width, style === null || style === void 0 ? void 0 : style.angle) : heightAcc | ||
}; | ||
@@ -352,0 +353,0 @@ }, function (text, style) { |
{ | ||
"name": "victory-core", | ||
"version": "36.6.10", | ||
"version": "36.6.11", | ||
"description": "Victory Core", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"react-fast-compare": "^3.2.0", | ||
"victory-vendor": "^36.6.10" | ||
"victory-vendor": "^36.6.11" | ||
}, | ||
@@ -29,0 +29,0 @@ "peerDependencies": { |
@@ -270,2 +270,5 @@ // http://www.pearsonified.com/2012/01/characters-per-line.php | ||
element.setAttribute("xlink", "http://www.w3.org/1999/xlink"); | ||
element.setAttribute("width", "300"); | ||
element.setAttribute("height", "300"); | ||
element.setAttribute("viewBox", "0 0 300 300"); | ||
@@ -308,3 +311,2 @@ const containerElement = document.createElementNS( | ||
textElement.style.fontFamily = params.fontFamily; | ||
textElement.style.transform = `rotate(${params.angle})`; | ||
textElement.style.fontSize = `${params.fontSize}px`; | ||
@@ -317,12 +319,20 @@ textElement.style.lineHeight = params.lineHeight; | ||
textElement.setAttribute("y", `${heightAcc}`); | ||
heightAcc += params.lineHeight * params.fontSize; | ||
containerElement.appendChild(textElement); | ||
containerElement.appendChild(textElement); | ||
heightAcc += | ||
params.lineHeight * textElement.getBoundingClientRect().height; | ||
} | ||
const { width, height } = containerElement.getBoundingClientRect(); | ||
const { width } = containerElement.getBoundingClientRect(); | ||
containerElement.innerHTML = ""; | ||
return { width, height }; | ||
return { | ||
width: style?.angle | ||
? _getSizeWithRotate(width, heightAcc, style?.angle) | ||
: width, | ||
height: style?.angle | ||
? _getSizeWithRotate(heightAcc, width, style?.angle) | ||
: heightAcc, | ||
}; | ||
}, | ||
@@ -329,0 +339,0 @@ (text, style) => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3181727
63259
Updatedvictory-vendor@^36.6.11