Пример #1
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (args.Button != MouseButton.Left)
            {
                return(false);
            }

            logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out);
            return(true);
        }
Пример #2
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (!Interactive)
            {
                return(false);
            }

            logoBounceContainer.ScaleTo(0.9f, 1000, EasingTypes.Out);
            return(true);
        }
Пример #3
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (textInput?.ImeActive == true) return true;

            selectionStart = selectionEnd = getCharacterClosestTo(state.Mouse.Position);

            cursorAndLayout.Invalidate();

            return false;
        }
Пример #4
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (shouldPerformRightMouseScroll(state))
            {
                scrollToRelative(state.Mouse.Position[ScrollDim]);
                return(true);
            }

            return(base.OnMouseDown(state, args));
        }
Пример #5
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (base.OnMouseDown(state, args))
            {
                beginUserDrag();
                return(true);
            }

            return(false);
        }
Пример #6
0
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.Position == null)
            {
                throw new ArgumentException($"The {e.Position} of {nameof(MouseDownEventArgs)} can't be null.");
            }


            e.Handled = true;

            if (CanvasContext.ActiveLayer == null)
            {
                throw new InvalidOperationException($"The {CanvasContext.ActiveLayer} of {nameof(ICanvasContextEx )} can't be null.");
            }

            var thisPosition = e.Position;

            if (thisPosition == null)
            {
                return;
            }

            //若上次按下位置为空,则记录新的点;
            if (_lastMouseDownPosition == null)
            {
                _lastMouseDownPosition = thisPosition;
            }
            //否则将创建一个新的矩形;
            else
            {
                //若对角线两端的横坐标或纵坐标相等,将不能构成一个矩形;
                if (_lastMouseDownPosition.X == thisPosition.X || _lastMouseDownPosition.Y == thisPosition.Y)
                {
                    return;
                }

                //根据四个顶点创建矩形;
                var middleLineY = (thisPosition.Y + _lastMouseDownPosition.Y) / 2;
                var rect2D      = new Rectangle2D2(
                    new Line2D(
                        new Vector2D(_lastMouseDownPosition.X, middleLineY),
                        new Vector2D(thisPosition.X, middleLineY)
                        ),
                    Math.Abs(thisPosition.Y - _lastMouseDownPosition.Y)
                    );
                var rect = new Rectangle(rect2D);
                AddDrawObjectToUndoStack(rect);
                _lastMouseDownPosition = null;
            }
        }
Пример #7
0
        private bool handleMouseDown(InputState state, MouseButton button)
        {
            MouseDownEventArgs args = new MouseDownEventArgs
            {
                Button = button
            };

            mouseDownInputQueue = new List <Drawable>(positionalInputQueue);

            return(PropagateMouseDown(positionalInputQueue, state, args));
        }
Пример #8
0
        private bool handleMouseDown(InputState state, MouseButton button)
        {
            MouseDownEventArgs args = new MouseDownEventArgs
            {
                Button = button
            };

            mouseDownInputQueue = new List <Drawable>(mouseInputQueue);

            return(mouseInputQueue.Find(target => target.TriggerOnMouseDown(state, args)) != null);
        }
Пример #9
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            var t = metadata.Value?.Track;

            if ((t?.IsLoaded ?? false) && IsHovered && state.Mouse.IsPressed(MouseButton.Left))
            {
                dragged = true;
                t.Stop();
                TriggerOnMouseMove(state);
            }
            return(true);
        }
Пример #10
0
        private bool handleMouseDown(InputState state, MouseButton button)
        {
            MouseDownEventArgs args = new MouseDownEventArgs
            {
                Button = button
            };

            var result = PropagateMouseDown(positionalInputQueue, state, args, out Drawable handledBy);

            mouseDownInputQueue = new List <Drawable>(result ? positionalInputQueue.Take(positionalInputQueue.IndexOf(handledBy) + 1) : positionalInputQueue);

            return(result);
        }
Пример #11
0
        //TODO: NOT RUNNING
        private bool mHook_OnMouseLeftButtonDown(object sender, MouseDownEventArgs e)
        {
            if (Helper.WinAPI.PInvoke.GetForegroundWindow() == Master)
            {
                foreach (var slave in Slaves)
                {
                    //Mouse.Sender.MouseDown(slave, e.Button, e.WindowPoint.X, e.WindowPoint.Y);
                    LogCallback(string.Format("Mouse down : {0} ({1};{2}). Sended to 0x{3:X}", e.Button, e.WindowPoint.X, e.WindowPoint.Y, slave.ToInt32()), RichLogTextBox.OutputMode.Debug);
                }
            }

            return(true);
        }
Пример #12
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            switch (args.Button)
            {
            case MouseButton.Left:
                SelectNext();
                break;

            case MouseButton.Right:
                SelectPrevious();
                break;
            }
            return(true);
        }
Пример #13
0
            protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
            {
                if (args.Button != MouseButton.Left)
                {
                    return(false);
                }

                //note that we are changing the colour of the box here as to not interfere with the hover effect.
                box.FadeColour(highlightColour, 100);

                dragOffset = Position[scrollDim];
                Dragged?.Invoke(dragOffset);
                return(true);
            }
