public override void MouseMove(MouseButtons button, PointF location, Keys controlKeys)
        {
            if (m_Editor == null)
            {
                return;
            }
            GraphicBaseElement element = m_Editor.GetElementAt(location);

            if (element != m_SelectedElement && element is GraphicInputOutputElement)
            {
                m_SelectedElement = element;
            }
            if (m_HighLightElement != null && !m_HighLightElement.Equals(element) && m_HighLightElement.Highlighted)
            {
                //Un-Hover the element
                m_HighLightElement.Highlighted = false;
                m_HighLightElement             = null;
                m_Editor.UpdateBackground();
                m_Editor.Invalidate();
            }
            if (element != null && !element.Highlighted && element is GraphicInputOutputElement)
            {
                //Hover an element
                m_HighLightElement             = element;
                m_HighLightElement.Highlighted = true;
                m_Editor.UpdateBackground();
                m_Editor.Invalidate();
            }
        }
Пример #2
0
        public override void MouseMove(MouseButtons button, PointF location, Keys controlKeys)
        {
            if (m_Editor == null)
            {
                return;
            }
            GraphicBaseElement element = m_Editor.GetElementAt(location);

            if (m_HighLightElement != null)
            {
                if (element == null ||
                    (element.Equals(m_ParentElement) == false && m_HighLightElement is GraphicTerminal) ||
                    (element.Equals(m_HighLightElement) == false && m_HighLightElement is GraphicConnection))
                {
                    //Un-Hover the element
                    UnHighlightElement(m_HighLightElement);
                    return;
                }
            }
            if (element is GraphicInputOutputElement)
            {
                GraphicInputOutputElement ioelem          = element as GraphicInputOutputElement;
                GraphicTerminal           graphicTerminal = ioelem.GetTerminalAt(location);
                if (graphicTerminal != null)
                {
                    if ((graphicTerminal.LinkedObject as Terminal).IsConnected == false)
                    {
                        //Hover an element
                        m_ParentElement = element;
                        HighlightElement(graphicTerminal);
                    }
                }
                else if (m_HighLightElement != null)
                {
                    //Un-Hover the element
                    UnHighlightElement(m_HighLightElement);
                }
            }
            if (element is GraphicConnection)
            {
                if (m_HighLightElement == null)
                {
                    //Hover an element
                    HighlightElement(element);
                }
            }
        }
        public override void MouseMove(MouseButtons button, PointF location, Keys controlKeys)
        {
            if (m_Editor == null)
            {
                return;
            }
            if (button == MouseButtons.Left && m_SelectedElement != null && m_SelectedElement is GraphicConnection == false)
            {
                PointF newloc = m_Editor.AlignToGrid(new PointF(location.X - m_SelectionOffset.X, location.Y - m_SelectionOffset.Y));
                if (newloc.Equals(m_SelectedElement.Location) == false)
                {
                    //m_HighLightElement.Highlighted = false;
                    m_SelectedElement.Location = newloc;
                    m_Editor.RaiseChangedEvent();
                    m_Editor.UpdateBackground();
                    m_Editor.UpdateDrawing();
                    m_Editor.Invalidate();
                }
                return;
            }
            GraphicBaseElement element = m_Editor.GetElementAt(location);

            if (m_HighLightElement != null && !m_HighLightElement.Equals(element) && m_HighLightElement.Highlighted)
            {
                //Un-Hover the element
                m_HighLightElement.Highlighted = false;
                m_HighLightElement             = null;
                m_Editor.UpdateBackground();
                m_Editor.Invalidate();
            }
            if (element != null && !element.Highlighted)
            {
                //Hover an element
                m_HighLightElement             = element;
                m_HighLightElement.Highlighted = true;
                m_Editor.UpdateBackground();
                m_Editor.Invalidate();
            }
        }