Skip to content

Commit

Permalink
! Fix "narrowing conversion" warnings. resolves #1
Browse files Browse the repository at this point in the history
* Change `_calculate_layout` to actually not apply when `apply` is false.
  • Loading branch information
Wcubed committed May 31, 2021
1 parent 004e19e commit 87d6967
Show file tree
Hide file tree
Showing 17 changed files with 6 additions and 5 deletions.
Empty file modified .gdignore
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified example_scenes/example_1.tscn
100644 → 100755
Empty file.
Empty file modified example_scenes/resources/.gdignore
100644 → 100755
Empty file.
Empty file modified example_scenes/resources/default.theme
100644 → 100755
Empty file.
11 changes: 6 additions & 5 deletions h_flow_container/h_flow_container.gd
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export var vertical_margin: float = 5

# Used to make our parent re-evaluate our size when we have to create more or
# less rows to fit in all the children.
var _reported_height_at_last_minimum_size_call := 0
var _reported_height_at_last_minimum_size_call: float = 0

# Called when the node enters the scene tree for the first time.
func _ready():
Expand All @@ -27,7 +27,7 @@ func _ready():

func _get_minimum_size() -> Vector2:
# Our minimum width is the width of the widest child.
var max_requested_width := 0
var max_requested_width: float = 0

for child in get_children():
# Check if the child is actually a `Control`.
Expand Down Expand Up @@ -66,9 +66,9 @@ func _notification(what):
func _calculate_layout(apply: bool) -> float:
# Where to place the next child.
var next_location: Vector2 = Vector2(0, 0)
var row_height: int = 0
var row_height: float = 0
# Used to calculate when to apply the horizontal margin.
var children_in_current_row := 0
var children_in_current_row: float = 0

for child in get_children():
# Check if the child is actually a `Control`.
Expand All @@ -92,7 +92,8 @@ func _calculate_layout(apply: bool) -> float:
row_height = 0
children_in_current_row = 0

fit_child_in_rect(child, Rect2(next_location, requested_size))
if apply:
fit_child_in_rect(child, Rect2(next_location, requested_size))

if requested_size.y > row_height:
row_height = requested_size.y
Expand Down
Empty file modified h_flow_container/h_flow_container.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified h_flow_container/h_flow_container.svg.import
100644 → 100755
Empty file.
Empty file modified icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified icon.png.import
100644 → 100755
Empty file.
Empty file modified icon.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified icon.svg.import
100644 → 100755
Empty file.
Empty file modified project.godot
100644 → 100755
Empty file.
Empty file modified readme.md
100644 → 100755
Empty file.
Empty file modified screenshots/.gdignore
100644 → 100755
Empty file.
Empty file modified screenshots/example_1.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87d6967

Please sign in to comment.