Skip to content

Commit 9fe4d78

Browse files
DedeHaisofthack007
authored andcommitted
use constant instead of magic number in pixelforge
1 parent d6e2473 commit 9fe4d78

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wled00/data/pixelforge/pixelforge.htm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ <h3>PIXEL MAGIC Tool</h3>
419419

420420
<script>
421421
const d=document,gId=i=>d.getElementById(i),cE=t=>d.createElement(t);
422+
const imgageFX = 53; // image effect number
423+
const txtFX = 122; // scrolling text effect number
422424

423425
/* canvases */
424426
const cv=gId('cv'),cx=cv.getContext('2d',{willReadFrequently:true});
@@ -471,7 +473,7 @@ <h3>PIXEL MAGIC Tool</h3>
471473
if(j.seg&&j.seg.length){
472474
j.seg.forEach(({id,n,start,stop,startY,stopY,fx})=>{
473475
const w=stop-start,h=(stopY-startY)||1;
474-
const t = (n || `Segment ${id}`) + (h>1 ? ` (${w}x${h})` : ` (${w}px)`) + (fx===53 ? ' [Image]' : (fx===122 ? ' [Scrolling Text]' : ''));
476+
const t = (n || `Segment ${id}`) + (h>1 ? ` (${w}x${h})` : ` (${w}px)`) + (fx===imgageFX ? ' [Image]' : (fx===txtFX ? ' [Scrolling Text]' : ''));
475477
const o=new Option(t,id);
476478
o.dataset.w=w; o.dataset.h=h; o.dataset.fx=fx||0;
477479
s1.add(o); // gif tool
@@ -492,7 +494,7 @@ <h3>PIXEL MAGIC Tool</h3>
492494
function curImgSeg(){
493495
const sel=gId('seg');
494496
for(let i=0;i<sel.options.length;i++){
495-
if(parseInt(sel.options[i].dataset.fx)===53) return parseInt(sel.options[i].value);
497+
if(parseInt(sel.options[i].dataset.fx)===imgageFX) return parseInt(sel.options[i].value);
496498
}
497499
return null;
498500
}

0 commit comments

Comments
 (0)