Skip to content

Commit

Permalink
perf: limit logoSize precision to 3 (#10521)
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore authored Sep 13, 2024
1 parent 394a827 commit 9e3a056
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/logos.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ describe('Logo helpers', function () {
)
// use simple icon with auto logo size
given({ name: 'amd', size: 'auto' }).expect(
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCA1LjcyNTk5OTk5OTk5OTk5OSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+QU1EPC90aXRsZT48cGF0aCBkPSJNMTguMzI0IDBsMS41NTkgMS41NmgyLjU1NnYyLjU1N0wyNCA1LjY3N1Ywek0yIDAuMzgyOTk5OTk5OTk5OTk5MWwtMiA0Ljk2aDEuMzA5bDAuMzctMC45ODJIMy45bDAuNDA4IDAuOTgyaDEuMzM4TDMuNDMyIDAuMzgyOTk5OTk5OTk5OTk5MXogbTQuMjA5IDB2NC45NTVoMS4yMzh2LTMuMDkybDEuMzM4IDEuNTYyaDAuMTg4bDEuMzM4LTEuNTU2djMuMDkxaDEuMjM4VjAuMzgyOTk5OTk5OTk5OTk5MUgxMC40N2wtMS41OTIgMS44NDVMNy4yODcgMC4zODI5OTk5OTk5OTk5OTkxeiBtNi4yODMgMHY0Ljk2aDIuMDU3YzEuOTc5IDAgMi44OC0xLjA0NiAyLjg4LTIuNDcyIDAtMS4zNi0wLjkzNy0yLjQ4OC0yLjc0Ny0yLjQ4OHogbTEuMjM3IDAuOTFoMC43OTJjMS4xNyAwIDEuNjMgMC43MTEgMS42MyAxLjU3IDAgMC43MjgtMC4zNzIgMS41NzItMS42MTYgMS41NzJoLTAuODA2eiBtLTEwLjk4NSAwLjI3M2wwLjc5MSAxLjkzMkgyLjAwOHogbTE3LjEzNyAwLjMwN2wtMS42MDQgMS42MDN2Mi4yNWgyLjI0NmwxLjYwNC0xLjYwN2gtMi4yNDZ6Ii8+PC9zdmc+',
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZXNtb2tlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCA1LjcyNTk5OTk5OTk5OTk5OSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+QU1EPC90aXRsZT48cGF0aCBkPSJNMTguMzI0IDBsMS41NTkgMS41NmgyLjU1NnYyLjU1N0wyNCA1LjY3N1Ywek0yIDAuMzgzbC0yIDQuOTZoMS4zMDlsMC4zNy0wLjk4MkgzLjlsMC40MDggMC45ODJoMS4zMzhMMy40MzIgMC4zODN6IG00LjIwOSAwdjQuOTU1aDEuMjM4di0zLjA5MmwxLjMzOCAxLjU2MmgwLjE4OGwxLjMzOC0xLjU1NnYzLjA5MWgxLjIzOFYwLjM4M0gxMC40N2wtMS41OTIgMS44NDVMNy4yODcgMC4zODN6IG02LjI4MyAwdjQuOTZoMi4wNTdjMS45NzkgMCAyLjg4LTEuMDQ2IDIuODgtMi40NzIgMC0xLjM2LTAuOTM3LTIuNDg4LTIuNzQ3LTIuNDg4eiBtMS4yMzcgMC45MWgwLjc5MmMxLjE3IDAgMS42MyAwLjcxMSAxLjYzIDEuNTcgMCAwLjcyOC0wLjM3MiAxLjU3Mi0xLjYxNiAxLjU3MmgtMC44MDZ6IG0tMTAuOTg1IDAuMjczbDAuNzkxIDEuOTMySDIuMDA4eiBtMTcuMTM3IDAuMzA3bC0xLjYwNCAxLjYwM3YyLjI1aDIuMjQ2bDEuNjA0LTEuNjA3aC0yLjI0NnoiLz48L3N2Zz4=',
)
// use simple icon with color & auto logo size
given({ name: 'amd', color: 'white', size: 'auto' }).expect(
'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJ3aGl0ZSIgc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GggZD0iTTE4LjMyNCAwbDEuNTU5IDEuNTZoMi41NTZ2Mi41NTdMMjQgNS42NzdWMHpNMiAwLjM4M2wtMiA0Ljk2aDEuMzA5bDAuMzctMC45ODJIMy45bDAuNDA4IDAuOTgyaDEuMzM4TDMuNDMyIDAuMzgzeiBtNC4yMDkgMHY0Ljk1NWgxLjIzOHYtMy4wOTJsMS4zMzggMS41NjJoMC4xODhsMS4zMzgtMS41NTZ2My4wOTFoMS4yMzhWMC4zODNIMTAuNDdsLTEuNTkyIDEuODQ1TDcuMjg3IDAuMzgzeiBtNi4yODMgMHY0Ljk2aDIuMDU3YzEuOTc5IDAgMi44OC0xLjA0NiAyLjg4LTIuNDcyIDAtMS4zNi0wLjkzNy0yLjQ4OC0yLjc0Ny0yLjQ4OHogbTEuMjM3IDAuOTFoMC43OTJjMS4xNyAwIDEuNjMgMC43MTEgMS42MyAxLjU3IDAgMC43MjgtMC4zNzIgMS41NzItMS42MTYgMS41NzJoLTAuODA2eiBtLTEwLjk4NSAwLjI3M2wwLjc5MSAxLjkzMkgyLjAwOHogbTE3LjEzNyAwLjMwN2wtMS42MDQgMS42MDN2Mi4yNWgyLjI0NmwxLjYwNC0xLjYwN2gtMi4yNDZ6Ii8+PC9zdmc+',
)

it('preserves color if light logo on dark background', function () {
Expand Down
2 changes: 1 addition & 1 deletion lib/svg-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getIconSize(iconKey) {
function resetIconPosition(d) {
const path = svgpath(d)
const [offsetX, offsetY] = svgPathBbox(path)
const pathReset = path.translate(-offsetX, -offsetY).toString()
const pathReset = path.translate(-offsetX, -offsetY).round(3).toString()
return pathReset
}

Expand Down

0 comments on commit 9e3a056

Please sign in to comment.