diff options
Diffstat (limited to 'option_set')
| -rw-r--r-- | option_set/option_set_list.gd | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/option_set/option_set_list.gd b/option_set/option_set_list.gd index 4a8841f..1ab753b 100644 --- a/option_set/option_set_list.gd +++ b/option_set/option_set_list.gd @@ -5,11 +5,11 @@ const POINTER_VELOCITY_DECAYING_FACTOR: float = PI const POINTER_VELOCITY_BOOST_FACTOR: float = 1.25 const EXACT_SELECTION: bool = false -export var clear_signals_on_hide := true - signal selection_changed # (idx: int, text: String) +export var clear_signals_on_hide := true export var autowrap := true +export var separation := 25 var v_scroll_bar : VScrollBar var sensor : PointerInputSensor @@ -58,17 +58,7 @@ func _init(): sensor.anchor_bottom = 1.0 sensor.name = "sensor" add_child(sensor) - - normal_style = StyleBoxFlat.new() - normal_style.border_width_bottom = border_size - normal_style.border_color = Color.white * 0.333 - normal_style.bg_color = Color.transparent - - selected_style = StyleBoxFlat.new() - selected_style.border_width_bottom = border_size - selected_style.border_color = Color.white * 0.333 - selected_style.bg_color = Color.dimgray - + connect("resized", self, "mark_as_dirty") sensor.connect("on_press", self, "pointer_input_on_press_handler") @@ -78,9 +68,17 @@ func _init(): sensor.connect("on_scroll", self, "pointer_input_on_scroll_handler") -#func _ready(): -# for idx in range(5): -# add_item(">> %d" % idx) +func _ready(): + normal_style = StyleBoxFlat.new() + normal_style.border_width_bottom = border_size + normal_style.border_color = Color.white * 0.333 + normal_style.bg_color = Color.transparent + + selected_style = StyleBoxFlat.new() + var bg_color = get_stylebox("pressed", "Button").bg_color + selected_style.border_width_bottom = border_size + selected_style.border_color = bg_color.lightened(0.333) + selected_style.bg_color = bg_color func mark_as_dirty(): @@ -143,7 +141,7 @@ func build_labels(): var label := Label.new() label.autowrap = autowrap label.anchor_right = 1.0 - label.valign = Label.VALIGN_TOP + label.valign = Label.VALIGN_CENTER labels.add_child(label) delta -= 1 @@ -166,7 +164,7 @@ func build_labels(): for it in items: proto_label.text = it var line_count := proto_label.get_line_count() - var height := line_count * line_height + (line_count - 1) * line_spacing + border_size + var height := line_count * line_height + (line_count - 1) * line_spacing + border_size + separation position += height labels_end_positions.append(position) |
