public void VoidShouldShowSearchBar() { var newValue = AtStartOfList || LastScrollDirection == ScrollToStart; var shouldChange = (!_lastShowValue.HasValue) || (_lastShowValue.Value != newValue && _nextShowChange < DateTime.Now); if (shouldChange) { _lastShowValue = newValue; _nextShowChange = DateTime.Now.AddMilliseconds(250); } var IsVisibleTopBar = shouldChange ? newValue : _lastShowValue.Value; ScrollChange?.Invoke(this, !IsVisibleTopBar); }
protected void SetScale() { if (font == null) { return; } float heightScale = (float)Bounds.Height / (6 + LineHeight * Lines.Count); //Bounds.Width / Max line width float widthScale = Bounds.Width / Lines.Concat(new List <IDrawableText> { new PlainText("") }).Max(line => line.Size(font).X); Scale = Utils.Lowest(heightScale, widthScale, DefaultScale); //smaller scale so it fits. clamp at DefaultScale ScrollChange?.Invoke(); }