Esempio n. 1
0
        private void Refresh(object obj = null)
        {
            if (_isMouseMoved)
            {
                _owner.appContext.timers.AddByFrame(1, 1, Refresh);
                return;
            }
            float contentYLoc;
            float contentXLoc;

            contentYLoc = _yPerc * (_contentHeight - _maskHeight);
            contentXLoc = _xPerc * (_contentWidth - _maskWidth);

            if (_aniFlag)
            {
                float toX = _maskContentHolder.x, toY = _maskContentHolder.y;

                if (_vScroll)
                {
                    toY = -contentYLoc;
                }
                else
                {
                    if (_maskContentHolder.y != 0)
                    {
                        _maskContentHolder.y = 0;
                    }
                }
                if (_hScroll)
                {
                    toX = -contentXLoc;
                }
                else
                {
                    if (_maskContentHolder.x != 0)
                    {
                        _maskContentHolder.x = 0;
                    }
                }

                if (toX != _maskContentHolder.x || toY != _maskContentHolder.y)
                {
                    _maskHolder.mouseEnabled = false;
                    if (_tweener != null)
                    {
                        _tweener.Cancel();
                    }
                    _tweener = Glide.Tweener.Tween(_maskContentHolder,
                                                   new { x = toX, y = toY }, 0.5f, 0.0f);
                    _tweener.OnUpdate(__tweenUpdate);
                    _tweener.OnComplete(__tweenComplete);
                    _tweener.Ease(_easeTypeFunc);
                }
            }
            else
            {
                if (_tweener != null)
                {
                    _tweener.Cancel();
                    _tweener = null;
                }
                if (_vScroll)
                {
                    _maskContentHolder.y = -contentYLoc;
                }
                else
                {
                    _maskContentHolder.y = 0;
                }
                if (_hScroll)
                {
                    _maskContentHolder.x = -contentXLoc;
                }
                else
                {
                    _maskContentHolder.x = 0;
                }
                if (_vtScrollBar != null)
                {
                    _vtScrollBar.scrollPerc = _yPerc;
                }
                if (_hzScrollBar != null)
                {
                    _hzScrollBar.scrollPerc = _xPerc;
                }
            }

            _aniFlag = true;
        }