@@ -6,76 +6,76 @@ function TunerDisplay(canvas, width, height) {
66 this . canvas = canvas ;
77 this . width = width ;
88 this . height = height ;
9- this . ctx = canvas . getContext ( '2d' ) ;
10- this . note = 'A' ;
9+ this . ctx = canvas . getContext ( "2d" ) ;
10+ this . note = "A" ;
1111 this . cents = 0 ;
1212 this . frequency = 440 ;
1313 this . chromaticMode = true ; // Default to chromatic mode
1414
1515 // Create mode toggle container
16- this . modeContainer = document . createElement ( ' div' ) ;
16+ this . modeContainer = document . createElement ( " div" ) ;
1717 Object . assign ( this . modeContainer . style , {
18- position : ' absolute' ,
19- top : ' 20px' ,
20- left : ' 50%' ,
21- transform : ' translateX(-50%)' ,
22- display : ' flex' ,
23- backgroundColor : ' #FFFFFF' ,
24- borderRadius : ' 20px' ,
25- padding : ' 4px' ,
26- boxShadow : ' 0 2px 4px rgba(0,0,0,0.1)'
18+ position : " absolute" ,
19+ top : " 20px" ,
20+ left : " 50%" ,
21+ transform : " translateX(-50%)" ,
22+ display : " flex" ,
23+ backgroundColor : " #FFFFFF" ,
24+ borderRadius : " 20px" ,
25+ padding : " 4px" ,
26+ boxShadow : " 0 2px 4px rgba(0,0,0,0.1)"
2727 } ) ;
2828 canvas . parentElement . appendChild ( this . modeContainer ) ;
2929
3030 // Create mode buttons wrapper
31- const buttonsWrapper = document . createElement ( ' div' ) ;
31+ const buttonsWrapper = document . createElement ( " div" ) ;
3232 Object . assign ( buttonsWrapper . style , {
33- display : ' flex' ,
34- gap : ' 4px' ,
35- position : ' relative'
33+ display : " flex" ,
34+ gap : " 4px" ,
35+ position : " relative"
3636 } ) ;
3737 this . modeContainer . appendChild ( buttonsWrapper ) ;
3838
3939 // Create chromatic mode button
40- this . chromaticButton = document . createElement ( ' div' ) ;
40+ this . chromaticButton = document . createElement ( " div" ) ;
4141 Object . assign ( this . chromaticButton . style , {
42- width : ' 40px' ,
43- height : ' 32px' ,
44- borderRadius : ' 16px' ,
45- display : ' flex' ,
46- alignItems : ' center' ,
47- justifyContent : ' center' ,
48- cursor : ' pointer' ,
49- transition : ' all 0.3s ease'
42+ width : " 40px" ,
43+ height : " 32px" ,
44+ borderRadius : " 16px" ,
45+ display : " flex" ,
46+ alignItems : " center" ,
47+ justifyContent : " center" ,
48+ cursor : " pointer" ,
49+ transition : " all 0.3s ease"
5050 } ) ;
51- const chromaticIcon = document . createElement ( ' img' ) ;
51+ const chromaticIcon = document . createElement ( " img" ) ;
5252 Object . assign ( chromaticIcon , {
53- src : ' header-icons/chromatic-mode.svg' ,
54- width : '20' ,
55- height : '20' ,
56- alt : ''
53+ src : " header-icons/chromatic-mode.svg" ,
54+ width : "20" ,
55+ height : "20" ,
56+ alt : ""
5757 } ) ;
5858 this . chromaticButton . appendChild ( chromaticIcon ) ;
5959 buttonsWrapper . appendChild ( this . chromaticButton ) ;
6060
6161 // Create target pitch mode button
62- this . targetPitchButton = document . createElement ( ' div' ) ;
62+ this . targetPitchButton = document . createElement ( " div" ) ;
6363 Object . assign ( this . targetPitchButton . style , {
64- width : ' 40px' ,
65- height : ' 32px' ,
66- borderRadius : ' 16px' ,
67- display : ' flex' ,
68- alignItems : ' center' ,
69- justifyContent : ' center' ,
70- cursor : ' pointer' ,
71- transition : ' all 0.3s ease'
64+ width : " 40px" ,
65+ height : " 32px" ,
66+ borderRadius : " 16px" ,
67+ display : " flex" ,
68+ alignItems : " center" ,
69+ justifyContent : " center" ,
70+ cursor : " pointer" ,
71+ transition : " all 0.3s ease"
7272 } ) ;
73- const targetIcon = document . createElement ( ' img' ) ;
73+ const targetIcon = document . createElement ( " img" ) ;
7474 Object . assign ( targetIcon , {
75- src : ' header-icons/target-pitch-mode.svg' ,
76- width : '20' ,
77- height : '20' ,
78- alt : ''
75+ src : " header-icons/target-pitch-mode.svg" ,
76+ width : "20" ,
77+ height : "20" ,
78+ alt : ""
7979 } ) ;
8080 this . targetPitchButton . appendChild ( targetIcon ) ;
8181 buttonsWrapper . appendChild ( this . targetPitchButton ) ;
@@ -101,14 +101,14 @@ function TunerDisplay(canvas, width, height) {
101101TunerDisplay . prototype . updateButtonStyles = function ( ) {
102102 if ( this . chromaticMode ) {
103103 this . chromaticButton . style . backgroundColor = platformColor . selectorBackground ;
104- this . chromaticButton . querySelector ( ' img' ) . style . filter = ' brightness(0) invert(1)' ;
105- this . targetPitchButton . style . backgroundColor = ' transparent' ;
106- this . targetPitchButton . querySelector ( ' img' ) . style . filter = ' none' ;
104+ this . chromaticButton . querySelector ( " img" ) . style . filter = " brightness(0) invert(1)" ;
105+ this . targetPitchButton . style . backgroundColor = " transparent" ;
106+ this . targetPitchButton . querySelector ( " img" ) . style . filter = " none" ;
107107 } else {
108108 this . targetPitchButton . style . backgroundColor = platformColor . selectorBackground ;
109- this . targetPitchButton . querySelector ( ' img' ) . style . filter = ' brightness(0) invert(1)' ;
110- this . chromaticButton . style . backgroundColor = ' transparent' ;
111- this . chromaticButton . querySelector ( ' img' ) . style . filter = ' none' ;
109+ this . targetPitchButton . querySelector ( " img" ) . style . filter = " brightness(0) invert(1)" ;
110+ this . chromaticButton . style . backgroundColor = " transparent" ;
111+ this . chromaticButton . querySelector ( " img" ) . style . filter = " none" ;
112112 }
113113} ;
114114
@@ -143,32 +143,32 @@ TunerDisplay.prototype.draw = function() {
143143 const meterY = height - 80 ; // Base position of meter
144144
145145 // Draw the tuning meter background
146- ctx . fillStyle = ' #e0e0e0' ;
146+ ctx . fillStyle = " #e0e0e0" ;
147147 ctx . fillRect ( meterX , meterY , meterWidth , meterHeight ) ;
148148
149149 // Draw the center line
150- ctx . fillStyle = ' #000000' ;
150+ ctx . fillStyle = " #000000" ;
151151 ctx . fillRect ( meterX + meterWidth / 2 - 1 , meterY , 2 , meterHeight ) ;
152152
153153 // Draw the indicator
154154 const indicatorX = meterX + ( meterWidth / 2 ) + ( this . cents / 50 ) * ( meterWidth / 2 ) ;
155- ctx . fillStyle = ' #ff0000' ;
155+ ctx . fillStyle = " #ff0000" ;
156156 ctx . fillRect ( indicatorX - 2 , meterY - 5 , 4 , meterHeight + 10 ) ;
157157
158158 // Position text much lower in the canvas
159159 // Draw the note
160- ctx . font = ' bold 48px Arial' ;
161- ctx . textAlign = ' center' ;
162- ctx . fillStyle = ' #000000' ;
160+ ctx . font = " bold 48px Arial" ;
161+ ctx . textAlign = " center" ;
162+ ctx . fillStyle = " #000000" ;
163163 ctx . fillText ( this . note , width / 2 , height - 200 ) ; // Much lower position
164164
165165 // Draw the cents deviation
166- ctx . font = ' 24px Arial' ;
167- ctx . fillText ( ( this . cents >= 0 ? '+' : '' ) + Math . round ( this . cents ) + '¢' , width / 2 , height - 160 ) ; // Much lower position
166+ ctx . font = " 24px Arial" ;
167+ ctx . fillText ( ( this . cents >= 0 ? "+" : "" ) + Math . round ( this . cents ) + "¢" , width / 2 , height - 160 ) ; // Much lower position
168168
169169 // Draw the frequency
170- ctx . font = ' 18px Arial' ;
171- ctx . fillText ( this . frequency . toFixed ( 1 ) + ' Hz' , width / 2 , height - 40 ) ; // Near bottom
170+ ctx . font = " 18px Arial" ;
171+ ctx . fillText ( this . frequency . toFixed ( 1 ) + " Hz" , width / 2 , height - 40 ) ; // Near bottom
172172} ;
173173
174174/**
@@ -183,10 +183,10 @@ const TunerUtils = {
183183 frequencyToPitch : function ( frequency ) {
184184 const A4 = 440 ;
185185 const C0 = A4 * Math . pow ( 2 , - 4.75 ) ;
186- const noteNames = [ 'C' , 'C#' , 'D' , 'D#' , 'E' , 'F' , 'F#' , 'G' , 'G#' , 'A' , 'A#' , 'B' ] ;
186+ const noteNames = [ "C" , "C#" , "D" , "D#" , "E" , "F" , "F#" , "G" , "G#" , "A" , "A#" , "B" ] ;
187187
188188 if ( frequency < C0 ) {
189- return [ 'C' , 0 , C0 ] ;
189+ return [ "C" , 0 , C0 ] ;
190190 }
191191
192192 const h = Math . round ( 12 * Math . log2 ( frequency / C0 ) ) ;
@@ -206,4 +206,4 @@ const TunerUtils = {
206206 calculatePlaybackRate : function ( baseCents , adjustment ) {
207207 return Math . pow ( 2 , ( baseCents + adjustment ) / 1200 ) ;
208208 }
209- } ;
209+ } ;
0 commit comments