Пример #14
0
        bool hook_OnMouseLeftButtonDown(object sender, MouseDownEventArgs e)
        {
            Output("\r\n{0}: Down" +
                   "\r\n  On Screen :" +
                   "\r\n    ({1}; {2})" +
                   "\r\n  On Window {3} :" +
                   "\r\n    ({4}; {5})",
                   e.Button, e.ScreenPoint.X, e.ScreenPoint.Y, PInvoke.GetText(e.WindowHandle), e.WindowPoint.X, e.WindowPoint.Y);

            //Sender.Click(IntPtr.Zero, e.Button, e.WindowPoint.X, e.WindowPoint.Y);


            return(true);
        }
Пример #15
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            ActiveCursor.Scale = new Vector2(1);
            ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint);

            ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0;
            ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);

            if (args.Button == MouseButton.Left && cursorRotate)
            {
                dragRotationState = DragRotationState.DragStarted;
                positionMouseDown = state.Mouse.Position;
            }
            return(base.OnMouseDown(state, args));
        }
Пример #16
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            startPosition = Position;

            if (args.Button == MouseButton.Left && AllowLeftClickDrag)
            {
                leftDown = true;
            }

            if (args.Button == MouseButton.Right)
            {
                rightDown = true;
            }

            return(base.OnMouseDown(state, args));
        }
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.Button != MouseButton.Left)
            {
                return;
            }


            e.Handled = true;

            //记录本次鼠标按下的位置;
            ApplyMouseDownPosition(e.Position);
        }
        private void EditTool_CanvasPreviewMouseDown(object sender, MouseDownEventArgs e)
        {
            if (!(sender is EditTool editTool))
            {
                return;
            }

            if (editTool.CanvasContext.ActiveLayer == null)
            {
                return;
            }

            if (!editTool.CanvasContext.ActiveLayer.IsVisible)
            {
                MsgBoxService.Show(LanguageService.FindResourceString(Exception_UnVisibleLayerNotInteractable));
                e.Handled = true;
            }
        }
Пример #19
0
            protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
            {
                repeatDelegate?.Cancel();

                if (args.Button == MouseButton.Left)
                {
                    if (!base.OnClick(state))
                    {
                        return(false);
                    }

                    repeatDelegate = Scheduler.AddDelayed(() => { repeatDelegate = Scheduler.AddDelayed(() => base.OnClick(state), 100, true); }, 300);

                    return(true);
                }

                return(false);
            }
Пример #20
0
        /// <summary>
        /// 鼠标按下时,将<see cref="MousePositionTracker.LastMouseDownPosition"/>与
        /// <see cref="MousePositionTracker.CurrentHoverPosition"/>设置为<paramref name="e"/>的位置;
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.Button != MouseButton.Left)
            {
                return;
            }

            var thisPosition = e.Position;

            MousePositionTracker.SetBothMousePositions(thisPosition, true);
            RaiseVisualChanged();
            base.OnMouseDown(e);
        }
Пример #21
0
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            //需指定为左键;
            if (e.Button != MouseButton.Left)
            {
                return;
            }

            var thisMouseDownPosition = e.Position;

            //若上次按下为空,则为首次按下鼠标;
            if (MousePositionTracker.LastMouseDownPosition == null)
            {
                ///若Control键被按下,则不处理;
                if (CheckIsContrlKeyDown())
                {
                    return;
                }

                SyncSelectedDrawObjectsToCopiedCells();
                //记录为上次鼠标按下的位置;
                MousePositionTracker.LastMouseDownPosition = thisMouseDownPosition;
            }
            //否则,在本次编辑栈内,应用复制对象;
            else
            {
                ApplyCurrentPositionState(thisMouseDownPosition);

                MousePositionTracker.LastMouseDownPosition = null;
                MousePositionTracker.CurrentHoverPosition  = null;
                e.Handled = true;
            }

            RaiseVisualChanged();

            RaiseCanUndoRedoChanged();

            base.OnMouseDown(e);
        }
Пример #22
0
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            var thisPosition = e.Position;

            //若上次点击位置为空,则记录点击位置;
            if (MousePositionTracker.LastMouseDownPosition == null)
            {
                if (thisPosition.IsAlmostEqualTo(Ellipse2D.Center))
                {
                    MousePositionTracker.LastMouseDownPosition = thisPosition;
                }
                else if (thisPosition.IsAlmostEqualTo(Ellipse2D.GetTopPoint()) ||
                         thisPosition.IsAlmostEqualTo(Ellipse2D.GetBottomPoint()) ||
                         thisPosition.IsAlmostEqualTo(Ellipse2D.GetLeftPoint()) ||
                         thisPosition.IsAlmostEqualTo(Ellipse2D.GetRightPoint()))
                {
                    MousePositionTracker.LastMouseDownPosition = thisPosition;
                }
                else
                {
                    return;
                }

                e.Handled = true;
            }
            //否则将应用更改;
            else if (MousePositionTracker.CurrentHoverPosition != null)
            {
                var newEllipse = GetPreviewEllipse2D();
                if (newEllipse != null)
                {
                    Ellipse2D = newEllipse;
                }

                MousePositionTracker.Reset(true);

                e.Handled = true;
            }
        }
