Fixed float edit problem when max <= min

This commit is contained in:
RodZill4 2019-11-14 08:48:16 +01:00
parent 4d90c20493
commit 2e97888437

View File

@ -41,7 +41,10 @@ func do_update(update_text : bool = true) -> void:
if update_text: if update_text:
text = str(value) text = str(value)
if cursor != null: if cursor != null:
if max_value != min_value:
cursor.rect_position.x = (clamp(value, min_value, max_value)-min_value)*(slider.rect_size.x-cursor.rect_size.x)/(max_value-min_value) cursor.rect_position.x = (clamp(value, min_value, max_value)-min_value)*(slider.rect_size.x-cursor.rect_size.x)/(max_value-min_value)
else:
cursor.rect_position.x = 0
func _on_LineEdit_gui_input(event : InputEvent) -> void: func _on_LineEdit_gui_input(event : InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: