Exemple #1
0
        /// <summary>
        /// Fires on mouse out when idle
        /// </summary>
        /// <param name="e"></param>
        private void IdleMouseOutHandler(Event e)
        {
            MouseEvent me = (MouseEvent)e;

            if (_component.Bounds.Contains(_component.GlobalToLocal(me.GlobalPosition)))
            {
                return; // still inside
            }
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("IdleMouseOutHandler");
            }
#endif
            if (DragManager.IsDragging)
            {
                return;
            }

            e.Cancel();

            DoRenderOverlay = false;

            HideCursor();
            StopScanning();

            _previousResizeMode = null;
        }
Exemple #2
0
        /// <summary>
        /// We should listen the mouse move events over the component
        /// If mouse moved over the event, we should check border and draw overlay
        /// </summary>
        /// <param name="e"></param>
        private void ComponentMouseMoveHandler(Event e)
        {
            if (!Enabled)
            {
                return;
            }

            Debug.Log(string.Format("ComponentMouseMoveHandler [{0}, {1}]", e.Phase, e.CurrentTarget));

            if (!(e.Target is DisplayListMember))
            {
                return;
            }

            DisplayListMember dlm = (DisplayListMember)e.Target;

            MouseEvent me = (MouseEvent)e;

            //Container container = _component as Container;

            //Point coordsInComponentSpace = null != container ?
            //      container.GlobalToContent(dlm.LocalToGlobal(me.LocalPosition)) :
            //      _component.GlobalToLocal(dlm.LocalToGlobal(me.LocalPosition));

            Point coordsInComponentSpace = _component.GlobalToLocal(dlm.LocalToGlobal(me.LocalPosition));

            // if some component is already being dragged/resized, do not draw borders on hover
            if (DragManager.IsDragging)
            {
                return;
            }

            if (_constraintMode)
            {
                _constrainedRect = _constraintMetrics.GetConstrainedRectangle(_component.Transform.LocalBounds);
                DoRenderOverlay  = _constrainedRect.Contains(coordsInComponentSpace);
            }
            else
            {
                DoRenderOverlay = true;
            }

            if (DoRenderOverlay)
            {
                e.Cancel();
            }
        }