// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Interaction logic for SummaryView.xaml // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Views { using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using HandBrakeWPF.ViewModels.Interfaces; using Image = System.Windows.Controls.Image; using Point = System.Windows.Point; /// /// Interaction logic for SummaryView.xaml /// 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); } } private void PreviewImage_OnMouseLeave(object sender, MouseEventArgs e) { HitTestResult result = VisualTreeHelper.HitTest(this.previewImage, e.GetPosition(this.previewImage)); if (result != null && result.VisualHit.GetType() == typeof(Image)) { e.Handled = true; return; } ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(false, false); } } }