@@ -16,7 +16,7 @@ import { DType } from "../../../types";
1616
1717// This is the angle between vertical and the line from the center of the bulb to the intersection of the stem and bulb
1818export const bulbStemAngle = Math . PI / 5 ;
19- export const themometerOutlineWidth = 2 ;
19+ export const thermometerOutlineWidth = 2 ;
2020
2121export const ThermometerComponentProps = {
2222 minimum : FloatPropOpt ,
@@ -27,7 +27,7 @@ export const ThermometerComponentProps = {
2727 fillColor : ColorPropOpt
2828} ;
2929
30- interface ThermomemterDimensions {
30+ interface ThermometerDimensions {
3131 outerWidth : number ;
3232 outerHeight : number ;
3333 bulbCenterX : number ;
@@ -63,8 +63,8 @@ export const ThermometerComponent = (
6363 [ fillColor ]
6464 ) ;
6565
66- const themometerDimensions = useMemo (
67- ( ) => calculateThemometerDimensions ( width , height ) ,
66+ const thermometerDimensions = useMemo (
67+ ( ) => calculateThermometerDimensions ( width , height ) ,
6868 [ width , height ]
6969 ) ;
7070
@@ -76,28 +76,28 @@ export const ThermometerComponent = (
7676
7777 useEffect ( ( ) => {
7878 // Build the thermometer outline.
79- const thermometerPath = drawThermometerPathOutline ( themometerDimensions ) ;
80- const mercuryBulbPath = drawMercuryBulbPath ( themometerDimensions ) ;
79+ const thermometerPath = drawThermometerPathOutline ( thermometerDimensions ) ;
80+ const mercuryBulbPath = drawMercuryBulbPath ( thermometerDimensions ) ;
8181
8282 // Create SVG
8383 const thermometerSvgGroup = d3
8484 . select ( svgRef . current )
85- . attr ( "width" , themometerDimensions . outerWidth )
86- . attr ( "height" , themometerDimensions . outerHeight ) ;
85+ . attr ( "width" , thermometerDimensions . outerWidth )
86+ . attr ( "height" , thermometerDimensions . outerHeight ) ;
8787
8888 // Add the thermometer outline
8989 thermometerSvgGroup
9090 . append ( "path" )
9191 . attr ( "d" , thermometerPath . toString ( ) )
9292 . attr ( "fill" , colors . backgroundColor . toString ( ) )
9393 . attr ( "stroke" , colors . borderColor . toString ( ) )
94- . style ( "stroke-width" , themometerOutlineWidth ) ;
94+ . style ( "stroke-width" , thermometerOutlineWidth ) ;
9595
9696 thermometerSvgGroup
9797 . append ( "path" )
9898 . attr ( "d" , mercuryBulbPath . toString ( ) )
9999 . attr ( "fill" , colors . mercuryColor . toString ( ) ) ;
100- } , [ themometerDimensions , colors ] ) ;
100+ } , [ thermometerDimensions , colors ] ) ;
101101
102102 useEffect ( ( ) => {
103103 // Fill stem with the correct amount of mercury
@@ -109,24 +109,24 @@ export const ThermometerComponent = (
109109 value ,
110110 minimum ,
111111 maximum ,
112- themometerDimensions . verticalStemHeight ,
113- themometerDimensions . topOfStemY
112+ thermometerDimensions . verticalStemHeight ,
113+ thermometerDimensions . topOfStemY
114114 ) ;
115115
116116 d3 . select ( svgRef . current )
117117 . append ( "rect" )
118118 . attr (
119119 "x" ,
120- themometerDimensions . leftSideStemX + themometerOutlineWidth / 2
120+ thermometerDimensions . leftSideStemX + thermometerOutlineWidth / 2
121121 )
122122 . attr ( "y" , mercurySurfaceLevelY )
123123 . attr (
124124 "width" ,
125- 2 * themometerDimensions . stemHalfWidth - themometerOutlineWidth
125+ 2 * thermometerDimensions . stemHalfWidth - thermometerOutlineWidth
126126 )
127- . attr ( "height" , mercuryHeight + themometerOutlineWidth )
127+ . attr ( "height" , mercuryHeight + thermometerOutlineWidth )
128128 . attr ( "fill" , colors . mercuryColor . toString ( ) ) ;
129- } , [ value , maximum , minimum , themometerDimensions , colors ] ) ;
129+ } , [ value , maximum , minimum , thermometerDimensions , colors ] ) ;
130130
131131 return (
132132 < Box
@@ -151,43 +151,43 @@ const ThermometerWidgetProps = {
151151} ;
152152
153153const drawThermometerPathOutline = (
154- themometerDimensions : ThermomemterDimensions
154+ thermometerDimensions : ThermometerDimensions
155155) => {
156156 const thermometerPath = d3 . path ( ) ;
157157
158158 // Start at the top-left of the tube
159159 thermometerPath . moveTo (
160- themometerDimensions . leftSideStemX ,
161- themometerDimensions . topOfStemY
160+ thermometerDimensions . leftSideStemX ,
161+ thermometerDimensions . topOfStemY
162162 ) ;
163163
164164 // Draw semi-circular top of the stem
165165 thermometerPath . arcTo (
166- themometerDimensions . leftSideStemX ,
167- themometerDimensions . topOfStemY - themometerDimensions . stemHalfWidth ,
168- themometerDimensions . bulbCenterX ,
169- themometerDimensions . topOfStemY - themometerDimensions . stemHalfWidth ,
170- themometerDimensions . stemHalfWidth
166+ thermometerDimensions . leftSideStemX ,
167+ thermometerDimensions . topOfStemY - thermometerDimensions . stemHalfWidth ,
168+ thermometerDimensions . bulbCenterX ,
169+ thermometerDimensions . topOfStemY - thermometerDimensions . stemHalfWidth ,
170+ thermometerDimensions . stemHalfWidth
171171 ) ;
172172 thermometerPath . arcTo (
173- themometerDimensions . rightSideStemX ,
174- themometerDimensions . topOfStemY - themometerDimensions . stemHalfWidth ,
175- themometerDimensions . rightSideStemX ,
176- themometerDimensions . topOfStemY ,
177- themometerDimensions . stemHalfWidth
173+ thermometerDimensions . rightSideStemX ,
174+ thermometerDimensions . topOfStemY - thermometerDimensions . stemHalfWidth ,
175+ thermometerDimensions . rightSideStemX ,
176+ thermometerDimensions . topOfStemY ,
177+ thermometerDimensions . stemHalfWidth
178178 ) ;
179179
180180 // Draw right side of stem
181181 thermometerPath . lineTo (
182- themometerDimensions . rightSideStemX ,
183- themometerDimensions . bottomOfStemY
182+ thermometerDimensions . rightSideStemX ,
183+ thermometerDimensions . bottomOfStemY
184184 ) ;
185185
186186 // Draw the bulb outline. Rotate angle by pi/2, to make relative to horizontal axis, rather than vertical.
187187 thermometerPath . arc (
188- themometerDimensions . bulbCenterX ,
189- themometerDimensions . bulbCenterY ,
190- themometerDimensions . bulbRadius ,
188+ thermometerDimensions . bulbCenterX ,
189+ thermometerDimensions . bulbCenterY ,
190+ thermometerDimensions . bulbRadius ,
191191 bulbStemAngle - Math . PI / 2 ,
192192 - bulbStemAngle - Math . PI / 2 ,
193193 false
@@ -197,24 +197,24 @@ const drawThermometerPathOutline = (
197197 return thermometerPath ;
198198} ;
199199
200- const drawMercuryBulbPath = ( themometerDimensions : ThermomemterDimensions ) => {
201- // very similar to the thermometer outline bulb, but corrected for half the width of the thermomemter outline.
200+ const drawMercuryBulbPath = ( thermometerDimensions : ThermometerDimensions ) => {
201+ // very similar to the thermometer outline bulb, but corrected for half the width of the thermometer outline.
202202 const mercuryBulbPath = d3 . path ( ) ;
203203
204204 const bulbTopRightX =
205- themometerDimensions . rightSideStemX -
206- themometerOutlineWidth * 0.5 * Math . cos ( bulbStemAngle ) ;
205+ thermometerDimensions . rightSideStemX -
206+ thermometerOutlineWidth * 0.5 * Math . cos ( bulbStemAngle ) ;
207207 const bulbTopRightY =
208- themometerDimensions . bottomOfStemY +
209- themometerOutlineWidth * 0.5 * Math . sin ( bulbStemAngle ) ;
208+ thermometerDimensions . bottomOfStemY +
209+ thermometerOutlineWidth * 0.5 * Math . sin ( bulbStemAngle ) ;
210210
211211 mercuryBulbPath . moveTo ( bulbTopRightX , bulbTopRightY ) ;
212212
213213 // Draw the bulb outline
214214 mercuryBulbPath . arc (
215- themometerDimensions . bulbCenterX ,
216- themometerDimensions . bulbCenterY ,
217- themometerDimensions . bulbRadius - themometerOutlineWidth * 0.5 ,
215+ thermometerDimensions . bulbCenterX ,
216+ thermometerDimensions . bulbCenterY ,
217+ thermometerDimensions . bulbRadius - thermometerOutlineWidth * 0.5 ,
218218 bulbStemAngle - Math . PI / 2 ,
219219 - bulbStemAngle - Math . PI / 2 ,
220220 false
@@ -224,13 +224,13 @@ const drawMercuryBulbPath = (themometerDimensions: ThermomemterDimensions) => {
224224 return mercuryBulbPath ;
225225} ;
226226
227- export const calculateThemometerDimensions = (
227+ export const calculateThermometerDimensions = (
228228 width : number ,
229229 height : number
230- ) : ThermomemterDimensions => {
230+ ) : ThermometerDimensions => {
231231 // allow padding around the thermometer
232- const innerWidth = width - themometerOutlineWidth ;
233- const innerHeight = height - themometerOutlineWidth - 2 ;
232+ const innerWidth = width - thermometerOutlineWidth ;
233+ const innerHeight = height - thermometerOutlineWidth - 2 ;
234234
235235 // Stem half width is minimum of 10 or a quarter of the innerWidth
236236 const stemHalfWidth = Math . min ( 10 , innerWidth * 0.25 ) ;
@@ -241,7 +241,7 @@ export const calculateThemometerDimensions = (
241241
242242 const verticalStemHeight =
243243 innerHeight - stemHalfWidth - bulbRadius - bulbUpperHeight ;
244- const topOfStemY = stemHalfWidth + 1 + 0.5 * themometerOutlineWidth ;
244+ const topOfStemY = stemHalfWidth + 1 + 0.5 * thermometerOutlineWidth ;
245245
246246 return {
247247 outerHeight : height ,
0 commit comments