File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/x-charts/src/ChartsTooltip Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
import HTMLElementType from '@mui/utils/HTMLElementType' ;
5
5
import useLazyRef from '@mui/utils/useLazyRef' ;
6
6
import { styled , useThemeProps } from '@mui/material/styles' ;
7
- import Popper , { PopperProps } from '@mui/material/Popper' ;
7
+ import Popper , { PopperPlacementType , PopperProps } from '@mui/material/Popper' ;
8
8
import NoSsr from '@mui/material/NoSsr' ;
9
9
import { useSvgRef } from '../hooks/useSvgRef' ;
10
10
import { AxisDefaultized } from '../models/axis' ;
@@ -131,7 +131,15 @@ function ChartsTooltipContainer(inProps: ChartsTooltipContainerProps) {
131
131
{
132
132
name : 'offset' ,
133
133
options : {
134
- offset : [ 0 , pointerType ?. pointerType === 'touch' ? 40 - pointerType . height : 0 ] ,
134
+ offset : ( { placement } : { placement : PopperPlacementType } ) => {
135
+ if ( pointerType ?. pointerType !== 'touch' ) {
136
+ return [ 0 , 0 ] ;
137
+ }
138
+
139
+ const isBottom = placement . startsWith ( 'bottom' ) ;
140
+ const placementOffset = isBottom ? 32 : 8 ;
141
+ return [ 0 , pointerType . height + placementOffset ] ;
142
+ } ,
135
143
} ,
136
144
} ,
137
145
] }
You can’t perform that action at this time.
0 commit comments