Skip to content

Commit

Permalink
fix(qr): correctly position logo at center
Browse files Browse the repository at this point in the history
  • Loading branch information
vnphanquang committed Oct 18, 2023
1 parent ef16c88 commit 530e6b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-trainers-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@svelte-put/qr': patch
---

correctly position logo to center
4 changes: 2 additions & 2 deletions packages/misc/qr/src/qr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export function createSVGParts(config, qr) {
if (logo) {
const safelyRemovableSize = Math.floor(count * Math.sqrt(0.1));
const { width, height } = calculateLogoSize(safelyRemovableSize * 0.8, logoRatio);
const x = (size - width) / 2;
const y = (size - height) / 2;
const x = (size + margin - width) / 2;
const y = (size + margin - height) / 2;
logoSvg = `<image width="${width}" height="${height}" x="${x}" y="${y}" href="${logo}" />`;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/misc/qr/types/index.d.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
null,
null
],
"mappings": ";;;;;iBA0BgBA,cAAcA;;;;;;;;;;;;;;iBAgFdC,SAASA;;;;iBAYTC,iBAAiBA;;;;OC9GrBC,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCKEC,SAASA;;;;iBAqBfC,EAAEA;kBCpBDC,aAAaA;;;;;OCXlBC,cAAcA;;;;;OAMdC,eAAeA;;;;;OAQfC,iBAAiBA;;;;OHTjBN,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBICJE,EAAEA;OCLNK,cAAcA;;;;;OAMdC,eAAeA;;;;;OAQfC,iBAAiBA;;;;OLVjBT,QAAQA"
"mappings": ";;;;;iBA0BgBA,cAAcA;;;;;;;;;;;;;;iBAgFdC,SAASA;;;;iBAYTC,iBAAiBA;;;;OC9GrBC,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCKEC,SAASA;;;;iBAqBfC,EAAEA;kBCpBDC,aAAaA;;;;;OCXlBC,cAAcA;;;;;OAMdC,eAAeA;;;;;OAQfC,iBAAiBA;;;;OHTjBN,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBICJE,EAAEA;OCNNK,cAAcA;;;;;OAMdC,eAAeA;;;;;OAQfC,iBAAiBA;;;;OLTjBT,QAAQA"
}

0 comments on commit 530e6b2

Please sign in to comment.