mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Implement zoom for RectView.
This commit is contained in:
parent
dd7024c0ed
commit
9aa18a9278
@ -32,6 +32,7 @@ margin_top = 200.0
|
|||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 200.0
|
margin_bottom = 200.0
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
zoom_widget_path = NodePath("../../../Control/EditorZoomWidget")
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
[node name="Control" type="Control" parent="."]
|
||||||
margin_left = 7.0
|
margin_left = 7.0
|
||||||
|
@ -3,8 +3,21 @@ extends Control
|
|||||||
|
|
||||||
var rect_editor_node_scene : PackedScene = preload("res://addons/world_generator/ui/RectViewNode.tscn")
|
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
|
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():
|
func _draw():
|
||||||
draw_rect(Rect2(Vector2(), get_size()), Color(0.2, 0.2, 0.2, 1))
|
draw_rect(Rect2(Vector2(), get_size()), Color(0.2, 0.2, 0.2, 1))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user