mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-08 01:49:35 +01:00
RectViewNodes now convert between yup and ydown coordinate systems to store rect.position.ys.
This commit is contained in:
parent
0c96328005
commit
0cbf540e30
@ -8,6 +8,7 @@ export(NodePath) var zoom_widget_path : NodePath = ""
|
||||
var stored_rect_scale : Vector2 = Vector2(1, 1)
|
||||
|
||||
var edited_resource : WorldGenBaseResource = null
|
||||
var edited_resource_current_size : Vector2 = Vector2()
|
||||
|
||||
func _enter_tree():
|
||||
var zoom_widget : Node = get_node_or_null(zoom_widget_path)
|
||||
@ -39,6 +40,8 @@ func refresh() -> void:
|
||||
|
||||
var rect : Rect2 = edited_resource.rect
|
||||
|
||||
edited_resource_current_size = rect.size
|
||||
|
||||
set_custom_minimum_size(rect.size)
|
||||
|
||||
var p : MarginContainer = get_parent() as MarginContainer
|
||||
@ -66,6 +69,7 @@ func refresh_rects() -> void:
|
||||
var s : Node = rect_editor_node_scene.instance()
|
||||
|
||||
add_child(s)
|
||||
s.edited_resource_parent_size = edited_resource_current_size
|
||||
s.set_edited_resource(c)
|
||||
|
||||
func clear_rects():
|
||||
|
@ -11,6 +11,7 @@ enum DragType {
|
||||
};
|
||||
|
||||
var edited_resource : WorldGenBaseResource = null
|
||||
var edited_resource_parent_size : Vector2 = Vector2()
|
||||
|
||||
var _edited_resource_rect_border_color : Color = Color(1, 1, 1, 1)
|
||||
var _edited_resource_rect_color : Color = Color(0.8, 0.8, 0.8, 0.9)
|
||||
@ -47,10 +48,14 @@ func _draw():
|
||||
func refresh() -> void:
|
||||
if !edited_resource:
|
||||
return
|
||||
|
||||
|
||||
#anchor is bottom left here
|
||||
var rect : Rect2 = edited_resource.get_rect()
|
||||
|
||||
rect_position = rect.position
|
||||
#anchor needs to be on top left here
|
||||
var rp : Vector2 = rect.position
|
||||
rp.y = edited_resource_parent_size.y - rect.size.y - rect.position.y
|
||||
rect_position = rp
|
||||
rect_size = rect.size
|
||||
|
||||
update()
|
||||
@ -157,6 +162,8 @@ func _gui_input(p_event : InputEvent) -> void:
|
||||
set_size(rect.size)
|
||||
set_position(rect.position)
|
||||
|
||||
#rect needs to be converted back
|
||||
rect.position.y = edited_resource_parent_size.y - rect.size.y - rect.position.y
|
||||
edited_resource.set_rect(rect)
|
||||
|
||||
#based on / ported from engine/scene/gui/dialogs.h and .cpp
|
||||
|
@ -11,20 +11,20 @@
|
||||
[sub_resource type="Resource" id=2]
|
||||
resource_name = "Spawner"
|
||||
script = ExtResource( 4 )
|
||||
rect = Rect2( 55, 78, 22, 25 )
|
||||
rect = Rect2( 162, 172, 22, 25 )
|
||||
locked = false
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
resource_name = "TestForest"
|
||||
script = ExtResource( 3 )
|
||||
rect = Rect2( 39, 35, 142, 171 )
|
||||
rect = Rect2( 28, 35, 378, 407 )
|
||||
locked = false
|
||||
subzones = [ SubResource( 2 ) ]
|
||||
|
||||
[sub_resource type="Resource" id=1]
|
||||
resource_name = "Continent"
|
||||
script = ExtResource( 2 )
|
||||
rect = Rect2( 30, 15, 434, 459 )
|
||||
rect = Rect2( 28, 25, 434, 459 )
|
||||
locked = false
|
||||
zones = [ SubResource( 3 ) ]
|
||||
dungeon_teleporter = ExtResource( 5 )
|
||||
|
Loading…
Reference in New Issue
Block a user