diff --git a/game/addons/world_generator/ui/RectEditor.tscn b/game/addons/world_generator/ui/RectEditor.tscn index 9c15d328..ae622a30 100644 --- a/game/addons/world_generator/ui/RectEditor.tscn +++ b/game/addons/world_generator/ui/RectEditor.tscn @@ -32,6 +32,7 @@ margin_top = 200.0 margin_right = 200.0 margin_bottom = 200.0 script = ExtResource( 3 ) +zoom_widget_path = NodePath("../../../Control/EditorZoomWidget") [node name="Control" type="Control" parent="."] margin_left = 7.0 diff --git a/game/addons/world_generator/ui/RectView.gd b/game/addons/world_generator/ui/RectView.gd index 48825210..890e7e97 100644 --- a/game/addons/world_generator/ui/RectView.gd +++ b/game/addons/world_generator/ui/RectView.gd @@ -3,8 +3,21 @@ extends Control var rect_editor_node_scene : PackedScene = preload("res://addons/world_generator/ui/RectViewNode.tscn") +export(NodePath) var zoom_widget_path : NodePath = "" + var edited_resource : WorldGenBaseResource = null +func _enter_tree(): + var zoom_widget : Node = get_node_or_null(zoom_widget_path) + + if !zoom_widget: + return + + zoom_widget.connect("zoom_changed", self, "on_zoom_changed") + +func on_zoom_changed(zoom : float) -> void: + rect_scale = Vector2(zoom, zoom) + func _draw(): draw_rect(Rect2(Vector2(), get_size()), Color(0.2, 0.2, 0.2, 1))