void Refresh2()
{
float contentXLoc = (int)_xPos;
float contentYLoc = (int)_yPos;
if (_aniFlag == 1 && !_isMouseMoved)
{
float toX = _container.x;
float toY = _container.y;
if (_yOverlap > 0)
{
toY = -contentYLoc;
}
else
{
if (_container.y != 0)
_container.y = 0;
}
if (_xOverlap > 0)
{
toX = -contentXLoc;
}
else
{
if (_container.x != 0)
_container.x = 0;
}
if (toX != _container.x || toY != _container.y)
{
if (_tweener != null)
KillTween();
_tweener = DOTween.To(() => _container.xy, v => _container.xy = v, new Vector2(toX, toY), 0.5f)
.SetEase(Ease.OutCubic)
.SetUpdate(true)
.OnUpdate(__tweenUpdate)
.OnComplete(__tweenComplete);
_tweening = 1;
}
}
else
{
if (_tweener != null)
KillTween();
//如果在拖动的过程中Refresh,这里要进行处理,保证拖动继续正常进行
if (_isMouseMoved)
{
_xOffset += _container.x - (-contentXLoc);
_yOffset += _container.y - (-contentYLoc);
}
_container.SetXY(-contentXLoc, -contentYLoc);
//如果在拖动的过程中Refresh,这里要进行处理,保证手指离开是滚动正常进行
if (_isMouseMoved)
{
_y1 = _y2 = _container.y;
_x1 = _x2 = _container.x;
}
if (_vtScrollBar != null)
_vtScrollBar.scrollPerc = _yPerc;
if (_hzScrollBar != null)
_hzScrollBar.scrollPerc = _xPerc;
UpdateClipSoft();
}
}