@liquid-js/qr-code-styling 5.4.3 → 5.4.4
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.
|
@@ -1092,6 +1092,12 @@ class QRSVG {
|
|
|
1092
1092
|
this._element.appendChild(image);
|
|
1093
1093
|
}
|
|
1094
1094
|
createColor(cfg) {
|
|
1095
|
+
let {width, height, x, y} = cfg;
|
|
1096
|
+
x -= this.options.dotsOptions.size, y -= this.options.dotsOptions.size, width += 2 * this.options.dotsOptions.size,
|
|
1097
|
+
height += 2 * this.options.dotsOptions.size;
|
|
1098
|
+
let rect = this.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1099
|
+
rect.setAttribute("x", numToAttr(x)), rect.setAttribute("y", numToAttr(y)), rect.setAttribute("height", numToAttr(height)),
|
|
1100
|
+
rect.setAttribute("width", numToAttr(width)), rect.setAttribute("clip-path", `url(#mask-${cfg.name})`);
|
|
1095
1101
|
let value = function({options, color, additionalRotation, x, y, height, width, name, dotSize: size, document}) {
|
|
1096
1102
|
let gradientSize = width > height ? width : height;
|
|
1097
1103
|
if (x -= size, y -= size, width += 2 * size, height += 2 * size, options) {
|
|
@@ -1136,16 +1142,9 @@ class QRSVG {
|
|
|
1136
1142
|
dotSize: this.options.dotsOptions.size,
|
|
1137
1143
|
document: this.document
|
|
1138
1144
|
});
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
height += 2 * this.options.dotsOptions.size;
|
|
1143
|
-
let rect = this.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1144
|
-
return rect.setAttribute("x", numToAttr(x)), rect.setAttribute("y", numToAttr(y)),
|
|
1145
|
-
rect.setAttribute("height", numToAttr(height)), rect.setAttribute("width", numToAttr(width)),
|
|
1146
|
-
rect.setAttribute("clip-path", `url(#mask-${cfg.name})`), rect.setAttribute("fill", value.value),
|
|
1147
|
-
value.gradient && this.defs.appendChild(value.gradient), value.opacity < 1 && rect.setAttribute("opacity", value.opacity.toFixed(7)),
|
|
1148
|
-
this._element.appendChild(rect), value;
|
|
1145
|
+
return value && (rect.setAttribute("fill", value.value), value.gradient && this.defs.appendChild(value.gradient),
|
|
1146
|
+
value.opacity < 1 && rect.setAttribute("opacity", value.opacity.toFixed(7))), this._element.appendChild(rect),
|
|
1147
|
+
value;
|
|
1149
1148
|
}
|
|
1150
1149
|
createMask(id) {
|
|
1151
1150
|
let mask = this.document.createElementNS("http://www.w3.org/2000/svg", "clipPath");
|