@liquid-js/qr-code-styling 3.0.0-0 → 3.0.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -574,6 +574,7 @@ class QRCornerSquare {
574
574
  `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${-dotSize * 2.5} ${-dotSize * 2.5}` +
575
575
  `h ${-2 * dotSize}` +
576
576
  `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${-dotSize * 2.5} ${dotSize * 2.5}` +
577
+ `z` +
577
578
  `M ${x + 2.5 * dotSize} ${y + dotSize}` +
578
579
  `h ${2 * dotSize}` +
579
580
  `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${dotSize * 1.5}` +
@@ -582,7 +583,8 @@ class QRCornerSquare {
582
583
  `h ${-2 * dotSize}` +
583
584
  `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${-dotSize * 1.5} ${-dotSize * 1.5}` +
584
585
  `v ${-2 * dotSize}` +
585
- `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${-dotSize * 1.5}`);
586
+ `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${-dotSize * 1.5}` +
587
+ `z`);
586
588
  }
587
589
  });
588
590
  }
@@ -630,6 +632,7 @@ class QRCornerSquare {
630
632
  `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${-dotSize * 2.5} ${-dotSize * 2.5}` +
631
633
  `h ${-2 * dotSize}` +
632
634
  `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${-dotSize * 2.5} ${dotSize * 2.5}` +
635
+ "z" +
633
636
  `M ${x + 2.5 * dotSize} ${y + dotSize}` +
634
637
  `h ${2 * dotSize}` +
635
638
  `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${dotSize * 1.5}` +
@@ -637,7 +640,8 @@ class QRCornerSquare {
637
640
  `h ${-3.5 * dotSize}` +
638
641
  `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${-dotSize * 1.5} ${-dotSize * 1.5}` +
639
642
  `v ${-2 * dotSize}` +
640
- `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${-dotSize * 1.5}`);
643
+ `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${-dotSize * 1.5}` +
644
+ `z`);
641
645
  }
642
646
  });
643
647
  }
@@ -1266,16 +1270,6 @@ class QRSVG {
1266
1270
  const dot = new QRDot({ svg: this._element, type: options.dotsOptions.type, document: this._document });
1267
1271
  [this._dotsMask, this._dotsMaskGroup] = this._createMask("mask-dot-color");
1268
1272
  this._defs.appendChild(this._dotsMask);
1269
- this._createColor({
1270
- options: options.dotsOptions?.gradient,
1271
- color: options.dotsOptions.color,
1272
- additionalRotation: 0,
1273
- x: 0,
1274
- y: 0,
1275
- height: options.height,
1276
- width: options.width,
1277
- name: "dot-color"
1278
- });
1279
1273
  for (let i = 0; i < count; i++) {
1280
1274
  for (let j = 0; j < count; j++) {
1281
1275
  if (filter && !filter(i, j)) {
@@ -1296,12 +1290,18 @@ class QRSVG {
1296
1290
  }
1297
1291
  }
1298
1292
  }
1293
+ let colorX = xBeginning;
1294
+ let colorY = yBeginning;
1295
+ let colorCount = count;
1299
1296
  if (options.shape === ShapeType.circle) {
1300
1297
  const margin = (this._options.backgroundOptions && this._options.backgroundOptions.margin) || 0;
1301
1298
  const additionalDots = Math.floor((minSize / dotSize - count - 2 * margin) / 2);
1302
1299
  const fakeCount = count + additionalDots * 2;
1303
1300
  const xFakeBeginning = xBeginning - additionalDots * dotSize;
1304
1301
  const yFakeBeginning = yBeginning - additionalDots * dotSize;
1302
+ colorX = xFakeBeginning;
1303
+ colorY = yFakeBeginning;
1304
+ colorCount = count + additionalDots * 2;
1305
1305
  const fakeMatrix = [];
1306
1306
  const center = Math.floor(fakeCount / 2);
1307
1307
  for (let i = 0; i < fakeCount; i++) {
@@ -1337,6 +1337,16 @@ class QRSVG {
1337
1337
  }
1338
1338
  }
1339
1339
  }
1340
+ this._createColor({
1341
+ options: options.dotsOptions?.gradient,
1342
+ color: options.dotsOptions.color,
1343
+ additionalRotation: 0,
1344
+ x: colorX,
1345
+ y: colorY,
1346
+ height: colorCount * dotSize,
1347
+ width: colorCount * dotSize,
1348
+ name: "dot-color"
1349
+ });
1340
1350
  }
1341
1351
  drawCorners() {
1342
1352
  if (!this._qr) {