コード例 #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;
            }
        }
コード例 #8
0
        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();
        }
コード例 #9
0
 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
ファイル: TitleBar.xaml.cs プロジェクト: mike-ward/Loon
 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);
 }
コード例 #15
0
 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);
 }
コード例 #17
0
        private void LbViewVideoTutorials_PointerPressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
        {
            var startInfo = new ProcessStartInfo("explorer.exe", HelpLinks.VideoTutorials);

            Process.Start(startInfo);
        }
コード例 #18
0
ファイル: MainWindow.xaml.cs プロジェクト: Azyyyyyy/HATE
 public void recDrag_Pressed(object sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     this.BeginMoveDrag();
 }
コード例 #19
0
 private void ProgressSlider_PointerPressed(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     progressSliderIsBeingDragged = true;
     progressTimer.Stop();
 }
コード例 #20
0
ファイル: NavigationView.cs プロジェクト: lwqwag/Aura.UI
 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?");
 }