toggle DepthButton only if value changed
This commit is contained in:
parent
45fd683168
commit
e08bf5deef
|
@ -99,10 +99,13 @@ func _on_Button_button_up():
|
||||||
emit_signal("button_up")
|
emit_signal("button_up")
|
||||||
|
|
||||||
func _on_Button_toggled(button_pressed):
|
func _on_Button_toggled(button_pressed):
|
||||||
|
if _toggled == button_pressed:
|
||||||
|
return
|
||||||
|
|
||||||
var delta = depth - _toggled_depth
|
var delta = depth - _toggled_depth
|
||||||
if button_pressed: # off -> on
|
if (not _toggled) and button_pressed: # off -> on
|
||||||
button.rect_position.y += depth - _toggled_depth
|
button.rect_position.y += depth - _toggled_depth
|
||||||
else: # on -> off
|
elif _toggled and (not button_pressed): # on -> off
|
||||||
button.rect_position.y -= depth - _toggled_depth
|
button.rect_position.y -= depth - _toggled_depth
|
||||||
|
|
||||||
_toggled = button_pressed
|
_toggled = button_pressed
|
||||||
|
|
Loading…
Reference in a new issue