diff options
Diffstat (limited to 'logic/stage.gd')
| -rw-r--r-- | logic/stage.gd | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/logic/stage.gd b/logic/stage.gd index f6f6e47..dc42273 100644 --- a/logic/stage.gd +++ b/logic/stage.gd @@ -8,7 +8,42 @@ const FILTERS_FILE_PATH: String = "user://filters.csv" const POINTER_VELOCITY_DECAYING_FACTOR: float = 2.5 var staged_entry := {} -var filters := {} +var filters := { + "place": { + "bloco central": null, + "tondela": null, + "xpto_00": null, + "xpto_01": null, + "xpto_02": null, + "xpto_03": null, + "xpto_04": null, + "xpto_05": null, + "xpto_06": null, + "xpto_07": null, + "xpto_08": null, + "xpto_09": null, + "xpto_10": null, + "xpto_11": null, + "xpto_12": null, + "xpto_13": null, + "xpto_14": null, + "xpto_15": null, + "xpto_16": null, + "xpto_17": null, + "xpto_18": null, + "xpto_19": null, + "xpto_20": null, + "xpto_21": null, + "xpto_22": null, + "xpto_23": null, + "xpto_24": null, + "xpto_25": null, + "xpto_26": null, + "xpto_27": null, + "xpto_28": null, + "xpto_29": null, + }, +} var is_pointer_dragging := false var pointer_drag_velocity := 0.0 @@ -60,6 +95,22 @@ func _ready(): if it is LineEdit: it.connect("focus_exited", it, "deselect") + + var auto_place := place.get_node("auto") as Button + auto_place.connect("pressed", self, "auto_populate", ["place"]) + + +func auto_populate(field: String): + var stage_options = get_node("/root/main/popup_list") as Popup + stage_options.connect("item_selected", self, "auto_selected", [field], CONNECT_ONESHOT) + stage_options.popup_options(filters[field].keys()) + + +func auto_selected(index: int, field: String): + var field_input: LineEdit = self[field] + field_input.text = filters[field].keys()[index] + field_input.caret_position = field_input.text.length() + func _process(delta: float): @@ -116,11 +167,6 @@ func get_stage() -> Dictionary: return staged_entry -func _notification(what: int): - if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST: - discard_action() - - func pointer_input_handler(pointer: PointerInputSensor.PointerInputData): match pointer.action: PointerInputSensor.PointerInputAction.ON_PRESS: @@ -135,9 +181,23 @@ func pointer_input_handler(pointer: PointerInputSensor.PointerInputData): is_pointer_dragging = false PointerInputSensor.PointerInputAction.ON_CLICK: + + # @DAM Try this approach on the TouchItemList + var target: Control = pointer.target.get_parent() var position := target.get_global_mouse_position() - target.rect_global_position + var button: Button = target.get_node("auto") + if button != null && button.get_rect().has_point(position): + button.grab_focus() +# button.emit_signal("button_down") + button.emit_signal("pressed") +# button.emit_signal("button_up") + else: + target.grab_focus() + return + + var event_touch := InputEventScreenTouch.new() event_touch.index = 0 event_touch.position = position @@ -153,13 +213,14 @@ func pointer_input_handler(pointer: PointerInputSensor.PointerInputData): target._gui_input(event_touch) target.grab_focus() - + event_mouse.pressed = false event_touch.pressed = false target._gui_input(event_mouse) target._gui_input(event_touch) + func load_filters(file_path: String = FILTERS_FILE_PATH): var file := File.new() file.open(file_path, File.READ_WRITE) |
