Setting `SurfaceViewer` scroll values in outside the `FrameUpdate` does not work as expected
AgrYpn1a opened this issue · 2 comments
AgrYpn1a commented
_gameWorld = new Console(Game.Instance.ScreenCellsX, SadConsole.Game.Instance.ScreenCellsY);
_gameWorld.FillWithRandomGarbage(5);
ControlsConsole cConsole = new ControlsConsole(40, 40);
_gameView = new SurfaceViewer(20, 20, _gameWorld);
cConsole.Controls.Add(_gameView);
container.Children.Add(cConsole);
// !!! Observe these lines !!!!
_gameView.Update(new TimeSpan(0)); // Need to call Update before, to initialize scrolls min / max values in order to work
_gameView.HorizontalScroller.Value = 5;
_gameView.VerticalScroller.Value = 5;
Thraka commented
Notes
- An initial update must be called on the
SurfaceViewer
control because the scroll bars haven't been configured to the correct min/max of the attached surface. This is confusing because you can't just create the control and work with it. The control itself should call an initial update so the theme and bar sizes are set for the user to work with right away. - The view of the surface should be movable without having to use the scroll bars. Currently you can set the
ChildSurface.ViewPosition
but the scrollbars won't follow it. This should be corrected.
Thraka commented
Fixed in v10