27 lines
574 B
GDScript
27 lines
574 B
GDScript
extends ScrollContainer
|
|
|
|
var isDrag = false
|
|
var startPos = 0
|
|
var dragDir = 0
|
|
|
|
func _ready():
|
|
set_process_input(false)
|
|
|
|
func _input(event):
|
|
if event is InputEventMouseButton:
|
|
if event.button_index != BUTTON_LEFT:
|
|
return
|
|
if event.is_pressed():
|
|
isDrag = true
|
|
startPos = event.position.y
|
|
if !event.is_pressed():
|
|
isDrag = false
|
|
startPos = 0
|
|
if event is InputEventMouseMotion and isDrag:
|
|
var offset = event.position.y - startPos
|
|
self.scroll_vertical -= offset
|
|
startPos = event.position.y
|
|
|
|
func _on_BookDialog_popup_hide():
|
|
set_process_input(false)
|