示例#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 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 }
                };
            }
        }
示例#3
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;
            }
        }
 private void Window_BeginResize(object?sender, Avalonia.Input.PointerPressedEventArgs e)
 {
     windowResizing    = true;
     mouseDownPosition = e.GetPosition((Window)sender);
 }