Example #1
0
        /// <summary>
        /// Executes the OnLongClick trigger. You can force an execution of this trigger (regardless if it's enabled or not) by calling this method with forcedExecution set to TRUE
        /// </summary>
        /// <param name="forcedExecution">Fires this trigger regardless if it is enabled or not (default:false)</param>
        public void ExecuteLongClick(bool forcedExecution = false)
        {
            if (forcedExecution)
            {
                if (debugThis)
                {
                    Debug.Log("DebugMode - UIButton - " + name + " | Executing OnLongClick initiated through forcedExecution");
                }
                OnLongClick.Invoke();
                return;
            }

            if (useOnLongClick)
            {
                if (debugThis)
                {
                    Debug.Log("DebugMode - UIButton - " + name + " | Executing OnLongClick");
                }
                if (interactable)
                {
                    OnLongClick.Invoke();
                }
                if (!interactable & useOnHoverExit & onHoverExitReady)
                {
                    OnHoverExit.Invoke();
                }
            }
        }
Example #2
0
 void _handle_up(ICogaManager coga)
 {
     isMouseDown = false;
     if (isDragging)
     {
         OnDragEnd?.Invoke(Parent);
         coga.UnlockHover();
     }
     else
     {
         if (LongClickingEnabled)
         {
             // With long clicking enabled, allow early cancel out and
             // only long click past the const delay.
             if (mouseDownTime < MouseClickDelay)
             {
                 _update_click(coga);
             }
             else
             {
                 OnLongClick?.Invoke(Parent);
                 OnEndClicking?.Invoke(Parent);
             }
         }
         else
         {
             // If we don't need to worry about the long click,
             // just always click.
             _update_click(coga);
         }
     }
 }
        //When holding for 1+ sec
        private void OnLongMouseClick()
        {
            if (IsMouseOverUI())
            {
                return;
            }

            OnLongClick?.Invoke(_floorPos);
        }
 private void AddListeners()
 {
     if (allowMultipleClicks == false)
     {
         OnClick.AddListener(DisableButton);
         OnDoubleClick.AddListener(DisableButton);
         OnLongClick.AddListener(DisableButton);
     }
 }
Example #5
0
        private bool CheckLongClick()
        {
            var pressTime = upTime - downTime;

            if (pressTime < longClickTime)
            {
                return(false);
            }
            OnLongClick.Invoke();
            return(true);
        }
Example #6
0
    public void LongClickHandler()
    {
        if (_state == State.Normal)
        {
            OnLongClick?.Invoke(this);

            // and autoselect
            ClickHandler();
        }
        else if (_state == State.Selection)
        {
        }
    }