mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-08 01:49:35 +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
|
tool
|
||||||
extends PanelContainer
|
extends PanelContainer
|
||||||
|
|
||||||
|
var last_edited_res : WorldGenBaseResource = null
|
||||||
|
|
||||||
func _init():
|
func _init():
|
||||||
# Control/EditorZoomWidget
|
# Control/EditorZoomWidget
|
||||||
pass
|
pass
|
||||||
@ -9,4 +11,15 @@ func set_plugin(plugin : EditorPlugin) -> void:
|
|||||||
$ScrollContainer/MarginContainer/RectView.set_plugin(plugin)
|
$ScrollContainer/MarginContainer/RectView.set_plugin(plugin)
|
||||||
|
|
||||||
func set_edited_resource(res : WorldGenBaseResource):
|
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)
|
$ScrollContainer/MarginContainer/RectView.set_edited_resource(res)
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||||
margin_left = 7.0
|
margin_left = 7.0
|
||||||
@ -49,6 +46,3 @@ anchor_bottom = 0.0
|
|||||||
margin_right = 115.0
|
margin_right = 115.0
|
||||||
margin_bottom = 22.0
|
margin_bottom = 22.0
|
||||||
custom_constants/separation = -8
|
custom_constants/separation = -8
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user