Skip to content

Commit

Permalink
updated 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
mumuy committed Aug 12, 2024
1 parent 5f4a7e5 commit 3d09587
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/widget-qrcode.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
<widget-qrcode template="glitter" foreground-color="#fe4365,#fc9d9a,#6d9d88,#490a3d" background-color="#f9f1f1" inner-color="#881600" outer-color="#343838"></widget-qrcode>
<widget-qrcode template="rect" foreground-color="#4abdac,#fc4a1a,#f7b733" background-color="#f9f6f3" inner-color="#d66c44" outer-color="#037584"></widget-qrcode>
<widget-qrcode template="star" level="L" foreground-color="#fc9000,#ffa935,#ffb756" background-color="#034690"></widget-qrcode>
<widget-qrcode template="stroke" foreground-color="#150f3f,#fb3242,#018bf8" background-color="#edfaff" inner-color="#150f3f" outer-color="#fc0000"></widget-qrcode>
<widget-qrcode template="stroke" foreground-color="#150f3f,#fb3242,#018bf8" background-color="#edfaff"></widget-qrcode>
</div>
<script type="text/javascript">
let $show = document.querySelector('widget-qrcode#show');
Expand Down
6 changes: 2 additions & 4 deletions src/module/template/stroke.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default function(context,data,options){
if(!options.foregroundColor&&resources.foregroundImage){
foregroundImage = api.getImageBrush(resources.foregroundImage);
}
let innerColor = options.innerColor||colors?.[1]||foregroundImage;
let outerColor = options.outerColor||foregroundImage;
let innerColor = options.innerColor||foregroundImage;
let outerColor = options.outerColor||colors?.[1]||foregroundImage;
let backgroundImage = backgroundColor;
if(!options.backgroundColor&&resources.backgroundImage){
backgroundImage = api.getImageBrush(resources.backgroundImage);
Expand Down Expand Up @@ -88,8 +88,6 @@ export default function(context,data,options){
if(api.isPositionPoint(i,j)==1){
context.fillStyle = innerColor;
}else if(api.isPositionPoint(i,j)==2){
let color = colors[1+(i*j)%(colors.length-1)];
let outerColor = options.outerColor||color;
context.fillStyle = outerColor;
}else{
let fillColor = colors[1+(i*j)%(colors.length-1)];
Expand Down

0 comments on commit 3d09587

Please sign in to comment.