Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Navigation/VerticalScrollBar.cs @ 12503

Last change on this file since 12503 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7using Microsoft.Research.DynamicDataDisplay.Common;
8
9namespace Microsoft.Research.DynamicDataDisplay.Charts.Navigation
10{
11  [Obsolete("Working wrongly.", true)]
12  public sealed class VerticalScrollBar : PlotterScrollBar
13  {
14    /// <summary>
15    /// Initializes a new instance of the <see cref="VerticalScrollBar"/> class.
16    /// </summary>
17    public VerticalScrollBar()
18    {
19      ScrollBar.Orientation = Orientation.Vertical;
20    }
21
22    private Range<double> GetRange(Rect domain)
23    {
24      return new Range<double>(domain.Top, domain.Bottom);
25    }
26
27    protected override DataRect CreateVisibleRect(DataRect rect, double scrollValue)
28    {
29      rect.YMin = scrollValue;
30      return rect;
31    }
32
33    protected override Panel GetHostPanel(Plotter plotter)
34    {
35      return plotter.LeftPanel;
36    }
37
38    protected override void UpdateScrollBar(Viewport2D viewport)
39    {
40      if (viewport != null && !viewport.Domain.IsEmpty)
41      {
42        if (ScrollBar.Track != null)
43        {
44          //ScrollBar.Track.IsDirectionReversed = true;
45        }
46
47        visibleRange = new Range<double>(viewport.Visible.YMin, viewport.Visible.YMax);
48        domainRange = new Range<double>(viewport.Domain.YMin, viewport.Domain.YMax);
49
50        double size = visibleRange.Max - visibleRange.Min;
51        ScrollBar.ViewportSize = size;
52
53        ScrollBar.Minimum = domainRange.Min + size;
54        ScrollBar.Maximum = domainRange.Max;
55
56        ScrollBar.Value = visibleRange.Min;
57        ScrollBar.Visibility = Visibility.Visible;
58      }
59      else
60      {
61        ScrollBar.Visibility = Visibility.Collapsed;
62      }
63    }
64
65    private Range<double> visibleRange;
66    private Range<double> domainRange;
67  }
68}
Note: See TracBrowser for help on using the repository browser.