Пример #1
0
        private void AssociatedObject_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            Point curPoint = e.GetPosition(AssociatedObject);
            bool  right    = curPoint.X > (AssociatedObject.Bounds.Width / 2);
            bool  bottom   = curPoint.Y > (AssociatedObject.Bounds.Height / 2);

            /*double h = (curPoint.X / AssociatedObject.Bounds.Width) / 100;
             * double v = (curPoint.Y / AssociatedObject.Bounds.Height) / 100;
             *
             *
             * _transform.Matrix = new Matrix(1 - Math.Abs(h - 0.5), v, h, 1 - Math.Abs(v - 0.5), 0, 0);
             * Debug.WriteLine("INFO: " + curPoint.ToString() + "\n" + _transform.Matrix.ToString());
             *
             * //NO TRANSLATION MATRIX: { {M11:1 M12:0} {M21:0 M22:1} {M31:0 M32:0} }
             */
            if (right == bottom)
            {
                _skewTransform.AngleX = -1;
                _skewTransform.AngleY = -1;
            }
            else
            {
                _skewTransform.AngleX = 1;
                _skewTransform.AngleY = 1;
            }
            Debug.WriteLine("MATRIX: " + _skewTransform.Value.ToString());
            _scaleTransform.ScaleX = (AssociatedObject.Bounds.Width - Math.Abs(_skewTransform.Value.M21 * 10)) / AssociatedObject.Bounds.Width;
            _scaleTransform.ScaleY = (AssociatedObject.Bounds.Height - Math.Abs(_skewTransform.Value.M12 * 10)) / AssociatedObject.Bounds.Height;
            //_scaleTransform.Value.
            //_scaleTransform.ScaleX = AssociatedObject.Bounds.Width / (_skewTransform.AngleX / AssociatedObject.Bounds.Width);
            //Matrix.CreateSkew(Matrix.ToRadians)

            //_scaleTransform.ScaleY = AssociatedObject.Bounds.Height / AssociatedObject.TransformedBounds.Value.Bounds.Height;
        }
Пример #2
0
 private void SessionIndicatorWindow_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if (e.GetCurrentPoint(this).Properties.PointerUpdateKind == Avalonia.Input.PointerUpdateKind.LeftButtonPressed)
     {
         BeginMoveDrag(e);
     }
 }
Пример #3
0
 private void TitleBanner_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if (e.MouseButton == Avalonia.Input.MouseButton.Left)
     {
         this.BeginMoveDrag();
     }
 }
Пример #4
0
 private void TitleBanner_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if (e.GetCurrentPoint(this).Properties.PointerUpdateKind == Avalonia.Input.PointerUpdateKind.LeftButtonPressed)
     {
         this.BeginMoveDrag(e);
     }
 }
Пример #5
0
 private void OnPointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if ((sender as Border)?.DataContext is not string ctx)
     {
         throw new Exception("Sample not found");
     }
     LoadContent(ctx.Replace('/', '.'));
 }
Пример #6
0
 private void _listBox_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if (ViewModel.IsUnlockDatabase || ViewModel.SelectedIndex != -1)
     {
         ViewModel.SelectedIndex = -1;
         ViewModel.Router.Navigate.Execute(new StartPageViewModel());
     }
 }
Пример #7
0
        private void TitleBar_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            BeginMoveDrag(e);

            if (WindowState == WindowState.Maximized)
            {
                WindowState = WindowState.Normal;
            }
        }
        private void OnPointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            var content = this.FindControl <ContentControl>("content");

            if ((sender as Border)?.DataContext is not string ctx)
            {
                throw new Exception("Sample not found");
            }
            content.Content = Activator.CreateInstance(null, $"AvaloniaSample.{ctx.Replace('/', '.')}.View")?.Unwrap();
        }
 private void App_PointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     if (e.Source is Control c)
     {
         var border = c.FindParentControl <Border>("AppAvatar");
         if (border is not null)
         {
             var flyout = FlyoutBase.GetAttachedFlyout(border);
             flyout?.ShowAt(border, true);
         }
     }
 }
