mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 10:20:10 +00:00
优化Chart放在ScrollView下时不影响ScrollView的滚动和拖动
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.07.17) Optimize `Chart` under `ScrollView` without affecting the scrolling and dragging of `ScrollView`.
|
||||||
|
* (2020.07.16) Fixed a problem with `Tooltip` that would also show up if it was blocked on top. #74
|
||||||
|
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`轴#70
|
||||||
* (2020.07.07) 修复`SerieLabel`位置错乱的问题
|
* (2020.07.07) 修复`SerieLabel`位置错乱的问题
|
||||||
* (2020.07.07) 增加`Tooltip`的`offset`参数配置偏移
|
* (2020.07.07) 增加`Tooltip`的`offset`参数配置偏移
|
||||||
* (2020.07.06) 增加`LiquidChart`水位图
|
* (2020.07.06) 增加`LiquidChart`水位图
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
* (2020.07.16) Fixed a problem with `Tooltip` that would also show up if it was blocked on top. #74
|
* (2020.07.17) 优化`Chart`放在`ScrollView`下时不影响`ScrollView`的滚动和拖动
|
||||||
修复`Tooltip`在上层有遮挡还会显示的问题#74
|
* (2020.07.16) 修复`Tooltip`在上层有遮挡还会显示的问题#74
|
||||||
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`轴#70
|
* (2020.07.08) 优化`Scatter`类型`Serie`支持`Log`轴#70
|
||||||
* (2020.07.07) 修复`SerieLabel`位置错乱的问题
|
* (2020.07.07) 修复`SerieLabel`位置错乱的问题
|
||||||
* (2020.07.07) 增加`Tooltip`的`offset`参数配置偏移
|
* (2020.07.07) 增加`Tooltip`的`offset`参数配置偏移
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ namespace XCharts
|
|||||||
raycastTarget = false;
|
raycastTarget = false;
|
||||||
m_CheckTheme = m_ThemeInfo.theme;
|
m_CheckTheme = m_ThemeInfo.theme;
|
||||||
m_LastLocalPosition = transform.localPosition;
|
m_LastLocalPosition = transform.localPosition;
|
||||||
|
CheckIsInScrollRect();
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
InitComponent();
|
InitComponent();
|
||||||
m_Series.AnimationReset();
|
m_Series.AnimationReset();
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ namespace XCharts
|
|||||||
protected Vector2 chartPivot { get { return m_GraphPivot; } }
|
protected Vector2 chartPivot { get { return m_GraphPivot; } }
|
||||||
protected HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
|
protected HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
|
||||||
|
|
||||||
|
private ScrollRect m_ScrollRect;
|
||||||
|
|
||||||
|
|
||||||
protected virtual void InitComponent()
|
protected virtual void InitComponent()
|
||||||
{
|
{
|
||||||
@@ -63,6 +65,7 @@ namespace XCharts
|
|||||||
m_LastLocalPosition = transform.localPosition;
|
m_LastLocalPosition = transform.localPosition;
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
InitComponent();
|
InitComponent();
|
||||||
|
CheckIsInScrollRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Start()
|
protected override void Start()
|
||||||
@@ -180,6 +183,11 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void CheckIsInScrollRect()
|
||||||
|
{
|
||||||
|
m_ScrollRect = GetComponentInParent<ScrollRect>();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual bool IsNeedCheckPointerPos()
|
protected virtual bool IsNeedCheckPointerPos()
|
||||||
{
|
{
|
||||||
return raycastTarget;
|
return raycastTarget;
|
||||||
@@ -247,21 +255,25 @@ namespace XCharts
|
|||||||
|
|
||||||
public virtual void OnBeginDrag(PointerEventData eventData)
|
public virtual void OnBeginDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData);
|
||||||
if (m_OnBeginDrag != null) m_OnBeginDrag(this, eventData);
|
if (m_OnBeginDrag != null) m_OnBeginDrag(this, eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnEndDrag(PointerEventData eventData)
|
public virtual void OnEndDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData);
|
||||||
if (m_OnEndDrag != null) m_OnEndDrag(this, eventData);
|
if (m_OnEndDrag != null) m_OnEndDrag(this, eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnDrag(PointerEventData eventData)
|
public virtual void OnDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData);
|
||||||
if (m_OnDrag != null) m_OnDrag(this, eventData);
|
if (m_OnDrag != null) m_OnDrag(this, eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnScroll(PointerEventData eventData)
|
public virtual void OnScroll(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData);
|
||||||
if (m_OnScroll != null) m_OnScroll(this, eventData);
|
if (m_OnScroll != null) m_OnScroll(this, eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user