Git Product home page Git Product logo

Comments (5)

RonenNess avatar RonenNess commented on August 18, 2024 1

I think its fixed in dev branch (did a lot of work on PanelTabs and scrollers and tried to reproduce using a modified version of the code you gave me - looks good now).
I'll release a version soon, if its not fixed in the new version please reopen this ticket.

Thanks :)

from geonbit.ui.

RonenNess avatar RonenNess commented on August 18, 2024

Hello @SerialKicked,

Just making sure, did you set scrollbar max value or alternatively set panel.Scrollbar.AdjustMaxAutomatically = true;?
Thanks,

Edit: Also, i dunno if it's related or not, elements out of the view (here, the ~990 following lines) are still apparently being drawn/processed. The above example decreased my FPS massively. While it's not really something that would happen with real code, that information might be relevant.

Thanks for the tip. Up until now I didn't optimize the UI based on culling, as UIs are commonly entirely in screen and the panels with scrollbars are quite new. I don't view this as an urgent feature but it could be nice, maybe for future versions :)

from geonbit.ui.

SerialKicked avatar SerialKicked commented on August 18, 2024

No i didn't. I assumed PanelOverflowBehavior would automatically set the values for the scrollbar, I've not seen AdjustMaxAutomatically in the doc either hence my confusion.

However, i just tried and it triggered another interesting result:

snap6

The bar itself is scrolling with the panel's content (It's the same with the much simpler sample code of earlier, scrollbar will even completely scroll out of view).

from geonbit.ui.

RonenNess avatar RonenNess commented on August 18, 2024

Can you post the code that creates the panel from the screenshot?

from geonbit.ui.

SerialKicked avatar SerialKicked commented on August 18, 2024

It's quite a lot of code with sub elements and function calls.
The problem is exactly the same with the code i posted earlier.

        protected override void BuildMenu()
        {
            MainPanel = new Panel(new Vector2(850, 400), PanelSkin.Default, Anchor.BottomCenter, new Vector2(0,100));
            PanelTabs tabs = new PanelTabs();
            MainPanel.AddChild(tabs);

            var cluttertab = tabs.AddTab(Global.catalog.GetString("Furniture"));
            cluttertab.panel.Padding = new Vector2(10,20);
            // List buildable clutter
            buildlist = GetClutterList(CreativeMode);
            cluttertab.panel.PanelOverflowBehavior = PanelOverflowBehavior.VerticalScroll;
            foreach (var item in buildlist)
            {
                Texture2D isprite = World.DB.Sprites[item.SpriteFile[0]];
                var isize = new Vector2(64, 64);
                var itxt = item.Name;

                var pan = Overlay.AddIcon(isprite, itxt, new Vector2(200, 100), Anchor.AutoInline);
                pan.AttachedData = item;
                // [cut] OnClick events 
                cluttertab.panel.AddChild(pan);
            }
            cluttertab.panel.Scrollbar.AdjustMaxAutomatically = true;
            // [cut] other tabs
        }

AddIcon looks like this

        /// <summary>
        /// Build "icon" looking UI element
        /// </summary>
        public static Panel AddIcon(Texture2D pTexture, string pTitle, Vector2 pSize, Anchor pAnchor)
        {
            var panel = new Panel(pSize, PanelSkin.None, pAnchor)
            {
                Padding = new Vector2(5, 5)
            };
            Icon icon = new Icon(IconType.None, Anchor.TopCenter, 1)
            {
                Texture = pTexture
            };
            panel.AddChild(icon);
            panel.AddChild(new Paragraph(pTitle, Anchor.BottomCenter));
            return panel;
        }

from geonbit.ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.