From 0b877eeaff204e7f41544b04358bb947497a0fd4 Mon Sep 17 00:00:00 2001 From: domi41 Date: Wed, 12 Aug 2020 01:07:51 +0200 Subject: [PATCH] feat: move the results graph to the top left and truncate text --- .../nodes/MajorityJudgmentLinearResultsControl.gd | 10 ++++++++-- .../nodes/MajorityJudgmentLinearResultsControl.tscn | 13 ++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.gd b/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.gd index 097293f..bc8c849 100644 --- a/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.gd +++ b/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.gd @@ -11,6 +11,9 @@ const MeritProfileScene = preload("res://addons/majority_judgment/nodes/Majority export(Resource) var poll setget set_poll, get_poll export(int) var vertical_gap := 4 # pixels +export(int) var candidates_labels_width := 200 # pixels + +onready var ProfilesContainer = find_node("ProfilesContainer", true) var provider:MajorityJudgmentAbstractJudgmentsProvider @@ -43,7 +46,7 @@ func craft_nodes(): var height = profile.compute_height() profile.rect_min_size = Vector2(400, height) - var container = $CenterContainer/ProfilesContainer + var container = self.ProfilesContainer var wrapper = HBoxContainer.new() wrapper.name = "Candidate%sLine" % char(candidate_index+65) @@ -62,7 +65,10 @@ func craft_nodes(): candidate_label.text = candidate.get_name() candidate_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL # candidate_label.size_flags_vertical = Control.SIZE_EXPAND_FILL - candidate_label.rect_min_size = Vector2(70, height) + candidate_label.rect_min_size = Vector2(candidates_labels_width, height) + candidate_label.rect_size = Vector2(candidates_labels_width, height) + candidate_label.clip_text = true + candidate_label.autowrap = true candidate_label.valign = Label.VALIGN_CENTER candidate_label.align = Label.ALIGN_RIGHT wrapper.add_child(candidate_label) diff --git a/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.tscn b/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.tscn index 43eed6e..f361661 100644 --- a/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.tscn +++ b/addons/majority_judgment/nodes/MajorityJudgmentLinearResultsControl.tscn @@ -10,6 +10,12 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="ProfilesContainer" type="Control" parent="."] +rect_min_size = Vector2( 600, 400 ) +__meta__ = { +"_edit_use_anchors_": false +} + [node name="CenterContainer" type="CenterContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 @@ -17,11 +23,4 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="ProfilesContainer" type="Control" parent="CenterContainer"] -margin_left = 212.0 -margin_top = 99.0 -margin_right = 812.0 -margin_bottom = 499.0 -rect_min_size = Vector2( 600, 400 ) - [node name="Tween" type="Tween" parent="."]