Browse Source

Fixed ScrollViewer maths.

pull/4/head
Steven Kirk 11 years ago
parent
commit
9ca5b930c7
  1. 8
      Perspex.Controls/ScrollViewer.cs

8
Perspex.Controls/ScrollViewer.cs

@ -66,11 +66,11 @@ namespace Perspex.Controls
this.horizontalScrollBar.Bind( this.horizontalScrollBar.Bind(
ScrollBar.MaximumProperty, ScrollBar.MaximumProperty,
extentAndViewport.Select(x => x.Extent.Width)); extentAndViewport.Select(x => x.Extent.Width - x.Viewport.Width));
this.horizontalScrollBar.Bind( this.horizontalScrollBar.Bind(
ScrollBar.ViewportSizeProperty, ScrollBar.ViewportSizeProperty,
extentAndViewport.Select(x => x.Viewport.Width)); extentAndViewport.Select(x => (x.Viewport.Width / x.Extent.Width) * (x.Extent.Width - x.Viewport.Width)));
this.verticalScrollBar.Bind( this.verticalScrollBar.Bind(
IsVisibleProperty, IsVisibleProperty,
@ -78,11 +78,11 @@ namespace Perspex.Controls
this.verticalScrollBar.Bind( this.verticalScrollBar.Bind(
ScrollBar.MaximumProperty, ScrollBar.MaximumProperty,
extentAndViewport.Select(x => x.Extent.Height)); extentAndViewport.Select(x => x.Extent.Height - x.Viewport.Height));
this.verticalScrollBar.Bind( this.verticalScrollBar.Bind(
ScrollBar.ViewportSizeProperty, ScrollBar.ViewportSizeProperty,
extentAndViewport.Select(x => x.Viewport.Height)); extentAndViewport.Select(x => (x.Viewport.Height / x.Extent.Height) * (x.Extent.Height - x.Viewport.Height)));
var offset = Observable.CombineLatest( var offset = Observable.CombineLatest(
this.horizontalScrollBar.GetObservable(ScrollBar.ValueProperty), this.horizontalScrollBar.GetObservable(ScrollBar.ValueProperty),

Loading…
Cancel
Save