Beispiel #1
0
        /// <summary>
        /// Handler invoked on mouse click (left) event.
        /// </summary>
        /// <param name="x">X coordinate.</param>
        /// <param name="y">Y coordinate.</param>
        /// <param name="down">If set to <c>true</c> mouse button is down.</param>
        protected override void OnMouseClickedLeft(int x, int y, bool down)
        {
            if (null == m_Target)
            {
                return;
            }

            if (down)
            {
                m_Held    = true;
                m_HoldPos = m_Target.CanvasPosToLocal(new Point(x, y));
                InputHandler.MouseFocus = this;

                //gl_begin
                if (BeginDrag != null)
                {
                    BeginDrag.Invoke(this, EventArgs.Empty);
                }
                //gl_end
            }
            else
            {
                m_Held = false;

                InputHandler.MouseFocus = null;

                //gl_begin
                if (EndDrag != null)
                {
                    EndDrag.Invoke(this, EventArgs.Empty);
                }
                //gl_end
            }
        }
Beispiel #2
0
 public void OnBeginDrag(BaseEventData eventData)
 {
     if (!(eventData is PointerEventData))
     {
         return;
     }
     BeginDrag?.Invoke(gameObject);
 }
Beispiel #3
0
 public GridSplitterHandle(View parent, View layoutParent = null, string id = null, Template template = null, Action <View> initializer = null) :
     base(parent, layoutParent, id, template ?? GridSplitterHandleTemplates.Default, initializer)
 {
     // constructing Image (SplitterHandle)
     SplitterHandle = new Image(this, this, "SplitterHandle", SplitterHandleTemplate);
     Drag.RegisterHandler(this, "OnDrag");
     BeginDrag.RegisterHandler(this, "OnBeginDrag");
     InitializePotentialDrag.RegisterHandler(this, "OnInitializePotentialDrag");
     EndDrag.RegisterHandler(this, "OnEndDrag");
     MouseEnter.RegisterHandler(this, "OnMouseEnter");
     MouseExit.RegisterHandler(this, "OnMouseExit");
     ContentContainer = SplitterHandle;
     this.AfterInitializeInternal();
 }
        public override void Update(VrUpdateArgs args)
        {
            var session = args.Session;
            var input   = session.SemanticInput();

            Matrix4 pointer   = PointerFilter(session.RightController.PointerTransform);
            var     hitResult = GetClosestHit(pointer.Translation);

            //KNARK: Review Deletebutton usage (used to capture on down, execute on up)

            /*if(input.SelectClick || input.DeleteClick)
             * {
             *  _pressedAt = pointer;
             * }
             * else */if (input.IsSelectPressed && !_dragging)
            {
                _dragging  = true;
                _hitResult = hitResult;

                var eventArgs = new VrEventArgs(pointer, _hitResult);
                BeginDrag?.Invoke(eventArgs);
                if (eventArgs.CreatedObject != null)
                {
                    _hitResult = eventArgs.CreatedObject();
                }
            }
            else if (_dragging && input.IsSelectPressed)
            {
                DeltaDrag?.Invoke(new VrEventArgs(pointer, _hitResult));
            }
            else if (!input.IsSelectPressed && _dragging)
            {
                _dragging = false;
                EndDrag?.Invoke(new VrEventArgs(pointer, _hitResult));
            }
            //else if (_gripPressed && !session.RightController.InputState.GripPressed
            //    && CloseEnough(_pressedAt, pointer))
            else if (input.DeleteClick)
            {
                AlternateClick?.Invoke(new VrEventArgs(pointer, hitResult));
            }
            else if (hitResult != null)
            {
                HoverObject?.Invoke(new VrEventArgs(pointer, hitResult));
            }
        }
Beispiel #5
0
        public void OnBeginDrag(PointerEventData pointer)
        {
            if (Relic.IsEmpty)
            {
                pointer.pointerDrag = null;
                return;
            }

            this.isDragging = true;

            Tooltip.Instance.Hide();

            this.canvasGroup.blocksRaycasts = false;
            this.canvasGroup.interactable   = false;

            this.rectTransform.SetParent(this.dragTransform);
            this.rectTransform.sizeDelta = new Vector2(64, 64);

            CursorManager.Instance.ChangeState(CursorManager.CursorState.None);
            AudioManager.Instance.PlayItemPick();
            BeginDrag?.Invoke(this);
        }
Beispiel #6
0
        public void OnBeginDrag(PointerEventData pointer)
        {
            if (Item.IsEmpty || IsBlocked || !IsDraggable || pointer.button == PointerEventData.InputButton.Right)
            {
                pointer.pointerDrag = null;
                return;
            }

            ItemTooltip.Instance.Hide();

            this.canvasGroup.blocksRaycasts = false;
            this.canvasGroup.interactable   = false;

            this.rectTransform.SetParent(this.dragTransform);
            this.rectTransform.sizeDelta = new Vector2(64, 64);

            CursorManager.Instance.ChangeState(CursorManager.CursorState.None);
            AudioManager.Instance.PlayItemPick(Item);

            BeginDrag?.Invoke(this);
            AnyBeginDrag?.Invoke(this);
        }
 public virtual void OnBeginDrag(PointerEventData eventData)
 {
     BeginDrag.SafeInvoke(eventData);
 }
Beispiel #8
0
 public override void OnBeginDrag(PointerEventData eventData)
 {
     BeginDrag?.Invoke();
 }
Beispiel #9
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     BeginDrag?.Invoke(eventData);
 }