Esempio n. 1
0
 public WindowDraggable(VisualElement handle = null)
 {
     m_Handle              = handle;
     m_Active              = false;
     m_PreviousParentRect  = new Rect(0f, 0f, 0f, 0f);
     m_WindowDockingLayout = new WindowDockingLayout();
 }
Esempio n. 2
0
 public WindowDraggable(VisualElement handle = null, bool resizeWithParentwindow = false)
 {
     m_Handle = handle;
     m_ResizeWithParentWindow = resizeWithParentwindow;
     m_Active              = false;
     m_PreviousParentRect  = new Rect(0f, 0f, 0f, 0f);
     m_WindowDockingLayout = new WindowDockingLayout();
 }
Esempio n. 3
0
        public WindowDraggable(VisualElement handle = null, VisualElement container = null)
        {
            m_Handle = handle;
            m_Active = false;
            m_WindowDockingLayout = new WindowDockingLayout();

            if (container != null)
            {
                container.RegisterCallback <GeometryChangedEvent>(OnParentGeometryChanged);
            }
        }
        public ResizeSideHandle(VisualElement resizeTarget, VisualElement container, ResizeHandleAnchor anchor)
        {
            m_WindowDockingLayout = new WindowDockingLayout();

            m_ResizeTarget = resizeTarget;
            m_Container    = container;

            AddToClassList("resize");

            switch (anchor)
            {
            case ResizeHandleAnchor.Top:
            {
                AddToClassList("vertical");
                AddToClassList("top");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromTop);
                break;
            }

            case ResizeHandleAnchor.TopRight:
            {
                AddToClassList("diagonal");
                AddToClassList("top-right");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromTopRight);
                break;
            }

            case ResizeHandleAnchor.Right:
            {
                AddToClassList("horizontal");
                AddToClassList("right");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromRight);
                break;
            }

            case ResizeHandleAnchor.BottomRight:
            {
                AddToClassList("diagonal");
                AddToClassList("bottom-right");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromBottomRight);
                break;
            }

            case ResizeHandleAnchor.Bottom:
            {
                AddToClassList("vertical");
                AddToClassList("bottom");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromBottom);
                break;
            }

            case ResizeHandleAnchor.BottomLeft:
            {
                AddToClassList("diagonal");
                AddToClassList("bottom-left");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromBottomLeft);
                break;
            }

            case ResizeHandleAnchor.Left:
            {
                AddToClassList("horizontal");
                AddToClassList("left");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromLeft);
                break;
            }

            case ResizeHandleAnchor.TopLeft:
            {
                AddToClassList("diagonal");
                AddToClassList("top-left");
                RegisterCallback <MouseMoveEvent>(HandleResizeFromTopLeft);
                break;
            }
            }

            RegisterCallback <MouseDownEvent>(HandleMouseDown);
            RegisterCallback <MouseUpEvent>(HandleDraggableMouseUp);

            m_ResizeTarget.RegisterCallback <GeometryChangedEvent>(InitialLayoutSetup);
        }