restrict slider ui to slider fields

This commit is contained in:
GenevensiS
2025-12-13 23:06:18 +01:00
parent 3b7d4b617f
commit aa0791686e
3 changed files with 21 additions and 24 deletions
+9 -8
View File
@@ -33,14 +33,15 @@ public:
class Choice;
typedef intrusive_ptr<Choice> ChoiceP;
ChoiceP choices; ///< A choice group of possible choices
OptionalScript script; ///< Script to apply to all values
OptionalScript default_script; ///< Script that generates the default value
String initial; ///< Initial choice of a new value, or ""
String default_name; ///< Name of "default" value
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
map<String,Color> choice_colors_cardlist; ///< Colors for the various choices, for in the card list
ChoiceP choices; ///< A choice group of possible choices
OptionalScript script; ///< Script to apply to all values
OptionalScript default_script; ///< Script that generates the default value
String initial; ///< Initial choice of a new value, or ""
String default_name; ///< Name of "default" value
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
map<String,Color> choice_colors_cardlist; ///< Colors for the various choices, for in the card list
bool is_slider = false; ///< Should the UI be displayed as a slider?
void initDependencies(Context&, const Dependency&) const override;
void after_reading(Version ver) override;
};
+2
View File
@@ -35,6 +35,8 @@ IMPLEMENT_REFLECTION(SliderField) {
void SliderField::after_reading(Version ver) {
Field::after_reading(ver);
is_slider = true;
int choice_count = choices->choices.size();
if (maximum < minimum) swap(minimum, maximum);