perf: faster resetIconPosition avoiding to parse path twice (#10497)

This commit is contained in:
Álvaro Mondéjar Rubio
2024-09-04 18:32:01 +02:00
committed by GitHub
parent 026b45e07d
commit f776f817bd
3 changed files with 8 additions and 8 deletions

View File

@@ -19,9 +19,10 @@ function getIconSize(iconKey) {
return { width: x1 - x0, height: y1 - y0 }
}
function resetIconPosition(path) {
function resetIconPosition(d) {
const path = svgpath(d)
const [offsetX, offsetY] = svgPathBbox(path)
const pathReset = svgpath(path).translate(-offsetX, -offsetY).toString()
const pathReset = path.translate(-offsetX, -offsetY).toString()
return pathReset
}