Пример #23
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (dragStatus != DragStatus.None)
            {
                return(false);
            }

            if (shouldPerformRelativeDrag(state))
            {
                scrollToRelative(state.Mouse.Position[scrollDim]);
            }
            else
            {
                // Continue from where we currently are scrolled to.
                target = Current;
            }

            return(true);
        }
Пример #24
0
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (CanvasContext.ActiveLayer == null)
            {
                throw new InvalidOperationException();
            }

            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            e.Handled = true;

            var pointPosition = e.Position;
            var point         = new Point(pointPosition);

            AddDrawObjectToUndoStack(point);
        }
Пример #25
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            // only trigger animation for main mouse buttons
            if (args.Button <= MouseButton.Right)
            {
                activeCursor.Scale = new Vector2(1);
                activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint);

                activeCursor.AdditiveLayer.Alpha = 0;
                activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
            }

            if (args.Button == MouseButton.Left && cursorRotate)
            {
                dragRotationState = DragRotationState.DragStarted;
                positionMouseDown = state.Mouse.Position;
            }
            return(base.OnMouseDown(state, args));
        }
        private void HaveMouseTracker_PreviewMouseDown(object sender, MouseDownEventArgs e)
        {
            if (!_internalChanging)
            {
                return;
            }

            var calcPosition = GetCalculatedHoverPosition(e.Position);

            if (calcPosition == null)
            {
                return;
            }
            else
            {
                e.Position.X = calcPosition.X;
                e.Position.Y = calcPosition.Y;
            }
        }
Пример #27
0
        protected virtual bool HandleMouseDown(InputState state)
        {
            MouseDownEventArgs args = new MouseDownEventArgs {
                Button = Button
            };

            var positionalInputQueue = PositionalInputQueue.ToList();
            var result = PropagateMouseDown(positionalInputQueue, state, args, out Drawable handledBy);

            // only drawables up to the one that handled mouse down should handle mouse up
            MouseDownInputQueue = positionalInputQueue;
            if (result)
            {
                var count = MouseDownInputQueue.IndexOf(handledBy) + 1;
                MouseDownInputQueue.RemoveRange(count, MouseDownInputQueue.Count - count);
            }

            return(result);
        }
Пример #28
0
        protected override void OnMouseDown(MouseDownEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.Position == null)
            {
                throw new ArgumentException($"The {e.Position} of {nameof(MouseDownEventArgs)} can't be null.");
            }


            if (CanvasContext.ActiveLayer == null)
            {
                throw new InvalidOperationException($"The {CanvasContext.ActiveLayer} of {nameof(ICanvasContextEx )} can't be null.");
            }

            e.Handled = true;

            var thisPosition = e.Position;

            //若上次按下位置为空,则记录新的点;
            if (_lastMouseDownPosition == null)
            {
                _lastMouseDownPosition = thisPosition;
            }
            //否则将创建一个新的圆;
            else
            {
                //确定半径;
                var subX   = thisPosition.X - _lastMouseDownPosition.X;
                var subY   = thisPosition.Y - _lastMouseDownPosition.Y;
                var radius = Math.Sqrt(subX * subX + subY * subY);

                //创建圆;
                var round = new Ellipse(new Ellipse2D(_lastMouseDownPosition, radius, radius));

                AddDrawObjectToUndoStack(round);
                _lastMouseDownPosition = null;
            }
        }
        private void HaveMousePositionTracker_CanvasPreviewMouseDown(object sender, MouseDownEventArgs e)
        {
            //若非内部激发,则不处理;
            if (!_internalChanging)
            {
                return;
            }

            var destination = GetCalculatedHoverPosition(e.Position);

            if (destination == null)
            {
                return;
            }
            else
            {
                e.Position.X = destination.X;
                e.Position.Y = destination.Y;
            }
        }
Пример #30
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (!HasFocus || !bindTarget.IsHovered)
            {
                return(base.OnMouseDown(state, args));
            }

            if (!AllowMainMouseButtons)
            {
                switch (args.Button)
                {
                case MouseButton.Left:
                case MouseButton.Right:
                    return(true);
                }
            }

            bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
            return(true);
        }
Пример #31
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
 {
     ActiveCursor.Scale = new Vector2(1);
     ActiveCursor.ScaleTo(1.2f, 100, EasingTypes.OutQuad);
     return base.OnMouseDown(state, args);
 }
Пример #32
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
 {
     if (args.Button == this.Button) IsLit = true;
     return base.OnMouseDown(state, args);
 }
Пример #33
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
 {
     seek(state);
     return true;
 }
Пример #34
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (!Interactive) return false;

            logoBounceContainer.ScaleTo(0.9f, 1000, EasingTypes.Out);
            return true;
        }
Пример #35
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
Пример #36
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
 {
     lastState = state;
     return base.OnMouseDown(state, args);
 }
Пример #37
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
 {
     return Hit?.Invoke() ?? false;
 }