internal void DispatchEvent(PopupEventArgs eventArgs)
        {
            switch (eventArgs.Type)
            {
            case "close":
                OnClose?.Invoke(eventArgs);
                break;

            case "drag":
                OnDrag?.Invoke(eventArgs);
                break;

            case "dragend":
                OnDragEnd?.Invoke(eventArgs);
                break;

            case "dragstart":
                OnDragStart?.Invoke(eventArgs);
                break;

            case "open":
                OnOpen?.Invoke(eventArgs);
                break;
            }
        }
        public void SetCurrentState(TouchInputState state)
        {
            switch (_CurrentState)
            {
            case TouchInputState.TAPPING:
                break;

            case TouchInputState.DRAGGING:
                OnDragStop?.Invoke();
                break;

            case TouchInputState.PINCHING:
                OnPinchStop?.Invoke();
                break;
            }

            switch (state)
            {
            case TouchInputState.TAPPING:
                break;

            case TouchInputState.DRAGGING:
                OnDragStart?.Invoke();
                break;

            case TouchInputState.PINCHING:
                OnPinchStart?.Invoke();
                break;
            }

            _CurrentState = state;
        }
        private void OnPointerDown(PointerEventArgs e)
        {
            BSplitterCJsInterop.SetPointerCapture(jsRuntimeCurrent, bSplitter.bsbSettings.ID, e.PointerId);
            DragMode = true;

            if (bsSettings.IsDiagonal)
            {
                bSplitter.PreviousPosition  = (int)e.ClientX;
                bSplitter.PreviousPosition2 = (int)e.ClientY;
            }
            else
            {
                if (bsSettings.VerticalOrHorizontal)
                {
                    bSplitter.PreviousPosition  = (int)e.ClientY;
                    bSplitter.PreviousPosition2 = (int)e.ClientX;
                }
                else
                {
                    bSplitter.PreviousPosition  = (int)e.ClientX;
                    bSplitter.PreviousPosition2 = (int)e.ClientY;
                }
            }


            OnDragStart?.Invoke(bSplitter.bsbSettings.index, (int)e.ClientX, (int)e.ClientY);
        }
示例#4
0
 public virtual void DragStart(UIMouseEvent e)
 {
     OnDragStart?.Invoke(e, this);
     if (PropagationRule.HasFlag(PropagationFlags.DragStart))
     {
         Parent?.DragStart(e);
     }
 }
示例#5
0
        public virtual void OnBeginDrag(PointerEventData eventData)
        {
            ExecOnEnabledAndFocus(() => {
                OnDragStart?.Invoke(eventData);

                _isDragged = true;

                SetDragPos(eventData);
            });
        }
示例#6
0
        //Enable the drag selection box
        private void StartDrag()
        {
            //Save the currently selected objects
            originalSeleciton = new HashSet <GameObject>(ObjectSelection.Instance.GetSelection());
            //Enable the drag selection box
            dragSelectBox.SetActive(true);
            dragging = true;

            //Capture the cursor while dragging
            EditorManager.Instance.CaptureCursor();
            //Notify all listeners that the tool handle was activated
            OnDragStart?.Invoke();
        }
示例#7
0
 void MyDragStart(UIDragEventArgs args)
 {
     if (Debug)
     {
         Console.WriteLine($"DR: {DataItem} START");
     }
     args.DataTransfer.EffectAllowed = DragType;
     args.DataTransfer.Types         = new string[] { "text/plain" };
     args.DataTransfer.Items         = new UIDataTransferItem[] { new UIDataTransferItem()
                                                                  {
                                                                      Kind = "string", Type = "text/plain"
                                                                  } };
     OnDragStart?.Invoke(args, DataItem);
 }
示例#8
0
        public void ClearEvents()
        {
            foreach (DragDropCallback d in OnDragDrop.GetInvocationList())
            {
                OnDragDrop -= d;
            }

            foreach (DragDropCallback d in OnDragCancel.GetInvocationList())
            {
                OnDragCancel -= d;
            }

            foreach (DragDropCallback d in OnDragStart.GetInvocationList())
            {
                OnDragStart -= d;
            }
        }
