mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 20:58:47 +00:00
[optimaze][tooltip] content rect limit (#202)
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2022.06.20) 优化`Tooltip`的边界限制 (#202)
|
||||
* (2022.06.20) 修复`TextMeshPro`开启时编译错误
|
||||
* (2022.06.20) 修复`Animation`的渐出动画不生效的问题
|
||||
|
||||
## v3.0.1
|
||||
|
||||
@@ -64,13 +64,18 @@ namespace XCharts.Runtime
|
||||
var pos = tooltip.view.GetTargetPos();
|
||||
if (pos.x + tooltip.context.width > chartRect.x + chartRect.width)
|
||||
{
|
||||
//pos.x = chartRect.x + chartRect.width - tooltip.context.width;
|
||||
pos.x = pos.x - tooltip.context.width - tooltip.offset.x;
|
||||
pos.x = tooltip.context.pointer.x - tooltip.context.width - tooltip.offset.x;
|
||||
}
|
||||
else if (pos.x < chartRect.x)
|
||||
{
|
||||
pos.x = tooltip.context.pointer.x - tooltip.context.width + Mathf.Abs(tooltip.offset.x);
|
||||
}
|
||||
if (pos.y - tooltip.context.height < chartRect.y)
|
||||
{
|
||||
pos.y = chartRect.y + tooltip.context.height;
|
||||
}
|
||||
if (pos.y > chartRect.y + chartRect.height)
|
||||
pos.y = chartRect.y + chartRect.height;
|
||||
tooltip.UpdateContentPos(pos);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user