void Interop.IDropTarget.DragOver(int grfKeyState, Point pt,
                                          ref int pdwEffect)
        {
            Point    clientLocation = m_TreeView.PointToClient(pt);
            TreeNode node           = m_TreeView.HitTest(clientLocation).Node;

            CheckDragScroll(clientLocation);

            if (node != null)
            {
                if ((m_DragTarget == null) ||
                    (node != m_DragTarget.Node))
                {
                    if (m_DragTarget != null)
                    {
                        m_DragTarget.Dispose();
                    }

                    m_DragTarget = new DragTarget(node, grfKeyState,
                                                  pt, ref pdwEffect);
                }
                else
                {
                    m_DragTarget.DragOver(grfKeyState, pt, ref pdwEffect);
                }
            }
            else
            {
                pdwEffect = 0;
            }
        }
Exemplo n.º 2
0
        void IDropTarget.DragOver(int grfKeyState, Point pt,
                                  ref int pdwEffect)
        {
            var clientLocation = _mTreeView.PointToClient(pt);
            var node           = _mTreeView.HitTest(clientLocation).Node;

            CheckDragScroll(clientLocation);

            if (node != null)
            {
                if ((_mDragTarget == null) ||
                    (node != _mDragTarget.Node))
                {
                    _mDragTarget?.Dispose();

                    _mDragTarget = new DragTarget(node, grfKeyState,
                                                  pt, ref pdwEffect);
                }
                else
                {
                    _mDragTarget.DragOver(grfKeyState, pt, ref pdwEffect);
                }
            }
            else
            {
                pdwEffect = 0;
            }
        }
Exemplo n.º 3
0
    private void UpdateDragTarget(DragTarget dragTarget)
    {
        if (m_DragTarget != dragTarget)
        {
            m_DragTarget = dragTarget;
            Debug.Log($"New drag target {dragTarget}");

            bool isActive_Mesh  = false;
            bool isActive_Image = false;

            switch (dragTarget)
            {
            case DragTarget.ARTrackable:
                isActive_Mesh = true; break;

            case DragTarget.Canvas:
                isActive_Image = true; break;

            default:
                break;     // fallthrough
            }

            m_DragMeshAnimator.gameObject.SetActive(isActive_Mesh);

            // It's usually more efficient to disbale the canvas. But we want to stop the sprite animation as well.
            // There is only one Image here, so rebuilding the canvas on drag is no a huge cost.
            m_DragImageAnimator.gameObject.SetActive(isActive_Image);
        }
    }
Exemplo n.º 4
0
 void IDropTarget.DragLeave()
 {
     if (_mDragTarget != null)
     {
         _mDragTarget.Dispose();
         _mDragTarget = null;
     }
     _mTreeView.HideSelection = false;
 }
Exemplo n.º 5
0
 void IDropTarget.Drop(IDataObject pDataObj,
                       int grfKeyState, Point pt,
                       ref int pdwEffect)
 {
     if (_mDragTarget != null)
     {
         _mDragTarget.Drop(pDataObj, grfKeyState, pt,
                           ref pdwEffect);
         _mDragTarget.Dispose();
         _mDragTarget = null;
     }
 }
Exemplo n.º 6
0
    public void OnDrop(PointerEventData eventData)
    {
        if (DragTarget.attacking)
        {
            DragTarget d = eventData.pointerDrag.GetComponent <DragTarget>();

            if (d != null)
            {
                d.parentToReturnTo = this.transform;
            }
        }
    }
            /// <summary>
            /// Add the new target to the cluster.
            /// </summary>
            /// <param name="target">Target to add into cluster.</param>
            public void Add(DragTarget target)
            {
                // Find the hint that excludes extra flags
                DragTargetHint hint = target.Hint & DragTargetHint.ExcludeFlags;

                // Can only add one of each hint value
                if (!_hintToTarget.ContainsKey(hint))
                {
                    _hintToTarget.Add(hint, target);

                    // Make sure the drawing rectangle encloses all targets
                    DrawRect = Rectangle.Union(DrawRect, target.DrawRect);
                }
            }
 /// <summary>
 /// Initialize a new instance of the DockCluster class.
 /// </summary>
 /// <param name="paletteDragDrop">Drawing palette.</param>
 /// <param name="renderer">Drawing renderer.</param>
 /// <param name="target">Initial target for the cluster.</param>
 public DockCluster(IPaletteDragDrop paletteDragDrop,
                    IRenderer renderer,
                    DragTarget target)
 {
     _paletteDragDrop = paletteDragDrop;
     _renderer        = renderer;
     ScreenRect       = target.ScreenRect;
     DrawRect         = target.DrawRect;
     _hintToTarget    = new HintToTarget
     {
         { target.Hint& DragTargetHint.ExcludeFlags, target }
     };
     ExcludeCluster = (target.Hint & DragTargetHint.ExcludeCluster) == DragTargetHint.ExcludeCluster;
 }
