Esempio n. 1
0
        void OnMouseDown(MouseDownEvent evt)
        {
            textInputField.SyncTextEngine();
            m_Changed = false;

            if (!textInputField.hasFocus)
            {
                editorEngine.m_HasFocus = true;

                editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, evt.button == (int)MouseButton.LeftMouse && evt.shiftKey);

                if (evt.button == (int)MouseButton.LeftMouse)
                {
                    textInputField.CaptureMouse();
                }

                evt.StopPropagation();
            }
            else if (evt.button == (int)MouseButton.LeftMouse)
            {
                if (evt.clickCount == 2 && textInputField.doubleClickSelectsWord)
                {
                    editorEngine.SelectCurrentWord();
                    editorEngine.DblClickSnap(TextEditor.DblClickSnapping.WORDS);
                    editorEngine.MouseDragSelectsWholeWords(true);
                    m_DragToPosition = false;
                }
                else if (evt.clickCount == 3 && textInputField.tripleClickSelectsLine)
                {
                    editorEngine.SelectCurrentParagraph();
                    editorEngine.MouseDragSelectsWholeWords(true);
                    editorEngine.DblClickSnap(TextEditor.DblClickSnapping.PARAGRAPHS);
                    m_DragToPosition = false;
                }
                else
                {
                    editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, evt.shiftKey);
                    m_SelectAllOnMouseUp = false;
                }

                textInputField.CaptureMouse();
                evt.StopPropagation();
            }
            else if (evt.button == (int)MouseButton.RightMouse)
            {
                if (editorEngine.cursorIndex == editorEngine.selectIndex)
                {
                    editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, false);
                }
                m_SelectAllOnMouseUp = false;
                m_DragToPosition     = false;
            }

            // Scroll offset might need to be updated
            editorEngine.UpdateScrollOffset();
        }
Esempio n. 2
0
 protected override void OnMouseDown(UnityEngine.UIElements.MouseDownEvent e)
 {
     if (m_Active)
     {
         e.StopImmediatePropagation();
         return;
     }
     if (CanStartManipulation(e))
     {
         m_Active = true;
         target.CaptureMouse();
         m_ClickOrigin = GetImageCoord(Image, e.localMousePosition);
         Vector2Int[] coords = GetTargetCoords(m_ClickOrigin);
         uPixel.DrawBuffer(coords);
     }
     e.StopPropagation();
 }
Esempio n. 3
0
        protected void OnMouseDown(MouseDownEvent e)
        {
            if (m_Active)
            {
                e.StopImmediatePropagation();
                return;
            }

            if (CanStartManipulation(e))
            {
                m_Start = e.localMousePosition;

                m_Active = true;
                target.CaptureMouse();
                e.StopPropagation();
            }
        }
Esempio n. 4
0
        private void OnMouseDown(MouseDownEvent evt)
        {
            base.textInputField.SyncTextEngine();
            this.m_Changed = false;
            bool flag = !base.textInputField.hasFocus;

            if (flag)
            {
                base.editorEngine.m_HasFocus = true;
                base.editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, evt.button == 0 && evt.shiftKey);
                bool flag2 = evt.button == 0;
                if (flag2)
                {
                    base.textInputField.CaptureMouse();
                }
                evt.StopPropagation();
            }
            else
            {
                bool flag3 = evt.button == 0;
                if (flag3)
                {
                    bool flag4 = evt.clickCount == 2 && base.textInputField.doubleClickSelectsWord;
                    if (flag4)
                    {
                        base.editorEngine.SelectCurrentWord();
                        base.editorEngine.DblClickSnap(TextEditor.DblClickSnapping.WORDS);
                        base.editorEngine.MouseDragSelectsWholeWords(true);
                        this.m_DragToPosition = false;
                    }
                    else
                    {
                        bool flag5 = evt.clickCount == 3 && base.textInputField.tripleClickSelectsLine;
                        if (flag5)
                        {
                            base.editorEngine.SelectCurrentParagraph();
                            base.editorEngine.MouseDragSelectsWholeWords(true);
                            base.editorEngine.DblClickSnap(TextEditor.DblClickSnapping.PARAGRAPHS);
                            this.m_DragToPosition = false;
                        }
                        else
                        {
                            base.editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, evt.shiftKey);
                            this.m_SelectAllOnMouseUp = false;
                        }
                    }
                    base.textInputField.CaptureMouse();
                    evt.StopPropagation();
                }
                else
                {
                    bool flag6 = evt.button == 1;
                    if (flag6)
                    {
                        bool flag7 = base.editorEngine.cursorIndex == base.editorEngine.selectIndex;
                        if (flag7)
                        {
                            base.editorEngine.MoveCursorToPosition_Internal(evt.localMousePosition, false);
                        }
                        this.m_SelectAllOnMouseUp = false;
                        this.m_DragToPosition     = false;
                    }
                }
            }
            base.editorEngine.UpdateScrollOffset();
        }