位置计算调整
This commit is contained in:
parent
f51ec0c5b2
commit
f4c7f4474c
@ -18,30 +18,22 @@ func setTrainingTip(text):
|
||||
$PanelContainer/Label.text = text
|
||||
if text!= '':
|
||||
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')
|
||||
var position = computed_position()
|
||||
self.position = position
|
||||
self.size = self.get_contents_minimum_size()
|
||||
else:
|
||||
self.hide()
|
||||
|
||||
|
||||
func _on_panel_container_resized():
|
||||
print('resized')
|
||||
if $PanelContainer/Label.text != "":
|
||||
var cp = computed_position()
|
||||
if self.position.x != cp.x or self.position.y != cp.y:
|
||||
self.position = cp
|
||||
self.size = self.get_contents_minimum_size()
|
||||
|
||||
func computed_position():
|
||||
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
|
||||
@ -50,5 +42,4 @@ func _on_panel_container_resized():
|
||||
position.x = position.x - $PanelContainer.size.x + 10
|
||||
position.y = position.y - $PanelContainer.size.y - 10
|
||||
$PanelContainer.theme = left_theme_resource
|
||||
self.position = position
|
||||
self.size = self.get_contents_minimum_size()
|
||||
return position
|
||||
|
Loading…
Reference in New Issue
Block a user