perf: faster resetIconPosition avoiding to parse path twice (#10497)
This commit is contained in:
committed by
GitHub
parent
026b45e07d
commit
f776f817bd
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user