public void MenuButton_PointerLeave(object?sender, Avalonia.Input.PointerEventArgs e) { //if (sender is Control c) //{ // //var flyout = FlyoutBase.GetAttachedFlyout(c); // //flyout?.Hide(); // //IsPointerOverSubMenu = false; //} }
// Процесс выделения слова private static void GameWin_PointerMoved(object?sender, Avalonia.Input.PointerEventArgs e) { Cell cell = FindCellByCoords(e.GetPosition((Window)sender)); if (cell != null && MouseInfo.IsPressed && cell.Color == Settings.FieldColor) { cell.Color = Settings.PickedWordColor; Player.WordNow += cell.Letter; ((TextBlock)((StackPanel)((Grid)currentWindow.Content).Children[1]).Children[1]).Text = Player.WordNow; Player.CoordStory.Add(new int[] { cell.X, cell.Y }); } }
/// <summary> /// While moving the preview image, update the position. /// </summary> private void Preview_PointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { if (movingPreview) { Point p = e.GetPosition(gridPreview); int x = (int)Math.Floor((p.X - PREVIEW_MARGIN_LEFT) / 2 - imgPreview.Width / 4); tbxHandX.Text = x.ToString(); tbxHandX.InvalidateVisual(); int y = (int)Math.Floor((gridPreview.Height - p.Y - PREVIEW_MARGIN_BOTTOM) / 2 - imgPreview.Height / 4); tbxHandY.Text = y.ToString(); tbxHandY.InvalidateVisual(); } }
private void Window_Resize(object?sender, Avalonia.Input.PointerEventArgs e) { Point currentPosition = e.GetPosition(window); if (windowResizing && mouseDownPosition.DistanceTo(currentPosition) > 12) { windowScalingFactor = Math.Max(Math.Min(currentPosition.X / MainWindowWidthScalable.DefaultValue, currentPosition.Y / MainWindowHeightScalable.DefaultValue), minimumScaling); if (!windowNeedsRefresh) { windowNeedsRefresh = true; viewModel.IsResizing = true; } if (window.WindowState == WindowState.Maximized) { window.WindowState = WindowState.Normal; } MainWindowHeightScalable.ApplyScaling(windowScalingFactor); MainWindowWidthScalable.ApplyScaling(windowScalingFactor); } }
public async void MenuButton_PointerEnter(object?sender, Avalonia.Input.PointerEventArgs e) { if (sender is Control c && !IsPointerOverSubMenu) { if (c.Tag is TabItemViewModel tab && !tab.IsTaskBarSubMenu) { return; } var flyout = FlyoutBase.GetAttachedFlyout(c); await Task.Delay(500); if (flyout is not null && c.IsPointerOver && !IsPointerOverSubMenu) { flyout.ShowAt(c); IsPointerOverSubMenu = flyout.IsOpen; flyout.Closed += (sender, e) => IsPointerOverSubMenu = flyout.IsOpen; //c.Focus(); } } }
private void btnClose_PointerLeave(object sender, Avalonia.Input.PointerEventArgs e) { btnClose.Background = Brushes.Transparent; }
private void btnClose_PointerEnter(object sender, Avalonia.Input.PointerEventArgs e) { btnClose.Background = Brush.Parse("#FFE64747"); }