Пример #10
0
        // Начало выделения слова
        private static void GameWin_PointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            Cell cell = FindCellByCoords(e.GetPosition((Window)sender));

            if (cell != null && cell.Color == Settings.FieldColor)
            {
                cell.Color          = Settings.PickedWordColor;
                MouseInfo.IsPressed = true;
                Player.WordNow     += cell.Letter;
                ((TextBlock)((StackPanel)((Grid)currentWindow.Content).Children[1]).Children[1]).Text = Player.WordNow;
                Player.CoordStory = new List <int[]> {
                    new int[] { cell.X, cell.Y }
                };
            }
        }
Пример #11
0
        private void labPointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            switch (((TextBlock)sender).Name)
            {
            case "labGarbleText":
                chbGarbleText.IsChecked = !chbGarbleText.IsChecked;
                chbGarbleText.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labHitboxFix":
                chbHitboxFix.IsChecked = !chbHitboxFix.IsChecked;
                chbHitboxFix.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labShowSeed":
                chbShowSeed.IsChecked = !chbShowSeed.IsChecked;
                chbShowSeed.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labShuffleAudio":
                chbShuffleAudio.IsChecked = !chbShuffleAudio.IsChecked;
                chbShuffleAudio.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labShuffleFonts":
                chbShuffleFonts.IsChecked = !chbShuffleFonts.IsChecked;
                chbShuffleFonts.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labShuffleGFX":
                chbShuffleGFX.IsChecked = !chbShuffleGFX.IsChecked;
                chbShuffleGFX.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labShuffleSprites":
                chbShuffleSprites.IsChecked = !chbShuffleSprites.IsChecked;
                chbShuffleSprites.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;

            case "labShuffleText":
                chbShuffleText.IsChecked = !chbShuffleText.IsChecked;
                chbShuffleText.RaiseEvent(new RoutedEventArgs(CheckBox.ClickEvent));
                break;
            }
        }
Пример #12
0
        protected override void OnPointerPressed(Avalonia.Input.PointerPressedEventArgs e)
        {
            base.OnPointerPressed(e);
            var point = e.GetCurrentPoint(this);
            var pos   = e.GetPosition(this);


            float scaling = 3;

            var pointerX = point.Position.X / scaling;
            var pointerY = point.Position.Y / scaling;
            var note     = _diagramRenderer.GetNoteAtPoint(pointerX, pointerY);

            if (note != null)
            {
                _diagramRenderer.HighlightNote(note.Value);
                //Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Render);

                System.Diagnostics.Debug.WriteLine($"Fret:{note.Value.FretNumber} String:{note.Value.StringNumber + 1} Note:{note.Value.Note.ToString()}");
                this.Width -= 0.0001;
            }
        }
Пример #13
0
 public void BeginMoveDrag(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     App.MainWindow.BeginMoveDrag(e);
 }
Пример #14
0
 /// <summary>
 /// Start tracking movement.
 /// </summary>
 private void Preview_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     movingPreview = true;
     Preview_PointerMoved(sender, e);
 }
 private void Window_BeginResize(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     windowResizing    = true;
     mouseDownPosition = e.GetPosition((Window)sender);
 }
Пример #16
0
 private void Drag_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     this.BeginMoveDrag(e);
 }
        private void LbViewVideoTutorials_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            var startInfo = new ProcessStartInfo("explorer.exe", HelpLinks.VideoTutorials);

            Process.Start(startInfo);
        }
Пример #18
0
 public void recDrag_Pressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     this.BeginMoveDrag();
 }
 private void ProgressSlider_PointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     progressSliderIsBeingDragged = true;
     progressTimer.Stop();
 }
Пример #20
0
 private void ToggleNav_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     ToggleNavigationViewExpansionState(this);
 }
Пример #21
0
 private void _tree_PointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     Console.WriteLine("It works?");
 }