mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-21 13:16:49 +01:00
Set a usable initial zoom value in world generator's rect editors.
This commit is contained in:
parent
ac7a4212a3
commit
d53a157657
@ -1,6 +1,8 @@
|
||||
tool
|
||||
extends PanelContainer
|
||||
|
||||
var last_edited_res : WorldGenBaseResource = null
|
||||
|
||||
func _init():
|
||||
# Control/EditorZoomWidget
|
||||
pass
|
||||
@ -9,4 +11,15 @@ func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$ScrollContainer/MarginContainer/RectView.set_plugin(plugin)
|
||||
|
||||
func set_edited_resource(res : WorldGenBaseResource):
|
||||
if res && res != last_edited_res:
|
||||
var r : Rect2 = res.get_rect()
|
||||
|
||||
if r.size.x > 0:
|
||||
var rsx : float = $ScrollContainer/MarginContainer.rect_size.x
|
||||
var scale : float = rsx / r.size.x
|
||||
|
||||
$Control/EditorZoomWidget.zoom = scale
|
||||
|
||||
|
||||
|
||||
$ScrollContainer/MarginContainer/RectView.set_edited_resource(res)
|
||||
|
@ -8,9 +8,6 @@
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
@ -49,6 +46,3 @@ anchor_bottom = 0.0
|
||||
margin_right = 115.0
|
||||
margin_bottom = 22.0
|
||||
custom_constants/separation = -8
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user