mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-19 23:10:06 +00:00
[optimaze][tooltip] content rect limit (#202)
This commit is contained in:
@@ -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