public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null) { Children[0].Draw(batcher, new Point(position.X + Children[0].X, position.Y + Children[0].Y)); _rect.X = position.X; _rect.Y = position.Y; _rect.Width = Width - 14; _rect.Height = Height; Rectangle scissor = ScissorStack.CalculateScissors(batcher.TransformMatrix, _rect); if (ScissorStack.PushScissors(scissor)) { batcher.EnableScissorTest(true); int height = 0; int maxheight = _scrollBar.Value + Height; bool drawOnly1 = true; position = _rect.Location; for (int i = 1; i < Children.Count; i++) { Control child = Children[i]; if (!child.IsVisible) { continue; } child.Y = height - _scrollBar.Value /*+ (_isNormalScroll ? 20 : 0)*/; if (height + child.Height <= _scrollBar.Value) { // do nothing } else if (height + child.Height <= maxheight) { child.Draw(batcher, new Point(position.X + child.X, position.Y + child.Y)); } else { if (drawOnly1) { child.Draw(batcher, new Point(position.X + child.X, position.Y + child.Y)); drawOnly1 = false; } } height += child.Height; } batcher.EnableScissorTest(false); ScissorStack.PopScissors(); } return(true); }
public override bool Draw(Batcher2D batcher, int x, int y) { var scrollbar = Children[0]; scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y); Rectangle scissor = ScissorStack.CalculateScissors(batcher.TransformMatrix, x, y, Width - 14, Height); if (ScissorStack.PushScissors(scissor)) { batcher.EnableScissorTest(true); int height = 0; int maxheight = _scrollBar.Value + Height; bool drawOnly1 = true; for (int i = 1; i < Children.Count; i++) { Control child = Children[i]; if (!child.IsVisible) { continue; } child.Y = height - _scrollBar.Value /*+ (_isNormalScroll ? 20 : 0)*/; if (height + child.Height <= _scrollBar.Value) { // do nothing } else if (height + child.Height <= maxheight) { child.Draw(batcher, x + child.X, y + child.Y); } else { if (drawOnly1) { child.Draw(batcher, x + child.X, y + child.Y); drawOnly1 = false; } } height += child.Height; } batcher.EnableScissorTest(false); ScissorStack.PopScissors(); } return(true); }