Description
Describe the project you are working on
Want to customize the ScrollBar
related to the ScrollContainer
in the editor.
Describe the problem or limitation you are having in your project
The ScrollBar
associated with the ScrollContainer
is implemented as internal node for out-of-the-box purposes. This is good.
However, due to the limitation of internal nodes, we cannot customize its theme properties and layout properties in the editor very well.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The existing designs, the Range::share
function, and SCROLL_MODE_SHOW_NEVER
, have given us a good foundation. Only by making good use of these, the purpose of replacing internal ScrollBar
with external ScrollBar
can be simply achieved.
SCROLL_MODE_SHOW_NEVER
just hides theScrollBar
, but doesn't disable scrolling. This is exactly what we need.- The data required for scrolling is completely recorded by the internal
ScrollBar
. Range::share
makes it easy to share this data.
All the prerequisites are complete, we just need to let the ScrollBar
say hello to the ScrollContainer
.
Regarding watch, the main point is that the sharing is one-way, from internal nodes to external nodes, which allows multiple watchers. It's a bit like watching TV, whether TV controls people or people control TV, this is a question. It is definitely not a question of the amount of English vocabulary.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
- Mark the
ScrollContainer
's position in the tree using thewatch_target_path
property of typeNodePath
to remind who theScrollBar
is serving for. - When setting a new
watch_target_path
, and when entering the tree, try to find the corresponding internalScrollBar
from thewatch_target_path
according to the direction. And then try to share the internal data. - Attempts may or may not succeed. We use
watching
to indicate whether it was successful or not.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Not easy and requires more complex operations.
I'm sure a lot of people will be happy with the change from internal nodes to external nodes.
Is there a reason why this should be core and not an add-on in the asset library?
This is about improving the ScrollContainer
/ScrollBar
usability out of box.