Mobile tooltip isn't occluded by finger anymore
This commit is contained in:
		
							parent
							
								
									8aaca848b2
								
							
						
					
					
						commit
						3390c34d0a
					
				|  | @ -233,8 +233,9 @@ export const SVGChart = <X, TT>(props: { | ||||||
|             ttParams.y, |             ttParams.y, | ||||||
|             innerW, |             innerW, | ||||||
|             innerH, |             innerH, | ||||||
|             tooltipMeasure.width, |             tooltipMeasure.width ?? 140, | ||||||
|             tooltipMeasure.height |             tooltipMeasure.height ?? 35, | ||||||
|  |             isMobile ?? false | ||||||
|           )} |           )} | ||||||
|         > |         > | ||||||
|           <Tooltip |           <Tooltip | ||||||
|  | @ -290,23 +291,28 @@ export const getTooltipPosition = ( | ||||||
|   mouseY: number, |   mouseY: number, | ||||||
|   containerWidth: number, |   containerWidth: number, | ||||||
|   containerHeight: number, |   containerHeight: number, | ||||||
|   tooltipWidth?: number, |   tooltipWidth: number, | ||||||
|   tooltipHeight?: number |   tooltipHeight: number, | ||||||
|  |   isMobile: boolean | ||||||
| ) => { | ) => { | ||||||
|   let left = mouseX + 12 |   let left = mouseX + 12 | ||||||
|   let bottom = containerHeight - mouseY + 12 |   let bottom = !isMobile | ||||||
|  |     ? containerHeight - mouseY + 12 | ||||||
|  |     : containerHeight - tooltipHeight + 12 | ||||||
|   if (tooltipWidth != null) { |   if (tooltipWidth != null) { | ||||||
|     const overflow = left + tooltipWidth - containerWidth |     const overflow = left + tooltipWidth - containerWidth | ||||||
|     if (overflow > 0) { |     if (overflow > 0) { | ||||||
|       left -= overflow |       left -= overflow | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|   if (tooltipHeight != null) { |   if (tooltipHeight != null) { | ||||||
|     const overflow = tooltipHeight - mouseY |     const overflow = tooltipHeight - mouseY | ||||||
|     if (overflow > 0) { |     if (overflow > 0) { | ||||||
|       bottom -= overflow |       bottom -= overflow | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|   return { left, bottom } |   return { left, bottom } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user