实训提示位置计算调整
This commit is contained in:
parent
dccb91220c
commit
f51ec0c5b2
@ -17,9 +17,31 @@ var left_theme_resource = load("res://training_tip_left.tres")
|
||||
func setTrainingTip(text):
|
||||
$PanelContainer/Label.text = text
|
||||
if text!= '':
|
||||
var position = $"../total".allClickEquipmentPostion($"..".currentStep[$"..".stepIndex])
|
||||
self.show()
|
||||
|
||||
#var position = $"../total".allClickEquipmentPostion($"..".currentStep[$"..".stepIndex])
|
||||
#print(position, '11', position.x - $PanelContainer.size.x)
|
||||
#if position.x - $PanelContainer.size.x < 0:
|
||||
#position.x = position.x - 10
|
||||
#position.y = position.y + 10
|
||||
#$PanelContainer.theme = right_theme_resource
|
||||
#print(position, '22')
|
||||
#else:
|
||||
#position.x = position.x - $PanelContainer.size.x + 10
|
||||
#position.y = position.y - $PanelContainer.size.y - 10
|
||||
#$PanelContainer.theme = left_theme_resource
|
||||
#print(position, '33', $PanelContainer.size)
|
||||
#self.position = position
|
||||
#self.size = self.get_contents_minimum_size()
|
||||
#print(self.position, '44')
|
||||
else:
|
||||
self.hide()
|
||||
|
||||
|
||||
func _on_panel_container_resized():
|
||||
print('resized')
|
||||
if $PanelContainer/Label.text != "":
|
||||
var position = $"../total".allClickEquipmentPostion($"..".currentStep[$"..".stepIndex])
|
||||
print(position, '11111')
|
||||
if position.x - $PanelContainer.size.x < 0:
|
||||
position.x = position.x - 10
|
||||
position.y = position.y + 10
|
||||
@ -30,5 +52,3 @@ func setTrainingTip(text):
|
||||
$PanelContainer.theme = left_theme_resource
|
||||
self.position = position
|
||||
self.size = self.get_contents_minimum_size()
|
||||
else:
|
||||
self.hide()
|
||||
|
@ -20,3 +20,5 @@ theme = ExtResource("2_3b4sf")
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="resized" from="PanelContainer" to="." method="_on_panel_container_resized"]
|
||||
|
Loading…
Reference in New Issue
Block a user