Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add scrollbaroptions FormSpec element #8530
This PR adds a
Valid options are:
Some potential examples:
If the step value is negative, it will use Irrlicht's defaults. If the max is less than or equal to the min, the scrollbar element will have no bar and do nothing, i.e. disabled. If thumbsize is zero or less, it defaults to 1 (which usually will appear as a square).
This PR is Ready for Review.
I'm trying to incorporate the new
I have rebased as evidenced by this file: https://github.com/v-rob/minetest/blob/scrollbaroptions/src/gui/guiScrollBar.cpp. I believe the problem lies in the instantiation of
I still have two bugs to iron out before this PR can be merged: First, I still don't think that I have
If you want the default quadratic slider rectangle, you have to set page_size as large as possible, this results in a thumb_size of (nearly) 0, which is smaller than thumb_min and will ergo be set to thumb_min.
If the length of the scrollbar (including borders) is the length of the visible part of the whole page that you scroll over, page_size is the length of the whole page.
The length of the scrollbar over page_size is kept equal to thumb_size over thumb_area.
Imo, this is very confusing and not really useful for modders.
Maybe just give the thumb size in scrollbar units.
Example 1: The whole page is 1000 scrollbar units long (max-min). (In pixels it's
Example 2: You can choose one number out of 10 with a scrollbar (from 0 to 9). Ergo min is 0 and max is 9. And thumb_size in scrollbar units is 1 because it's always one number at a time.
Now, the question is: How to convert thumb_size in scrollbar units into page_size in pixels?
s32 scrollbar_size; if (is_horizontal) scrollbar_size = dim.X; else scrollbar_size = dim.Y; e->setPageSize(scrollbar_size * (max-min+1) / data->scrollBarOptions.thumbSize);
Edit: This is done now.