extends TextureButton

var mouse_pos: Vector2
var offset: Vector2
var press: bool = false

#func _input(event):
#	if event is InputEventMouse:
#		var mouse_pos = event.position.x

func _ready():
	offset.x = 0

func _process(_delta):
	if pressed:
		mouse_pos = get_global_mouse_position()
		rect_position.x = clamp(mouse_pos.x - offset.x, 0, 24)

func _on_Frame_button_down():
	mouse_pos = get_global_mouse_position()
	offset.x = mouse_pos.x - rect_position.x
	#press = true

#func _on_Frame_pressed():
#	var mouse_pos = get_global_mouse_position()
#	offset.x = mouse_pos.x - rect_position.x
#	press = true
	
	#rect_position.x = mouse_pos.x - offset.x


#func _on_Frame_button_up():
#	var mouse_pos = get_global_mouse_position()
#	offset.x = mouse_pos.x - rect_position.x
#	#press = true
