override public void Apply() { _applying = true; Vector2 pt; if (connected) { pt = (Vector2)_storage[_controller.selectedPageId]; if (pt == null) { pt = (Vector2)(_default); } } else { pt = (Vector2)_default; } if (pt != null) { if (_tweener != null) { if (_tweener != null) { _tweener.Cancel(); } _tweener = Glide.Tweener.Tween(_owner, new { width = pt.x, height = pt.y }, _tweenTime, 0.0f); _tweener.OnComplete(() => { _applying = false; _tweener = null; } ); Func <float, float> func; if (Ease.EaseFunctions.TryGetValue(_tween, out func)) { _tweener.Ease(func); } return; } else { _owner.SetSize((int)((Vector2)pt).x, (int)((Vector2)pt).y); } } _applying = false; }
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; }