Gui element "scroll-pane" scroll-state read/write

Things that we aren't going to implement
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Gui element "scroll-pane" scroll-state read/write

Post by eradicator »

What?
The ability to create a scroll-pane and set the initially visible portion of the pane to something other than the top.

Whaat?
When a scroll-pane is newly created the scroll pane will always show the upper left corner. I would like to be able to control which part of the scroll-pane is displayed by default without inhibiting the users ability to scroll up/down later.

Why?
When a user closes and reopens a scroll-panel (i.e. the panel is recreated) it is desireable for a mod to display the same section of the panel that was displayed when the panel was closed. This would also make it possible to have behavior like the # operator on web pages that allows a user to quickly jump to a subsection of e.g. a wikipedia article without having to create a seperate page for every subsection.

How?
Two [r/w] float values vertical_scroll_state and horizontal_scroll_state would suffice. These would give a percentage value of how far down the panel should be scrolled down. Additionaly an event on_scroll_state_changed would also be nice to ensure a mod always knows the last scroll state (as in certain circumstances there might be no event called before a gui element is destroyed, leaving no time to read the last state).

Usecases
  1. Jumping directly to a part of the scroll-pane.
  2. Adding hotkey navigation to a scroll-pane.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Gui element "scroll-pane" scroll-state read/write

Post by Bilka »

Hey, this was implemented at some point with https://lua-api.factorio.com/latest/Lua ... to_element and scroll_to_top/bottom/left/right.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Gui element "scroll-pane" scroll-state read/write

Post by eradicator »

Bilka wrote:
Thu Dec 03, 2020 12:16 pm
Hey, this was implemented at some point with https://lua-api.factorio.com/latest/Lua ... to_element and scroll_to_top/bottom/left/right.
I'm sorry, but i still don't see any way to read the current state of a scroll pane. There's only write methods. But without read it's impossible to restore the exact state of a gui element after it was closed/destroyed. Or adjust the scroll position when elements are added/removed from an open gui to prevent visual jitter, etc.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Gui element "scroll-pane" scroll-state read/write

Post by Bilka »

Oops, I missed the "read" when reading the title and assumed you'd know what element you want to jump to.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Gui element "scroll-pane" scroll-state read/write

Post by Rseding91 »

Sorry, but this is in the same realm as 92021 and isn't likely to ever be implemented.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Gui element "scroll-pane" scroll-state read/write

Post by eradicator »

Rseding91 wrote:
Thu Dec 03, 2020 5:56 pm
Sorry, but this is in the same realm as 92021 and isn't likely to ever be implemented.
Welp. Not unexpected given the thread was more than 2 years old ;). At least now it's official.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Won't implement”