@@ -4,7 +4,7 @@ import { Fragment } from "react";
44import { useTheme } from "./ThemeProvider" ;
55import { Annotations } from "./Annotation" ;
66
7- const DEFAULT_HEIGHT = 30
7+ const DEFAULT_HEIGHT = 20
88const DEFAULT_STROKE_WIDTH = 1
99
1010function SpectrogramAnnotations ( props : Annotations ) {
@@ -22,7 +22,8 @@ function SpectrogramAnnotations(props: Annotations) {
2222 }
2323 handleWindowResize ( )
2424 window . addEventListener ( 'resize' , handleWindowResize ) ;
25- } , [ ] ) ;
25+ setInterval ( handleWindowResize , 500 )
26+ } , [ ] ) ;
2627
2728
2829 const { startTime : zoomStartTime , endTime : zoomEndTime } = useZoom ( )
@@ -35,12 +36,12 @@ function SpectrogramAnnotations(props: Annotations) {
3536
3637 const svgFontSize = svgCanvasHeight * 0.67
3738 const svgStrokeWidth = 0.001 * strokeWidth * displayRange
38-
39+
3940 const textPosY = svgCanvasHeight * 0.67
4041
4142 return (
4243 < Fragment >
43- < span style = { { font : 'monospace' , color : annotationColor } } > { title } </ span >
44+ < div style = { { textAlign : 'left' , fontFamily : ' monospace', color : annotationColor } } > { title } </ div >
4445 < svg ref = { svgRef } width = "100%" height = { height } viewBox = { `${ zoomStartTime } ,0,${ displayRange } ,${ svgCanvasHeight } ` } preserveAspectRatio = "none" >
4546 { data . map ( ( annotation ) => {
4647 const start = Number ( annotation [ 0 ] )
@@ -49,7 +50,7 @@ function SpectrogramAnnotations(props: Annotations) {
4950 return (
5051 < Fragment key = { start } >
5152 < line stroke = { annotationColor } strokeWidth = { svgStrokeWidth } x1 = { start } x2 = { start } y1 = { 0 } y2 = { svgCanvasHeight } />
52- < text fill = { annotationColor } x = { start } y = { textPosY } fontSize = { svgFontSize } > { text } </ text >
53+ < text fill = { annotationColor } x = { start } y = { textPosY } fontSize = { svgFontSize } fontFamily = 'monospace' > { text } </ text >
5354 < line stroke = { annotationColor } strokeWidth = { svgStrokeWidth } x1 = { stop } x2 = { stop } y1 = { 0 } y2 = { svgCanvasHeight } />
5455 </ Fragment >
5556 )
0 commit comments