summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs
blob: 744003698ba8f2b637b1ba36e0f336e94e7a42a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SummaryView.xaml.cs" company="HandBrake Project (http://handbrake.fr)">
//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
//   Interaction logic for SummaryView.xaml
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace HandBrakeWPF.Views
{
    using System.Windows.Controls;
    using System.Windows.Input;

    using HandBrakeWPF.ViewModels.Interfaces;

    using Image = System.Windows.Controls.Image;
    using Point = System.Windows.Point;

    /// <summary>
    /// Interaction logic for SummaryView.xaml
    /// </summary>
    public partial class SummaryView : UserControl
    {
        public SummaryView()
        {
            this.InitializeComponent();
        }

        private void PreviewImage_OnMouseMove(object sender, MouseEventArgs e)
        {
            Image image = sender as Image;

            if (image != null && image.ActualWidth > 0)
            {
                Point p = Mouse.GetPosition(image);
                double width = image.ActualWidth / 2;

                bool leftHalf = p.X <= width;
                bool rightHalf = p.X > width;

                ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(leftHalf, rightHalf);
            }
        }
    }
}