@@ -57,6 +57,7 @@ class CrosshairComponent extends React.Component<CrosshairProps> {
5757
5858 renderCursor ( ) {
5959 const {
60+ zIndex,
6061 theme : {
6162 crosshair : { band, line } ,
6263 } ,
@@ -72,15 +73,34 @@ class CrosshairComponent extends React.Component<CrosshairProps> {
7273 const { x1, x2, y1, y2 } = cursorPosition ;
7374 const { strokeWidth, stroke, dash } = line ;
7475 const strokeDasharray = ( dash ?? [ ] ) . join ( ' ' ) ;
75- return < line { ...{ x1, x2, y1, y2, strokeWidth, stroke, strokeDasharray } } /> ;
76+ return (
77+ < svg
78+ className = "echCrosshair__cursor"
79+ width = "100%"
80+ height = "100%"
81+ style = { { zIndex : cursorPosition && 'x1' in cursorPosition ? zIndex : undefined } }
82+ >
83+ < line { ...{ x1, x2, y1, y2, strokeWidth, stroke, strokeDasharray } } />
84+ </ svg >
85+ ) ;
7686 }
7787 const { x, y, width, height } = cursorPosition ;
7888 const { fill } = band ;
79- return < rect { ...{ x, y, width, height, fill } } /> ;
89+ return (
90+ < svg
91+ className = "echCrosshair__cursor"
92+ width = "100%"
93+ height = "100%"
94+ style = { { zIndex : cursorPosition && 'x1' in cursorPosition ? zIndex : undefined } }
95+ >
96+ < rect { ...{ x, y, width, height, fill } } /> ;
97+ </ svg >
98+ ) ;
8099 }
81100
82101 renderCrossLine ( ) {
83102 const {
103+ zIndex,
84104 theme : {
85105 crosshair : { crossLine } ,
86106 } ,
@@ -99,25 +119,18 @@ class CrosshairComponent extends React.Component<CrosshairProps> {
99119 strokeDasharray : ( dash ?? [ ] ) . join ( ' ' ) ,
100120 } ;
101121
102- return < line { ...cursorCrossLinePosition } { ...style } /> ;
122+ return (
123+ < svg className = "echCrosshair__crossLine" width = "100%" height = "100%" style = { { zIndex } } >
124+ < line { ...cursorCrossLinePosition } { ...style } />
125+ </ svg >
126+ ) ;
103127 }
104128
105129 render ( ) {
106- const { zIndex, cursorPosition } = this . props ;
107130 return (
108131 < >
109- < svg
110- className = "echCrosshair__cursor"
111- width = "100%"
112- height = "100%"
113- style = { { zIndex : cursorPosition && 'x1' in cursorPosition ? zIndex : undefined } }
114- >
115- { this . renderCursor ( ) }
116- </ svg >
117-
118- < svg className = "echCrosshair__crossLine" width = "100%" height = "100%" style = { { zIndex } } >
119- { this . renderCrossLine ( ) }
120- </ svg >
132+ { this . renderCursor ( ) }
133+ { this . renderCrossLine ( ) }
121134 </ >
122135 ) ;
123136 }
0 commit comments