Skip to content

Commit 4f2b1a0

Browse files
author
mumuy
committed
updated 融合模式异常修复
1 parent 4d67e5a commit 4f2b1a0

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

dist/widget-qrcode.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/module/template/fusion.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ export default function(context,data,options){
2222
let foregroundColor = options.foregroundColor||'#000000';
2323
let colors = foregroundColor.split(',');
2424
let foregroundImage = colors[0];
25+
let innerColor = options.innerColor||colors[0];
26+
let outerColor = options.outerColor||colors[0];
27+
if(resources.backgroundImage){
28+
foregroundColor = colors[0].replace(/#([0-9a-fA-F]{6}).*/,'#$188');
29+
foregroundImage = foregroundColor;
30+
backgroundColor = backgroundColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
31+
innerColor = innerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
32+
outerColor = outerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
33+
}
34+
let innerImage = innerColor||foregroundImage;
35+
let outerImage = outerColor||foregroundImage;
2536
if(!options.foregroundColor&&resources.foregroundImage){
2637
foregroundImage = api.getImageBrush(resources.foregroundImage);
2738
}
@@ -33,16 +44,6 @@ export default function(context,data,options){
3344
});
3445
foregroundImage = gradient;
3546
}
36-
let innerColor = options.innerColor||foregroundColor;
37-
let outerColor = options.outerColor||foregroundColor;
38-
if(resources.backgroundImage){
39-
foregroundColor = foregroundColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
40-
backgroundColor = backgroundColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
41-
innerColor = innerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
42-
outerColor = outerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
43-
}
44-
let innerImage = innerColor||foregroundImage;
45-
let outerImage = outerColor||foregroundImage;
4647
let backgroundImage = resources.backgroundImage?api.getImageBrush(resources.backgroundImage):backgroundColor;
4748
context.save();
4849
context.fillStyle = backgroundImage;
@@ -67,7 +68,7 @@ export default function(context,data,options){
6768
api.setRangeDisabled(i,j,7,7);
6869
}
6970
}else{
70-
let fillColor = api.getValue(i,j)==1?foregroundColor:backgroundColor;
71+
let fillColor = api.getValue(i,j)==1?foregroundImage:backgroundColor;
7172
context.fillStyle = fillColor;
7273
context.beginPath();
7374
context.arc(i*pxWidth,j*pxWidth,0.5*pxWidth,0,0.5*Math.PI);

src/module/template/glitter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function(context,data,options){
3737
context.restore();
3838
context.save();
3939
context.translate(x,y);
40-
context.fillStyle = foregroundColor;
40+
context.fillStyle = colors[0];
4141
for(let i=0;i<len;i++){
4242
for(let j=0;j<len;j++){
4343
if(api.isPositionPoint(i,j)==1){

0 commit comments

Comments
 (0)