The RectEditor now will only set a margin of max 50.

This commit is contained in:
Relintai 2021-12-26 13:10:15 +01:00
parent 193ed69fef
commit 0a0f4ee865
2 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ locked = false
[sub_resource type="Resource" id=15] [sub_resource type="Resource" id=15]
resource_name = "we" resource_name = "we"
script = ExtResource( 4 ) script = ExtResource( 4 )
rect = Rect2( 7, 9, 54.14, 32.78 ) rect = Rect2( 7, 9, 54, 34 )
locked = false locked = false
[sub_resource type="Resource" id=8] [sub_resource type="Resource" id=8]
@ -27,14 +27,14 @@ subzones = [ SubResource( 14 ), SubResource( 15 ) ]
[sub_resource type="Resource" id=13] [sub_resource type="Resource" id=13]
resource_name = "qqq" resource_name = "qqq"
script = ExtResource( 3 ) script = ExtResource( 3 )
rect = Rect2( 8, 13, 200.4, 61.8 ) rect = Rect2( 17, 59, 200.4, 52 )
locked = false locked = false
subzones = [ ] subzones = [ ]
[sub_resource type="Resource" id=24] [sub_resource type="Resource" id=24]
resource_name = "trtrtr" resource_name = "trtrtr"
script = ExtResource( 3 ) script = ExtResource( 3 )
rect = Rect2( 0, 0, 24.1, 15.8 ) rect = Rect2( 0, 0, 57.1, 45.8 )
locked = false locked = false
subzones = [ ] subzones = [ ]
@ -82,7 +82,7 @@ func setup_property_inspector(inspector) -> void:
[sub_resource type="Resource" id=26] [sub_resource type="Resource" id=26]
resource_name = "trtrtr (Duplicate)" resource_name = "trtrtr (Duplicate)"
script = SubResource( 25 ) script = SubResource( 25 )
rect = Rect2( 0, 0, 24.1, 15.8 ) rect = Rect2( 64, 6, 158.1, 39.8 )
locked = false locked = false
subzones = [ ] subzones = [ ]

View File

@ -43,10 +43,10 @@ func refresh() -> void:
var p : MarginContainer = get_parent() as MarginContainer var p : MarginContainer = get_parent() as MarginContainer
p.add_constant_override("margin_left", rect.size.x / 4.0) p.add_constant_override("margin_left", min(rect.size.x / 4.0, 50))
p.add_constant_override("margin_right", rect.size.x / 4.0) p.add_constant_override("margin_right", min(rect.size.x / 4.0, 50))
p.add_constant_override("margin_top", rect.size.y / 4.0) p.add_constant_override("margin_top", min(rect.size.y / 4.0, 50))
p.add_constant_override("margin_bottom", rect.size.y / 4.0) p.add_constant_override("margin_bottom", min(rect.size.y / 4.0, 50))
refresh_rects() refresh_rects()