コード例 #1
0
        private IEnumerator <float> HandleDragging()
        {
            _isHandling = true;
            Inspector           inspector = GetInspector();
            WorkspaceController workspace = App.Self.GetWorkspaceController();

            Dock.Dock dock   = App.Self.GetDock();
            int       margin = (int)App.Self.Preferences.AppearancePreferences.Get("ui_base_margin");

            while (true)
            {
                float dist = (RectGlobalPosition.x - GetGlobalMousePosition().x);
                inspector.MarginLeft = inspector.MarginLeft - dist;
                if (inspector.MarginLeft > _inspectorMinSize)
                {
                    inspector.MarginLeft = _inspectorMinSize;
                }
                else if (inspector.MarginLeft < _inspectorMaxSize)
                {
                    inspector.MarginLeft = _inspectorMaxSize;
                }

                workspace.MarginRight = inspector.MarginLeft;
                dock.MarginRight      = App.Self.HalfScreen - inspector.RectSize.x - margin;

                if (!Input.IsMouseButtonPressed(1) || _isHandling == false)
                {
                    _isHandling = false;
                    break;
                }

                yield return(0.000001f);
            }

            OnMouseExit();

            if (IsWithinBounds())
            {
                OnMouseEnter();
            }
        }
コード例 #2
0
        private void ToggleBinder(bool visible)
        {
            int margin = (int)App.Self.Preferences.AppearancePreferences.Get("ui_base_margin");

            if (_showing)
            {
                GetTween().InterpolateProperty(
                    this,
                    "rect_position",
                    RectGlobalPosition,
                    new Vector2(-RectSize.x - 2, RectGlobalPosition.y),
                    _showingSpeed,
                    Tween.TransitionType.Cubic,
                    Tween.EaseType.Out);

                WorkspaceController workspace = App.Self.GetWorkspaceController();
                GetTween().InterpolateProperty(
                    workspace,
                    "margin_left",
                    workspace.MarginLeft,
                    0,
                    _showingSpeed,
                    Tween.TransitionType.Cubic,
                    Tween.EaseType.Out);

                Dock.Dock dock = App.Self.Dock;
                GetTween().InterpolateProperty(
                    dock.ContentControl,
                    "margin_left",
                    dock.MarginLeft,
                    margin,
                    _showingSpeed,
                    Tween.TransitionType.Cubic,
                    Tween.EaseType.Out);

                GetTween().Start();
                _showing = false;
            }
            else
            {
                GetTween().InterpolateProperty(
                    this,
                    "rect_position",
                    RectGlobalPosition,
                    new Vector2(0, RectGlobalPosition.y),
                    _showingSpeed,
                    Tween.TransitionType.Cubic,
                    Tween.EaseType.Out);

                WorkspaceController workspace = App.Self.GetWorkspaceController();
                GetTween().InterpolateProperty(
                    workspace,
                    "margin_left",
                    workspace.MarginLeft,
                    RectSize.x,
                    _showingSpeed,
                    Tween.TransitionType.Cubic,
                    Tween.EaseType.Out);

                Dock.Dock dock = App.Self.Dock;
                GetTween().InterpolateProperty(
                    dock.ContentControl,
                    "margin_left",
                    dock.MarginLeft,
                    RectSize.x + margin,
                    _showingSpeed,
                    Tween.TransitionType.Cubic,
                    Tween.EaseType.Out);

                GetTween().Start();
                _showing = true;
            }
        }