Esempio n. 1
0
        public TestSceneExpandingBar()
        {
            Container    container;
            ExpandingBar expandingBar;

            Add(container = new Container
            {
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                Children = new Drawable[]
                {
                    new Box
                    {
                        Colour           = Color4.Gray,
                        Alpha            = 0.5f,
                        RelativeSizeAxes = Axes.Both,
                    },
                    expandingBar = new ExpandingBar
                    {
                        Anchor        = Anchor.Centre,
                        ExpandedSize  = 10,
                        CollapsedSize = 2,
                        Colour        = Color4.DeepSkyBlue,
                    }
                }
            });

            AddStep(@"Collapse", () => expandingBar.Collapse());
            AddStep(@"Expand", () => expandingBar.Expand());
            AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
            AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
            AddStep(@"Anchor top", () => expandingBar.Anchor           = Anchor.TopCentre);
            AddStep(@"Vertical", () => expandingBar.RelativeSizeAxes   = Axes.Y);
            AddStep(@"Anchor left", () => expandingBar.Anchor          = Anchor.CentreLeft);
        }
Esempio n. 2
0
        private void updateState()
        {
            // Expand based on the local state
            bool shouldExpand = Active.Value || IsHovered;

            // Expand based on whether no build is selected and the badge area is hovered
            shouldExpand |= SelectedTab.Value == null && !externalDimRequested;

            if (shouldExpand)
            {
                expandingBar.Expand();
                fadeContainer.FadeTo(1, transition_duration);
            }
            else
            {
                expandingBar.Collapse();
                fadeContainer.FadeTo(0.5f, transition_duration);
            }

            text.FadeTo(externalDimRequested && !IsHovered ? 0.5f : 1, transition_duration);
        }