Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scrollbar.horizontal #74

Merged
merged 1 commit into from
Jul 21, 2022
Merged

Add scrollbar.horizontal #74

merged 1 commit into from
Jul 21, 2022

Conversation

unindented
Copy link
Contributor

(It can also serve as a slider, which is what I needed for adjusting music and sound fx volumes in my game. 馃槄)

Modified the example GUI to show it in action:

horizontal_scrollbar.mp4

@@ -66,6 +66,7 @@ nodes {
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: I don't know what these are about, but the editor added it to all components.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is a new thing introduced with custom GUI nodes, such as Spine nodes from the Spine extension.


scrollbar.refresh()
return scrollbar
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: This part is mostly copy-pasted from vertical, which I'm not super happy about. However, I thought introducing abstractions to keep things DRY would make it less readable. I defer to you @britzl.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is perfectly fine to be honest. Sure, the first 20 lines or so could be moved to a shared function perhaps, but lets keep it as it is!


scrollbar.enabled = core.is_enabled(handle)
scrollbar.node = handle
scrollbar.node_id = node_id
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Oops, node_id is never defined in here! M.vertical has the same problem!

@britzl was the original intention to set scrollbar.node_id = handle_id?

@unindented unindented mentioned this pull request Jul 21, 2022
Copy link
Owner

@britzl britzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@britzl britzl merged commit 1309986 into britzl:master Jul 21, 2022
@unindented unindented deleted the horizontal-scrollbar branch July 21, 2022 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants