位置计算调整
This commit is contained in:
parent
f51ec0c5b2
commit
f4c7f4474c
@ -18,37 +18,28 @@ func setTrainingTip(text):
|
|||||||
$PanelContainer/Label.text = text
|
$PanelContainer/Label.text = text
|
||||||
if text!= '':
|
if text!= '':
|
||||||
self.show()
|
self.show()
|
||||||
#var position = $"../total".allClickEquipmentPostion($"..".currentStep[$"..".stepIndex])
|
var position = computed_position()
|
||||||
#print(position, '11', position.x - $PanelContainer.size.x)
|
self.position = position
|
||||||
#if position.x - $PanelContainer.size.x < 0:
|
self.size = self.get_contents_minimum_size()
|
||||||
#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:
|
else:
|
||||||
self.hide()
|
self.hide()
|
||||||
|
|
||||||
|
|
||||||
func _on_panel_container_resized():
|
func _on_panel_container_resized():
|
||||||
print('resized')
|
|
||||||
if $PanelContainer/Label.text != "":
|
if $PanelContainer/Label.text != "":
|
||||||
var position = $"../total".allClickEquipmentPostion($"..".currentStep[$"..".stepIndex])
|
var cp = computed_position()
|
||||||
print(position, '11111')
|
if self.position.x != cp.x or self.position.y != cp.y:
|
||||||
if position.x - $PanelContainer.size.x < 0:
|
self.position = cp
|
||||||
position.x = position.x - 10
|
self.size = self.get_contents_minimum_size()
|
||||||
position.y = position.y + 10
|
|
||||||
$PanelContainer.theme = right_theme_resource
|
func computed_position():
|
||||||
else:
|
var position = $"../total".allClickEquipmentPostion($"..".currentStep[$"..".stepIndex])
|
||||||
position.x = position.x - $PanelContainer.size.x + 10
|
if position.x - $PanelContainer.size.x < 0:
|
||||||
position.y = position.y - $PanelContainer.size.y - 10
|
position.x = position.x - 10
|
||||||
$PanelContainer.theme = left_theme_resource
|
position.y = position.y + 10
|
||||||
self.position = position
|
$PanelContainer.theme = right_theme_resource
|
||||||
self.size = self.get_contents_minimum_size()
|
else:
|
||||||
|
position.x = position.x - $PanelContainer.size.x + 10
|
||||||
|
position.y = position.y - $PanelContainer.size.y - 10
|
||||||
|
$PanelContainer.theme = left_theme_resource
|
||||||
|
return position
|
||||||
|
Loading…
Reference in New Issue
Block a user