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