Exemplo n.º 9
0
        internal void DoDragDrop()
        {
            if (DockManager.LayoutRootPanel.RootGroupPanel?.DropMode != DropMode.None)
            {
                DockManager.LayoutRootPanel.RootGroupPanel?.OnDrop(_dragItem);
            }
            else if (DragTarget?.DropMode != DropMode.None)
            {
                DragTarget?.OnDrop(_dragItem);
            }

            IsDragging = false;

            AfterDrag();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Called to request feedback be shown for the specified target.
        /// </summary>
        /// <param name="screenPt">Current screen point of mouse.</param>
        /// <param name="target">Target that needs feedback.</param>
        /// <returns>Updated drag target.</returns>
        public override DragTarget Feedback(Point screenPt, DragTarget target)
        {
            // If the current target no longer matches the new point, we need a new target.
            if ((target != null) && !target.IsMatch(screenPt, PageDragEndData))
                target = null;

            // Only find a new target if we do not already have a target
            if (target == null)
                target = FindTarget(screenPt, PageDragEndData);

            if (_solid != null)
                _solid.SolidRect = (target != null) ? target.DrawRect : Rectangle.Empty;

            return target;
        }
Exemplo n.º 11
0
        void Interop.IDropTarget.DragEnter(ComTypes.IDataObject pDataObj, MK grfKeyState, Point pt, ref DragDropEffects pdwEffect)
        {
            Point    clientLocation = m_TreeView.PointToClient(pt);
            TreeNode node           = m_TreeView.HitTest(clientLocation).Node;

            DragTarget.Data          = pDataObj;
            m_TreeView.HideSelection = true;

            if (node != null)
            {
                m_DragTarget = new DragTarget(node, grfKeyState, pt, ref pdwEffect);
            }
            else
            {
                pdwEffect = 0;
                //return -1;
            }
            //return 0;
        }
Exemplo n.º 12
0
        void IDropTarget.DragEnter(IDataObject pDataObj,
                                   int grfKeyState, Point pt,
                                   ref int pdwEffect)
        {
            var clientLocation = _mTreeView.PointToClient(pt);
            var node           = _mTreeView.HitTest(clientLocation).Node;

            DragTarget.Data          = pDataObj;
            _mTreeView.HideSelection = true;

            if (node != null)
            {
                _mDragTarget = new DragTarget(node, grfKeyState, pt,
                                              ref pdwEffect);
            }
            else
            {
                pdwEffect = 0;
            }
        }
        /// <summary>
        /// Called to request feedback be shown for the specified target.
        /// </summary>
        /// <param name="screenPt">Current screen point of mouse.</param>
        /// <param name="target">Target that needs feedback.</param>
        /// <returns>Updated drag target.</returns>
        public override DragTarget Feedback(Point screenPt, DragTarget target)
        {
            // If the current target no longer matches the new point, we need a new target.
            if ((target != null) && !target.IsMatch(screenPt, PageDragEndData))
            {
                target = null;
            }

            // Only find a new target if we do not already have a target
            if (target == null)
            {
                target = FindTarget(screenPt, PageDragEndData);
            }

            if (_solid != null)
            {
                _solid.SolidRect = target?.DrawRect ?? Rectangle.Empty;
            }

            return(target);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Called to request feedback be shown for the specified target.
 /// </summary>
 /// <param name="screenPt">Current screen point of mouse.</param>
 /// <param name="target">Target that needs feedback.</param>
 /// <returns>Updated drag target.</returns>
 public abstract DragTarget Feedback(Point screenPt, DragTarget target);
Exemplo n.º 15
0
        void Interop.IDropTarget.DragOver(int grfKeyState, Point pt,
                                          ref int pdwEffect)
        {
            Point clientLocation = m_TreeView.PointToClient(pt);
            TreeNode node = m_TreeView.HitTest(clientLocation).Node;

            CheckDragScroll(clientLocation);

            if (node != null)
            {
                if ((m_DragTarget == null) ||
                    (node != m_DragTarget.Node))
                {

                    if (m_DragTarget != null)
                    {
                        m_DragTarget.Dispose();
                    }

                    m_DragTarget = new DragTarget(node, grfKeyState,
                                                  pt, ref pdwEffect);
                }
                else
                {
                    m_DragTarget.DragOver(grfKeyState, pt, ref pdwEffect);
                }
            }
            else
            {
                pdwEffect = 0;
            }
        }
Exemplo n.º 16
0
        void Interop.IDropTarget.DragEnter(ComTypes.IDataObject pDataObj,
                                           int grfKeyState, Point pt,
                                           ref int pdwEffect)
        {
            Point clientLocation = m_TreeView.PointToClient(pt);
            TreeNode node = m_TreeView.HitTest(clientLocation).Node;

            DragTarget.Data = pDataObj;
            m_TreeView.HideSelection = true;

            if (node != null)
            {
                m_DragTarget = new DragTarget(node, grfKeyState, pt,
                                              ref pdwEffect);
            }
            else
            {
                pdwEffect = 0;
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// Called to request feedback be shown for the specified target.
 /// </summary>
 /// <param name="screenPt">Current screen point of mouse.</param>
 /// <param name="target">Target that needs feedback.</param>
 /// <returns>Updated drag target.</returns>
 public abstract DragTarget Feedback(Point screenPt, DragTarget target);