aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--option_set/option_set_list.gd27
-rw-r--r--readme.md1
2 files changed, 20 insertions, 8 deletions
diff --git a/option_set/option_set_list.gd b/option_set/option_set_list.gd
index 1be9442..3cff78d 100644
--- a/option_set/option_set_list.gd
+++ b/option_set/option_set_list.gd
@@ -39,11 +39,12 @@ var items: Array = [
"This is the longest item of all, but eventually stops.",
]
+# @DAM List of ideas to implement on this element:
+# - Allow to toggle word-wrap on or off;
+# - Allow to change items;
+# - Only build and process labels when needed;
func _init():
- font = get_font("font")
- connect("resized", self, "build_labels")
-
labels = Control.new()
labels.anchor_right = 1.0
labels.anchor_bottom = 1.0
@@ -55,6 +56,19 @@ func _init():
vscrollbar.grow_horizontal = Control.GROW_DIRECTION_BEGIN
vscrollbar.name = "vscrollbar"
add_child(vscrollbar)
+
+ font = get_font("font")
+ connect("resized", self, "build_labels")
+
+
+# @DAM We connect build_labels to resized during init. This calls build_labels immediately and the
+# labels.rect_size is still not properly set thus, making the max_required_labels to return an
+# incorrect value. To patch this, we are calling build_labels again on the _ready. Maybe we can sort
+# this out in a cleaner way?
+func _ready():
+ build_labels()
+
+
# @DAM This is only used once so, why not inline it?
func max_required_labels() -> int:
@@ -90,9 +104,7 @@ func process_labels():
labels_positions.clear()
labels_sizes.clear()
var position := 0.0
- var limit := rect_size.x
- limit = labels.rect_size.x
-# labels_positions.append(0)
+ var limit := labels.rect_size.x
for it in items:
var size := font.get_wordwrap_string_size(it, limit).y
@@ -127,8 +139,7 @@ func _process(delta):
var bs_value := offset / ratio
var offset_idx := labels_positions.bsearch(bs_value)
-# offset_idx = 0
- var wasted := 0
+ var wasted := 0 # @DAM To be removed.
var idx := 0
for label in labels.get_children():
if idx + offset_idx >= items.size():
diff --git a/readme.md b/readme.md
index 371eee6..4db4993 100644
--- a/readme.md
+++ b/readme.md
@@ -48,6 +48,7 @@ Surgery Log
- [x] Tweak 'POINTER_VELOCITY_DECAYING_FACTOR' and 'POINTER_VELOCITY_BOOST_FACTOR' on database and stage screens;
- [x] Allow to parse option sets from database file;
- [x] Check if import_option_sets, store_option_sets, store_database require the parameter save_changes; this requires changes on databse, stage and menu scripts;
+- [ ] Fix option sets GUI element to provide word-wrap, otherwise long texts will be hidden;
- [ ] Fix back button:
- on stage screen should show pop-up asking it changes are to be discarded;
- on file-pickers screen should close them;