internal override void _fireDragStarted(DragAndDropItem item, IntVector2 position) { if (DragStarted != null) { DragStarted.Invoke((ItemType)item, position); } }
public override void dragStarted(IntVector2 position) { if (DragStarted != null) { DragStarted.Invoke(this, position); } }
void _fireDragStarted(ItemType item, IntVector2 position) { if (DragStarted != null) { DragStarted.Invoke(item, position); } }
internal void StartDrag(Point location) { _startLocation = location; IsDragging = true; DragStarted?.Invoke(this, new DragStartedEventArgs(0, 0)); }
private void StartDrag(double x, double y) { _startX = x; _startY = y; IsDragging = true; DragStarted?.Invoke(this, new DragStartedEventArgs(0, 0)); }
void ISliderController.SendDragStarted() { if (IsEnabled) { DragStartedCommand?.Execute(null); DragStarted?.Invoke(this, null); } }
void SendDragStarted() { if (IsEnabled) { DragStartedCommand?.Execute(null); DragStarted?.Invoke(this, null); } }
void ISlider.DragStarted() { if (IsEnabled) { DragStartedCommand?.Execute(null); DragStarted?.Invoke(); } }
void OnMouseDown() { if (!IsEquipped) { Dragging = true; DragStarted?.Invoke(InstanceId, Dragging); } }
private void TryStartDrag() { if (isDragActive) { return; } isDragActive = true; RunThumbAnimation("Press"); DragStarted?.Invoke(); }
/// <inheritdoc/> protected override void OnPreviewMouseMove(MouseEventArgs e) { base.OnPreviewMouseMove(e); var position = e.GetPosition(this); if (AllowMouseDrag && dragState == DragState.Starting && e.LeftButton == MouseButtonState.Pressed) { var dx = Math.Abs(position.X - mouseDownPosition.X); var dy = Math.Abs(position.Y - mouseDownPosition.Y); dragOrientation = dx >= dy ? Orientation.Horizontal : Orientation.Vertical; if (dx > SystemParameters.MinimumHorizontalDragDistance || dy > SystemParameters.MinimumVerticalDragDistance) { var root = this.FindVisualRoot() as FrameworkElement; if (root != null) { root.IsKeyboardFocusWithinChanged += RootParentIsKeyboardFocusWithinChanged; } mouseDownPosition = position; mouseMoveDelta = 0; dragState = DragState.Dragging; e.MouseDevice.Capture(this); DragStarted?.Invoke(this, new DragStartedEventArgs(mouseDownPosition.X, mouseDownPosition.Y)); SelectAll(); adorner?.SetOrientation(dragOrientation); } } if (dragState == DragState.Dragging) { if (dragOrientation == Orientation.Horizontal) { mouseMoveDelta += position.X - mouseDownPosition.X; } else { mouseMoveDelta += mouseDownPosition.Y - position.Y; } var deltaUsed = Math.Floor(mouseMoveDelta / DragSpeed); mouseMoveDelta -= deltaUsed; var newValue = Value + deltaUsed * SmallChange; SetCurrentValue(ValueProperty, newValue); if (MouseValidationTrigger == MouseValidationTrigger.OnMouseMove) { Validate(); } NativeHelper.SetCursorPos(PointToScreen(mouseDownPosition)); } }
public void Move(Point position) { if (!_isClick) { return; } if ((position - _downedPosition).LengthSquared > ToleranceSquared) { _isClick = false; DragStarted?.Invoke(null, EventArgs.Empty); } }
public void OnPointerDown(PointerEventData eventData) { if (eventData.hovered.Contains(this.gameObject)) { dragging = true; dragObject.SetActive(true); dragObject.transform.position = eventData.position; dragObject.GetComponent <Image>().sprite = image.sprite; dragObject.GetComponent <Image>().color = image.color; dragStarted?.Invoke(this); DragStarted?.Invoke(this); } }
protected void OnDragStart(UIDragEventArgs args) { Console.WriteLine($"Start {Data}"); isBeingDragged = true; args.DataTransfer.EffectAllowed = "move"; args.DataTransfer.Types = new string[] { "text/plain" }; args.DataTransfer.Items = new UIDataTransferItem[] { new UIDataTransferItem() { Kind = "string", Type = "text/plain" } }; ClientX = args.ClientX; ClientY = args.ClientY; DragStarted?.Invoke(Data); }
/// <summary> /// Creates and initializes a new instance of the Slider class. /// </summary> /// <param name="parent">The <see cref="EvasObject"/> to which the new Slider will be attached as a child.</param> /// <since_tizen> preview </since_tizen> public Slider(EvasObject parent) : base(parent) { _changed = new SmartEvent(this, this.RealHandle, "changed"); _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty); _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed"); _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty); _dragStarted = new SmartEvent(this, this.RealHandle, "slider,drag,start"); _dragStarted.On += (s, e) => DragStarted?.Invoke(this, EventArgs.Empty); _dragStopped = new SmartEvent(this, this.RealHandle, "slider,drag,stop"); _dragStopped.On += (s, e) => DragStopped?.Invoke(this, EventArgs.Empty); }
IEnumerator <object> SelectTask() { while (true) { if (Widget.Input.WasMousePressed()) { var pick = Pick( Widget.Input.MousePosition.X - Widget.GlobalPosition.X, Widget.Input.MousePosition.Y - Widget.GlobalPosition.Y); if (pick.Area != Area.Outside) { DragStarted?.Invoke(); while (Widget.Input.IsMousePressed()) { float nx, ny; ShiftedCoordinates( Widget.Input.MousePosition.X - Widget.GlobalPosition.X, Widget.Input.MousePosition.Y - Widget.GlobalPosition.Y, out nx, out ny); if (pick.Area == Area.Triangle) { var newPick = PositionToSV(nx, ny, ignoreBounds: true); color.Value = new ColorHSVA { H = color.Value.H, S = Mathf.Min(Mathf.Max(newPick.S.Value, 0), 1), V = Mathf.Min(Mathf.Max(newPick.V.Value, 0), 1), A = color.Value.A }; } else { var newPick = PositionToHue(nx, ny); color.Value = new ColorHSVA { H = Mathf.Min(Mathf.Max(newPick.H.Value, 0), 360), S = color.Value.S, V = color.Value.V, A = color.Value.A }; } Window.Current.Invalidate(); Changed?.Invoke(); yield return(null); } DragEnded?.Invoke(); } } yield return(null); } }
private void LongPressGestureUpdated(DigitalRubyShared.GestureRecognizer r) { Camera camera; FingersScript.StartOrResetGesture(r, BringToFront, Cameras, gameObject, spriteRenderer, GestureRecognizerComponentScriptBase.GestureObjectMode.RequireIntersectWithGameObject, out camera); if (r.State == GestureRecognizerState.Began) { transform.localScale *= DragScale; panZ = camera.WorldToScreenPoint(transform.position).z; panOffset = transform.position - ScreenToWorldPoint(camera, r.FocusX, r.FocusY, panZ); if (DragStarted != null) { DragStarted.Invoke(this, System.EventArgs.Empty); } } else if (r.State == GestureRecognizerState.Executing) { Vector3 gestureScreenPoint = new Vector3(r.FocusX, r.FocusY, panZ); Vector3 gestureWorldPoint = ScreenToWorldPoint(camera, gestureScreenPoint.x, gestureScreenPoint.y, gestureScreenPoint.z) + panOffset; if (rigidBody != null) { rigidBody.MovePosition(gestureWorldPoint); } else if (rigidBody2D != null) { rigidBody2D.MovePosition(gestureWorldPoint); } else { transform.position = gestureWorldPoint; } if (DragUpdated != null) { DragUpdated.Invoke(this, System.EventArgs.Empty); } } else if (r.State == GestureRecognizerState.Ended) { transform.localScale /= DragScale; if (spriteRenderer != null && BringToFront) { spriteRenderer.sortingOrder = startSortOrder; } if (DragEnded != null) { DragEnded.Invoke(this, System.EventArgs.Empty); } } }
/// <summary> /// Handles the MouseMove event of the Host control. Used to invoke a drag started if the proper /// conditions have been met /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void Host_MouseMove(object sender, MouseEventArgs e) { var mouseMovePoint = e.GetPosition(this); // Check if we're "dragging" this control around. If not the return, otherwise invoke DragStarted event. if (!(_mouseDownPoint.HasValue) || e.LeftButton == MouseButtonState.Released || Point.Subtract(_mouseDownPoint.Value, mouseMovePoint).Length < SystemParameters.MinimumHorizontalDragDistance && Point.Subtract(_mouseDownPoint.Value, mouseMovePoint).Length < SystemParameters.MinimumVerticalDragDistance) { return; } DragStarted?.Invoke(this); }
private void CanvasView_Touch(object sender, SKTouchEventArgs e) { if (e.ActionType == SKTouchAction.Entered || e.ActionType == SKTouchAction.Pressed) { DragStarted?.Invoke(this, new EventArgs()); } if (e.ActionType == SKTouchAction.Exited || e.ActionType == SKTouchAction.Released) { DragCompleted?.Invoke(this, new EventArgs()); } var dis = GetDistance(Center.X, e.Location.X, Center.Y, e.Location.Y); float adjustedRadius = (MinorAxisLength / 2) - arcPadding; if (dis < (adjustedRadius + KnobRadius)) { var angle = (float)(GetAngle(Center.X, e.Location.X, Center.Y, e.Location.Y) + 120) % 360; //Debug.WriteLine($"Angle:{angle % 360}"); float sweepAngle = (startAngle + angle) % 360; // the current endpoint of the draw arc //Debug.WriteLine($"sweepAngle:{sweepAngle }"); var sweepPercent = sweepAngle / 300; // Debug.WriteLine($"sweepPercent:{sweepPercent}"); double newValue; if (Min < 0) { newValue = ((Max - Min) * sweepPercent) + Min; } else { newValue = ((Max - Min) * sweepPercent) + Min; } if (newValue <= Max) { Value = Math.Round(newValue, Precision); } else if (sweepAngle < 320) { Value = Max; } else if (sweepAngle > 340) { Value = Min; } } e.Handled = true; }
private void LongPressGestureUpdated(GestureRecognizer r) { FingersPanRotateScaleComponentScript.StartOrResetGesture(r, BringToFront, Camera, gameObject, spriteRenderer, GestureRecognizerComponentScriptBase.GestureObjectMode.RequireIntersectWithGameObject); if (r.State == GestureRecognizerState.Began) { panZ = Camera.WorldToScreenPoint(transform.position).z; panOffset = transform.position - Camera.ScreenToWorldPoint(new Vector3(r.FocusX, r.FocusY, panZ)); if (DragStarted != null) { DragStarted.Invoke(this, System.EventArgs.Empty); } } if (r.State == GestureRecognizerState.Executing) { Vector3 gestureScreenPoint = new Vector3(r.FocusX, r.FocusY, panZ); Vector3 gestureWorldPoint = Camera.ScreenToWorldPoint(gestureScreenPoint) + panOffset; if (rigidBody == null) { transform.position = gestureWorldPoint; } else { rigidBody.MovePosition(gestureWorldPoint); } if (DragUpdated != null) { DragUpdated.Invoke(this, System.EventArgs.Empty); } } else if (r.State == GestureRecognizerState.Ended) { if (spriteRenderer != null && BringToFront) { spriteRenderer.sortingOrder = startSortOrder; } if (DragEnded != null) { DragEnded.Invoke(this, System.EventArgs.Empty); } } }
IEnumerator <object> SelectTask() { while (true) { if (Widget.Input.WasMousePressed() && HitTest(Widget.Input.MousePosition)) { DragStarted?.Invoke(); while (Widget.Input.IsMousePressed()) { var c = color.Value; PositionToHueSaturation(Widget.Input.MousePosition - Widget.GlobalCenter, out c.H, out c.S); color.Value = c; Window.Current.Invalidate(); Changed?.Invoke(); yield return(null); } DragEnded?.Invoke(); } yield return(null); } }
private void StartDrag() { _isDragging = true; if (DragStarted != null) { DragStarted.Invoke(); } if (_animSizeCoroutine != null) { StopCoroutine(_animSizeCoroutine); } _animSizeCoroutine = StartCoroutine(AnimButtonSize()); if (_animPositionCoroutine != null) { StopCoroutine(_animPositionCoroutine); } _animPositionCoroutine = StartCoroutine(AnimButtonPosition()); }
public override bool BeginTracking(UITouch uitouch, UIEvent uievent) { var touchPoint = uitouch.LocationInView(this); if (_lowerTouchEdgeInsets.InsetRect(_lowerHandle.Frame).Contains(touchPoint) && !LowerHandleHidden) { _lowerHandle.Highlighted = true; _lowerTouchOffset = (float)touchPoint.X - (float)_lowerHandle.Center.X; } if (_upperTouchEdgeInsets.InsetRect(_upperHandle.Frame).Contains(touchPoint) && !UpperHandleHidden) { _upperHandle.Highlighted = true; _upperTouchOffset = (float)touchPoint.X - (float)_upperHandle.Center.X; } _stepValueInternal = StepValueContinuously ? StepValue : 0.0f; DragStarted?.Invoke(this, EventArgs.Empty); return(true); }
public void Update() { if (!IsPushed || _isResolved) { return; } if (Mathf.Abs((_initialPointerPosition - Input.mousePosition).magnitude) > _dragDelta) { _isResolved = true; DragStarted?.Invoke(); } else { _pressTimer += Time.unscaledDeltaTime; if (_pressTimer >= Constants.PointerOnClickDelay) { _isResolved = true; DragStarted?.Invoke(); } } }
void OnMouseUp() { Dragging = false; DragStarted?.Invoke(InstanceId, Dragging); }
public void OnDragStarted() { DragStarted?.Invoke(this, EventArgs.Empty); }
/// <summary> /// This is called when the user has started touching this widget. /// </summary> private void OnStartTrackingTouch() { _isDragging = true; DragStarted?.Invoke(this, EventArgs.Empty); }
protected virtual void OnDragStarted() { DragStarted?.Invoke(this, EventArgs.Empty); }
private void StartDrag() { RunThumbAnimation("Press"); DragStarted?.Invoke(); }
protected virtual void OnDragStarted(Dock position, double delta) { DragStarted?.Invoke(this, position, delta); }