@@ -37,7 +37,11 @@ const selectSplit = document.querySelector('#split');
3737
3838/* video croma key controls */
3939const ctrlChroma = document . querySelector ( '#table-chroma' ) ;
40- const inputsChroma = document . querySelectorAll ( '#table-chroma input' )
40+ const inputsChroma = document . querySelectorAll ( '#table-chroma input[type=range]' )
41+ const rgbMin = document . querySelector ( '.rgb.min label' ) ;
42+ // console.log(rgbMin);
43+ const rgbMax = document . querySelector ( '.rgb.max label' ) ;
44+ // console.log(rgbMax);
4145
4246/* buttons */
4347const btnsApply = document . querySelectorAll ( '.btn_apply' ) ;
@@ -72,27 +76,33 @@ hide(video);
7276document . querySelector ( '.ctrl_strip label span' ) . innerHTML = `Limit? (${ stripMax } )` ;
7377function fChromaInputs ( ) {
7478 console . log ( 'START fChromaInputs' ) ;
75- inputsChroma . forEach ( range => {
76- const label = range . parentElement ;
79+ const levels = { } ;
80+ inputsChroma . forEach ( ( input ) => {
81+ levels [ input . name ] = input . value ;
82+ const label = input . parentElement ;
83+ label . querySelector ( "span" ) . querySelector ( "code" ) . innerHTML = input . value ;
7784 const cell = label . parentElement ;
7885 let bg ;
79- console . log ( cell . classList [ 0 ] + ' ' + cell . classList [ 1 ] + ': ' + range . value ) ;
86+ // console.log(cell.classList[0]+' '+cell.classList[1]+': '+input .value);
8087 if ( cell . classList . contains ( "red" ) ) {
81- bg = `rgb(${ range . value } ,0,0)` ;
88+ bg = `rgb(${ input . value } ,0,0)` ;
8289 } else if ( cell . classList . contains ( "green" ) ) {
83- bg = `rgb(0,${ range . value } ,0)` ;
90+ bg = `rgb(0,${ input . value } ,0)` ;
8491 } else {
85- bg = `rgb(0,0,${ range . value } )` ;
92+ bg = `rgb(0,0,${ input . value } )` ;
8693 }
8794 label . style . backgroundColor = bg ;
88- if ( range . value < 200 ) {
95+ if ( input . value < 204 ) {
8996 label . style . color = "white" ;
9097 } else {
91- label . style . color = "black " ;
98+ label . style . color = "white " ;
9299 }
93100 // e.target.parentElement.style.backgroundColor = `rgb(0,${e.target.value},0)`;
94101 // e.target.parentElement.innerHTML = `${e.target.value}`;
95102 } ) ;
103+ // console.log('levels: ', levels);
104+ rgbMin . style . backgroundColor = `rgb(${ levels [ "rmin" ] } ,${ levels [ "gmin" ] } ,${ levels [ "bmin" ] } )` ;
105+ rgbMax . style . backgroundColor = `rgb(${ levels [ "rmax" ] } ,${ levels [ "gmax" ] } ,${ levels [ "bmax" ] } )` ;
96106}
97107fChromaInputs ( ) ;
98108
@@ -486,8 +496,8 @@ if (navigator.mediaDevices) {
486496 } )
487497 } ) ;
488498
489- inputsChroma . forEach ( range => {
490- range . addEventListener ( 'change' , ( e ) => {
499+ inputsChroma . forEach ( input => {
500+ input . addEventListener ( 'change' , ( e ) => {
491501 fChromaInputs ( ) ;
492502 } )
493503 } ) ;
0 commit comments