示例#9
0
        void _update(ICogaManager coga, float deltaTime)
        {
            // Continuation from previous input
            if (isMouseDown)
            {
                if (mouseDownTime == 0f)
                {
                    OnStartClicking?.Invoke(Parent);
                    mousepos_lastframe = coga.MousePosition;
                }
                mouseDownTime += deltaTime;
                if (coga.IsClickReleased)                 // Exit out
                {
                    _handle_up(coga);
                    return;
                }

                if (isDragging)
                {
                    _update_drag(coga);
                    return;
                }

                if ((Vector2.Distance(coga.MousePosition, mouseInitial)) >= MouseDragMinimumDistance)
                {
                    OnDragStart?.Invoke(Parent);
                    Parent.Manager.LockHover();
                    OnDrag?.Invoke(Parent, (coga.MousePosition - mouseInitial));
                    isDragging = true;
                    return;
                }
            }
            else
            {
                if (coga.IsClickPressed)
                {
                    isDragging    = false;
                    isMouseDown   = true;
                    mouseDownTime = 0f;
                    mouseInitial  = coga.MousePosition;
                }
            }

            mousepos_lastframe = coga.MousePosition;
        }
示例#10
0
        private void AdornedElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            dragging = true;

            if (!(AdornedElement.RenderTransform is TranslateTransform transform))
            {
                transform = new TranslateTransform();
                AdornedElement.RenderTransform = transform;
            }

            dragStartElementPosition = new Point(transform.X, transform.Y);
            dragStartMousePosition   = e.GetPosition(null);

            AdornedElement.CaptureMouse();
            e.Handled = true;

            OnDragStart?.Invoke(this, EventArgs.Empty);
        }
        private void HandleDebugMouse()
        {
#if UNITY_EDITOR
            if (Input.GetMouseButtonDown(1))
            {
                _PreviousMousePosition = Input.mousePosition;
                OnDragStart?.Invoke();
            }

            if (Input.GetMouseButton(1))
            {
                Vector2 mousePos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
                OnDragDelta?.Invoke((mousePos - _PreviousMousePosition) * 2);
                _PreviousMousePosition = Input.mousePosition;
            }

            if (Input.GetMouseButtonUp(1))
            {
                OnDragStop?.Invoke();
            }

            OnPinchDelta?.Invoke(Input.mouseScrollDelta.y * 45);

            if (Input.GetMouseButtonDown(0))
            {
                OnTap?.Invoke();

                if (!ShootGraphicsRays(Input.mousePosition))
                {
                    if (!ShootPhysicsRay(Input.mousePosition))
                    {
                        OnDeselect?.Invoke();
                    }
                }
            }
#endif
        }
        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;
            }
        }
示例#13
0
 public void NotifyDragStart(Event eventArgs)
 {
     OnDragStart?.Invoke(this, eventArgs);
 }
示例#14
0
 public void TriggerOnDragStart(Widget widget, PointerEventData eventData)
 {
     OnDragStart?.Invoke(widget, eventData);
 }
示例#15
0
 protected virtual Task HandleDragStart(DragEventArgs args)
 {
     return(OnDragStart.InvokeAsync(args));
 }
示例#16
0
 protected virtual void RaiseOnDragStart(DragStartEvent arg)
 {
     OnDragStart?.Invoke(this, arg);
 }
示例#17
0
 public override void OnBeginDrag(PointerEventData eventData)
 {
     base.OnBeginDrag(eventData);
     OnDragStart?.Invoke();
 }
示例#18
0
 public void StartDragging()
 {
     OnDragStart?.Invoke();
 }
示例#19
0
 public void TriggerOnDragStart()
 {
     OnDragStart?.Invoke();
 }
示例#20
0
 internal virtual void DoDragStart()
 {
     OnDragStart?.Invoke();
 }