private void AdornedElement_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (dragging) { dragging = false; AdornedElement.ReleaseMouseCapture(); e.Handled = true; OnDragEnd?.Invoke(this, EventArgs.Empty); } }
void Update_Draging() { if (!HasActiveTouch() || _input.GetTouchCount() > 1) { if (DragEndHandler != null) { DragEndHandler.Invoke(_prePos, Vector2.zero); } _state = State.kIdle; return; } // Touch Cnt must be 1 Vector2 detaPos = _input.GetTouchDeltaPosition(0); if (_input.GetTouchPhase(0) == TouchPhase.Ended) { if (DragHandler != null) { DragHandler.Invoke(_input.GetTouchPosition(0), detaPos); } if (DragEndHandler != null) { DragEndHandler.Invoke(_input.GetTouchPosition(0), _momentum); } _state = State.kIdle; return; } if (_input.GetTouchPhase(0) == TouchPhase.Moved) { if (DragHandler != null) { DragHandler.Invoke(_input.GetTouchPosition(0), detaPos); } } _momentum = Vector2.Lerp(_momentum, _momentum + detaPos * (0.01f * MomentumAmount), 0.67f); _momentum *= 0.5f; }
private void Drag() { if (!isActive) { return; } if (!isUse) { assembleManager.OnSelect.Invoke(this); PrepareAssmeble(); } else if (prepareFinish) { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; containerBase = null; if (Physics.Raycast(ray, out hit, 100) && hit.transform.name == obj.name) { screenPosition = Camera.main.WorldToScreenPoint(obj.transform.position); mScreenPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPosition.z); offset = obj.transform.position - Camera.main.ScreenToWorldPoint(mScreenPosition); isButtonDown = true; } if (OnDragBegin != null) { OnDragBegin.Invoke(); } } if (Input.GetMouseButton(0) && isButtonDown) { mScreenPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPosition.z); obj.transform.position = Camera.main.ScreenToWorldPoint(mScreenPosition) + offset; } if (Input.GetMouseButtonUp(0) && isButtonDown) { isUse = false; isActive = false; isButtonDown = false; tempContainer = FindContainer(); if (JugeAssmeble(tempContainer)) { BeginAssmeble(tempContainer); } if (OnDragEnd != null) { OnDragEnd.Invoke(this, containerBase); } } } }
public void OnEndDrag(PointerEventData eventData) { var direction = eventData.position - startPosition; startPosition = Vector2.zero; if (direction.y >= 0) { OnDragEnd?.Invoke(Direction.Up); } else { OnDragEnd?.Invoke(Direction.Down); } }
public void StopDrag() { fingerIndex = -1; if (resetPhysic) { if (cachedRigidBody) { cachedRigidBody.isKinematic = isKinematic; } if (cachedRigidBody2D) { cachedRigidBody2D.isKinematic = isKinematic2D; } } isOnDrag = false; onDragEnd.Invoke(lastGesture); }
internal void DispatchEvent(Map map, HtmlMarkerJsEventArgs eventArgs) { if (eventArgs.Options != null) { var popupOptions = Options.Popup; Options = eventArgs.Options; Options.Popup = popupOptions; } switch (eventArgs.Type) { case "click": OnClick?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "contextmenu": OnContextMenu?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "dblclick": OnDblClick?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "drag": OnDrag?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "dragend": OnDragEnd?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "dragstart": OnDragStart?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "keydown": OnKeyDown?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "keypress": OnKeyPress?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "keyup": OnKeyUp?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mousedown": OnMouseDown?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mouseenter": OnMouseEnter?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mouseleave": OnMouseLeave?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mousemove": OnMouseMove?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mouseout": OnMouseOut?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mouseover": OnMouseOver?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; case "mouseup": OnMouseUp?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this)); break; } }
public void NotifyDragEnd(DragEndEvent eventArgs) { OnDragEnd?.Invoke(this, eventArgs); }
public void TriggerOnDragEnd(Widget widget, PointerEventData eventData) { OnDragEnd?.Invoke(widget, eventData); }
public void StopDragging() { OnDragEnd?.Invoke(); }
internal virtual void DoDragEnd() { OnDragEnd?.Invoke(); }
private void Timeline_MouseUp(object sender, MouseEventArgs e) { _dragging = false; OnDragEnd?.Invoke(this, null); }
public void OnEndDrag(PointerEventData eventData) { OnDragEnd?.Invoke(); }
// ReSharper disable once MemberCanBePrivate.Global protected void OnDragFinish(Polygon polygon) { OnDragEnd?.Invoke(polygon); UpdatePointsAsync(CurrentPolygon); }
protected void Invoke_OnDragEnd(object sender, DragArgs args) { OnDragEnd?.Invoke(sender, args); }
protected virtual void RaiseOnDragEnd(DragEndEvent arg) { OnDragEnd?.Invoke(this, arg); }
public void OnEndDrag(PointerEventData eventData) => OnDragEnd?.Invoke(this, new PointerEventArgs(eventData));