protected void OnDragEnd(UIDragEventArgs args) { Console.WriteLine($"End"); isBeingDragged = false; isUnderDragItem = false; DragEnd?.Invoke(); }
/// <summary> /// Handler para this.MouseDown /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MDown(object sender, MouseEventArgs e) { // Aqui invocamos nossos eventos custom para escapar da estrutura imposta pela framework // para checar o andamento de uma operação drag & drop if (DragStart != null) { DragStart.Invoke(this, e); } this.DoDragDrop(this.Tarefa, DragDropEffects.Move); if (DragEnd != null) { DragEnd.Invoke(this, e); } }
private void dragField_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { DragStart?.Invoke(this, EventArgs.Empty); DragDropEffects ef = DragDrop.DoDragDrop(this, Id + "\n" + BaseString + "\n" + TranslatedString, DragDropEffects.Move); DragEnd?.Invoke(this, EventArgs.Empty); if (ef == DragDropEffects.None) { // no drop happened } else { // drop happened } } }
private void Hook_EventReceived(WinEventEventArgs args) { try { switch (args.Event) { case WinEvent.EVENT_SYSTEM_MOVESIZESTART: if (args.Window.Equals(Window)) { IsDragging = true; DragBegin?.Invoke(this, new EventArgs()); } break; case WinEvent.EVENT_SYSTEM_MOVESIZEEND: if (args.Window.Equals(Window)) { OnWindowMoved(); DragEnd?.Invoke(this, new EventArgs()); IsDragging = false; } break; case WinEvent.EVENT_OBJECT_LOCATIONCHANGE: case WinEvent.EVENT_SYSTEM_FOREGROUND: if (!IsDragging) { OnWindowMoved(); } break; case WinEvent.EVENT_SYSTEM_MINIMIZEEND: case WinEvent.EVENT_SYSTEM_MINIMIZESTART: OnWindowMoved(); break; } } catch (Exception ex) { this.Exception?.Invoke(this, new UnhandledExceptionEventArgs(ex, false)); } }
private void Update() { if (EventSystem.current && EventSystem.current.currentSelectedGameObject) { return; } NormalizedDeltaInput = Vector3.zero; NormalizedGroundAlignedDeltaInput = Vector3.zero; var isInput = IsInput; switch (isInput) { case true: var inputPos = InputPos; if (_lastPos.HasValue) // Continue Drag { var delta = inputPos - _lastPos.Value; var normalizedDelta = delta / _screenWidth; Drag?.Invoke(delta); DragNormalized?.Invoke(normalizedDelta); NormalizedDeltaInput = normalizedDelta; NormalizedGroundAlignedDeltaInput = new Vector3(NormalizedDeltaInput.x, 0, NormalizedDeltaInput.y); } else // Start Drag { DragStart?.Invoke(inputPos); } _lastPos = inputPos; break; // Stop Drag case false when _lastPos.HasValue: _lastPos = null; DragEnd?.Invoke(); break; } }
private void PartDidEndDrag(Vector2 inputPos) { var inputDistanceToDrop = InputDistanceToDrop(inputPos); if (inputDistanceToDrop <= _snapDistance) { _dragObject.IsDragActive = false; _dragObject.SetPos(_dropPoint.transform.position); _dragObject.SetRotation(_dropPoint.rotation); _dragObject.SetLocalScale(_dropPoint.localScale); DragEnd?.Invoke(this, _dragObject, true); } else { _dragObject.CancelDrag(); DragEnd?.Invoke(this, _dragObject, false); } _dropPoint.gameObject.SetActive(false); }
public override void OnMouseButton(MouseButton button, Vector2 currentPosition, ButtonState buttonState) { if (button == MouseButton.Left) { if (buttonState == ButtonState.Pressed) { if (this.hoverable.IsHovered && !IsDragging) { IsDragging = true; this.accumulatedDragDelta = Vector2.Zero; DragStart?.Invoke(currentPosition, this.accumulatedDragDelta); } } else { if (IsDragging) { DragEnd?.Invoke(currentPosition, this.accumulatedDragDelta); } IsDragging = false; } } }
protected override bool OnDragEnd(DragEndEvent e) { this.FadeOut(250, Easing.OutQuint); DragEnd?.Invoke(); return(true); }
/// <summary> /// Raises <see cref="DragEnd"/> /// </summary> private void OnDragEnd() { DragEnd?.Invoke(this, new TKGenericEventArgs <TKCustomMapPin>(_formsPin)); }
public void OnEndDrag(PointerEventData eventData) { DragEnd?.Invoke(); }
public void OnEndDrag(PointerEventData eventData) { _rectTransform.SetParent(_treasureGroupTransform); DragEnd?.Invoke(eventData, this); }
public bool OnTouch(View view, MotionEvent motionEvent) { var action = motionEvent.Action; if (action == MotionEventActions.Down) { handler.PostDelayed(mLongPressed, 1000); var moveView = GetMovableView(view); downRawX = motionEvent.RawX; downRawY = motionEvent.RawY; dX = moveView.GetX() - downRawX; dY = moveView.GetY() - downRawY; DragStart?.Invoke(this, new FabDragEvent(dX, dY)); moveView.Animate() .ScaleX(0.6f) .ScaleY(0.6f) .SetDuration(1000) .Start(); return(true); // Consumed } if (action == MotionEventActions.Move) { handler.RemoveCallbacks(mLongPressed); var moveView = GetMovableView(view); int viewWidth = moveView.Width; int viewHeight = moveView.Height; View viewParent = (View)moveView.Parent; int parentWidth = viewParent.Width; int parentHeight = viewParent.Height; float newX = motionEvent.RawX + dX; newX = Java.Lang.Math.Max(0, newX); // Don't allow the FAB past the left hand side of the parent newX = Java.Lang.Math.Min(parentWidth - viewWidth, newX); // Don't allow the FAB past the right hand side of the parent float newY = motionEvent.RawY + dY; newY = Java.Lang.Math.Max(0, newY); // Don't allow the FAB past the top of the parent newY = Java.Lang.Math.Min(parentHeight - viewHeight, newY); // Don't allow the FAB past the bottom of the parent if (moveView.ScaleX == 1f) { moveView.Animate() .ScaleX(0.6f) .ScaleY(0.6f) .SetDuration(1000) .Start(); } moveView.Animate() .X(newX) .Y(newY) .SetDuration(0) .Start(); Dragging?.Invoke(this, new FabDragEvent(newX + moveView.Width / 2, newY + moveView.Height / 2)); return(true); // Consumed } if (action == MotionEventActions.Up) { handler.RemoveCallbacks(mLongPressed); var moveView = GetMovableView(view); float upRawX = motionEvent.RawX; float upRawY = motionEvent.RawY; float upDX = upRawX - downRawX; float upDY = upRawY - downRawY; if (Java.Lang.Math.Abs(upDX) < CLICK_DRAG_TOLERANCE && Java.Lang.Math.Abs(upDY) < CLICK_DRAG_TOLERANCE) { // A click moveView.Animate() .ScaleX(1f) .ScaleY(1f) .SetDuration(1000) .Start(); return(base.PerformClick()); } // A drag DragEnd?.Invoke(this, new FabDragEvent(moveView.GetX() + moveView.Width / 2, moveView.GetY() + moveView.Height / 2)); View viewParent = (View)moveView.Parent; moveView.Animate() .X(viewParent.Width - moveView.Width - 10) .Y(viewParent.Height - moveView.Height - 10) .SetDuration(1000) .Start(); moveView.Animate() .ScaleX(1f) .ScaleY(1f) .SetDuration(1000) .Start(); return(true); // Consumed } return(OnTouchEvent(motionEvent)); }
/// <summary> /// Raises the <see cref="E:DragEnd"/> event. /// </summary> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> protected virtual void OnDragEnd(MarkerEventArgs e) { DragEnd?.Invoke(this, e); }