public void OnPointerDown(PointerEventData eventData)
 {
     if (KernelFruiton != null)
     {
         OnBeginDrag.Invoke();
     }
 }
示例#2
0
        IEnumerator PointerDownTimer()
        {
            yield return(new WaitForSecondsRealtime(TOUCH_DRAG_DELAY));

            pointerDownCoroutine = null;
            OnBeginDrag.Invoke();
        }
示例#3
0
 /// <summary>
 /// Handler for controller trigger down
 /// </summary>
 /// <param name="controllerId">Controller ID</param>
 /// <param name="triggerValue">Trigger Value (unused)</param>
 private void HandleTriggerDown(byte controllerId, float triggerValue)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId))
     {
         _isDragging = true;
         OnBeginDrag?.Invoke();
     }
 }
 /// <param name="onBeginDrag"><see cref="OnBeginDrag"/></param>
 /// <param name="onContinueDrag"><see cref="OnContinueDrag"/></param>
 /// <param name="onEndDrag"><see cref="OnEndDrag"/></param>
 /// <param name="deadzone">drag will be triggered when mouse leaves
 ///     this deadzone around the mousedown position</param>
 public DragDropHelper(OnBeginDrag onBeginDrag, OnContinueDrag onContinueDrag,
                       OnEndDrag onEndDrag)
 {
     _inputManager   = IoCManager.Resolve <IInputManager>();
     _onBeginDrag    = onBeginDrag;
     _onEndDrag      = onEndDrag;
     _onContinueDrag = onContinueDrag;
 }
 /// <param name="onBeginDrag"><see cref="OnBeginDrag"/></param>
 /// <param name="onContinueDrag"><see cref="OnContinueDrag"/></param>
 /// <param name="onEndDrag"><see cref="OnEndDrag"/></param>
 /// <param name="deadzone">drag will be triggered when mouse leaves
 ///     this deadzone around the mousedown position</param>
 public DragDropHelper(OnBeginDrag onBeginDrag, OnContinueDrag onContinueDrag,
                       OnEndDrag onEndDrag, float deadzone = DefaultDragDeadzone)
 {
     _deadzone       = deadzone;
     _inputManager   = IoCManager.Resolve <IInputManager>();
     _onBeginDrag    = onBeginDrag;
     _onEndDrag      = onEndDrag;
     _onContinueDrag = onContinueDrag;
 }
示例#6
0
 void IPointerDownHandler.OnPointerDown(PointerEventData eventData)
 {
     start   = eventData.position;
     current = start;
     holding = true;
     if (OnBeginDrag != null)
     {
         OnBeginDrag.Invoke();
     }
 }
示例#7
0
        public static Result <bool> BeginDrag(Model model, PointerEventData eventData)
        {
            Clean();
            currentDragModel = model;

            var result = handler.BeginDrag(model, eventData);

            OnBeginDrag?.Invoke(model, eventData);
            return(result);
        }
示例#8
0
        public void OnPointerDown(PointerEventData eventData)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            dragBeginPosition    = eventData.position;
            pointerDownCoroutine = StartCoroutine(PointerDownTimer());
#endif
#if UNITY_STANDALONE || UNITY_EDITOR
            if (eventData.button == PointerEventData.InputButton.Left)
            {
                OnBeginDrag.Invoke();
            }
            else if (eventData.button == PointerEventData.InputButton.Right)
            {
                OnRightClick.Invoke();
            }
#endif
        }
示例#9
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (dragging != null)
     {
         Cursor = Cursors.Cross;
         if (images == null && MouseItem != firstD)
         {
             beginDragged = true;
             if (OnBeginDrag != null)
             {
                 OnBeginDrag.Invoke(dragging);
             }
             RegisterHandling(true);
             isDragging = true;
             var imgs = GetAllImages(SelectedItems);
             //imgs = imgs.SetSizeOfAll(new Size(30,30));
             images = FloatingImageGrid.GetImage(this, imgs, Color.Gray, null);
             images.KeepInMousePos(true, new Point(3, 3), Arithmetics.GetImagesSize(imgs, 10));
             images.Enabled = false;
             images.AddExecutor(mouseCondition, mouseAction);
             this.FindForm().Focus();
             this.FindForm().Select();
         }
     }
     else
     {
         if (MouseItem == null && dragging == null && e.Button == MouseButtons.Left)
         {
             if (panel == null)
             {
                 startPoint              = MousePosition;
                 panel                   = FloatingControl.DisplayFloatingControl <FloatingControl>(this, 1, 1, false, MousePosition);
                 panel.Location          = startPoint;
                 panel.AllowTransparency = true;
                 panel.Enabled           = false;
                 Bitmap bmp = new Bitmap(1, 1);
                 bmp.SetPixel(0, 0, Color.FromArgb(100, Color.Gray));
                 panel.BackgroundImage = bmp;
                 panel.TransparencyKey = Color.FromArgb(100, Color.Gray);
                 this.FindForm().Focus();
                 this.FindForm().Select();
             }
         }
         if (panel != null && e.Button == MouseButtons.Left)
         {
             var size = new Size(MousePosition.X - startPoint.X, MousePosition.Y - startPoint.Y);
             var loc  = panel.Location;
             if (size.Width < 0)
             {
                 size.Width *= -1;
                 loc.X       = startPoint.X - size.Width;
             }
             if (size.Height < 0)
             {
                 size.Height *= -1;
                 loc.Y        = startPoint.Y - size.Height;
             }
             panel.Size     = size;
             panel.Location = loc;
             SelectItemsAt(new Rectangle(loc, size));
         }
         else
         {
             if (panel != null)
             {
                 panel.Close();
                 panel = null;
                 //dontSelect = true;
             }
         }
     }
     base.OnMouseMove(e);
 }