Skip to content

Commit

Permalink
updated 融合模式异常修复
Browse files Browse the repository at this point in the history
  • Loading branch information
mumuy committed Sep 10, 2024
1 parent 4d67e5a commit 4f2b1a0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dist/widget-qrcode.min.js

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions src/module/template/fusion.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ export default function(context,data,options){
let foregroundColor = options.foregroundColor||'#000000';
let colors = foregroundColor.split(',');
let foregroundImage = colors[0];
let innerColor = options.innerColor||colors[0];
let outerColor = options.outerColor||colors[0];
if(resources.backgroundImage){
foregroundColor = colors[0].replace(/#([0-9a-fA-F]{6}).*/,'#$188');
foregroundImage = foregroundColor;
backgroundColor = backgroundColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
innerColor = innerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
outerColor = outerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
}
let innerImage = innerColor||foregroundImage;
let outerImage = outerColor||foregroundImage;
if(!options.foregroundColor&&resources.foregroundImage){
foregroundImage = api.getImageBrush(resources.foregroundImage);
}
Expand All @@ -33,16 +44,6 @@ export default function(context,data,options){
});
foregroundImage = gradient;
}
let innerColor = options.innerColor||foregroundColor;
let outerColor = options.outerColor||foregroundColor;
if(resources.backgroundImage){
foregroundColor = foregroundColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
backgroundColor = backgroundColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
innerColor = innerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
outerColor = outerColor.replace(/#([0-9a-fA-F]{6}).*/,'#$188');
}
let innerImage = innerColor||foregroundImage;
let outerImage = outerColor||foregroundImage;
let backgroundImage = resources.backgroundImage?api.getImageBrush(resources.backgroundImage):backgroundColor;
context.save();
context.fillStyle = backgroundImage;
Expand All @@ -67,7 +68,7 @@ export default function(context,data,options){
api.setRangeDisabled(i,j,7,7);
}
}else{
let fillColor = api.getValue(i,j)==1?foregroundColor:backgroundColor;
let fillColor = api.getValue(i,j)==1?foregroundImage:backgroundColor;
context.fillStyle = fillColor;
context.beginPath();
context.arc(i*pxWidth,j*pxWidth,0.5*pxWidth,0,0.5*Math.PI);
Expand Down
2 changes: 1 addition & 1 deletion src/module/template/glitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function(context,data,options){
context.restore();
context.save();
context.translate(x,y);
context.fillStyle = foregroundColor;
context.fillStyle = colors[0];
for(let i=0;i<len;i++){
for(let j=0;j<len;j++){
if(api.isPositionPoint(i,j)==1){
Expand Down

0 comments on commit 4f2b1a0

Please sign in to comment.