protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (args.Button != MouseButton.Left) { return(false); } logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); return(true); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (!Interactive) { return(false); } logoBounceContainer.ScaleTo(0.9f, 1000, EasingTypes.Out); return(true); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (textInput?.ImeActive == true) return true; selectionStart = selectionEnd = getCharacterClosestTo(state.Mouse.Position); cursorAndLayout.Invalidate(); return false; }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (shouldPerformRightMouseScroll(state)) { scrollToRelative(state.Mouse.Position[ScrollDim]); return(true); } return(base.OnMouseDown(state, args)); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (base.OnMouseDown(state, args)) { beginUserDrag(); return(true); } return(false); }
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; } }
private bool handleMouseDown(InputState state, MouseButton button) { MouseDownEventArgs args = new MouseDownEventArgs { Button = button }; mouseDownInputQueue = new List <Drawable>(positionalInputQueue); return(PropagateMouseDown(positionalInputQueue, state, args)); }
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); }
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); }
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); }
//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); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { switch (args.Button) { case MouseButton.Left: SelectNext(); break; case MouseButton.Right: SelectPrevious(); break; } return(true); }
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); }
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); }
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)); }
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; } }
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); }
/// <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); }
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); }
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; } }
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); }
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); }
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; } }
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); }
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; } }
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); }
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); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (args.Button == this.Button) IsLit = true; return base.OnMouseDown(state, args); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { seek(state); return true; }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (!Interactive) return false; logoBounceContainer.ScaleTo(0.9f, 1000, EasingTypes.Out); return true; }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { lastState = state; return base.OnMouseDown(state, args); }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { return Hit?.Invoke() ?? false; }