added right click to return post it panels
This commit is contained in:
parent
5c487f55df
commit
3640f29170
|
|
@ -130,6 +130,7 @@ func is_in_dropzone(to_check: Node) -> bool:
|
|||
|
||||
# called if a mouse button is pressed
|
||||
func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||
|
||||
# No two areas can be dragged at the same time.
|
||||
# Make sure that only the same area is dragged.
|
||||
# Otherwise overlapping areas are dragged at the same time.
|
||||
|
|
@ -141,11 +142,8 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
|||
to_handle.is_dragged = input.pressed
|
||||
is_area_dragged = input.pressed
|
||||
|
||||
# TODO: We need a better way to recognize whether "to_handle" is a Card or a Post-It.
|
||||
# (Tried checking for a script, didn't work, because script has no name attached.
|
||||
# Alternative might be to check for specific values within the script ("is_card" f.e))
|
||||
# Check what is being dragged
|
||||
if to_handle is Card:
|
||||
|
||||
active_context = ui_context.DROPZONE
|
||||
if input.is_pressed():
|
||||
reorder_areas("dropzone_content")
|
||||
|
|
@ -154,13 +152,17 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
|||
dropzone.move_child(currently_dragged_area, -1)
|
||||
currently_dragged_area = null
|
||||
elif to_handle is PostIt:
|
||||
if input.is_pressed():
|
||||
if input.is_action_pressed("mouse_left"):
|
||||
to_handle.reparent(dropzone)
|
||||
to_handle.on_board = true
|
||||
to_handle.set_owner(self) # needs to be here otherwise the owner disappears
|
||||
area_dict["post_its_in_list"].erase(to_handle)
|
||||
area_dict["dropzone_content"].push_back(to_handle)
|
||||
# TODO (if needed): Add function to rearrange the array based on positions in the dropzone
|
||||
elif input.is_action_pressed("mouse_right"):
|
||||
_return_postit_to_panels(to_handle)
|
||||
to_handle.is_dragged = false
|
||||
is_area_dragged = false
|
||||
currently_dragged_area = null
|
||||
else:
|
||||
if is_in_dropzone(to_handle):
|
||||
if to_handle.has_overlapping_areas():
|
||||
|
|
@ -284,8 +286,6 @@ func _input(event):
|
|||
else:
|
||||
_enter_assignment_context()
|
||||
|
||||
# TODO: I forgor the HECKING RIGHT-CLICK!!!!111 AAAAAAAAAAAAAAAAAAAA
|
||||
|
||||
# do some adjustments to loop elements (after last element, select first one etc.)
|
||||
if selected_dropzone_element < 0:
|
||||
selected_dropzone_element = area_dict["dropzone_content"].size()-1
|
||||
|
|
@ -358,15 +358,14 @@ func _leave_assignment_context():
|
|||
# handles everything to return a post it to the panels
|
||||
func _return_postit_to_panels(post_it: Area2D):
|
||||
for panel in area_dict["post_it_panels"]:
|
||||
print(area_dict["post_it_panels"])
|
||||
if panel.get_child_count() == 1:
|
||||
area_dict["dropzone_content"].erase(post_it)
|
||||
post_it.on_board = false
|
||||
area_dict["post_its_in_list"].push_back(post_it)
|
||||
#post_it.tween_transform_to(panel.get_child(0).position)
|
||||
post_it.reparent(panel)
|
||||
post_it.transform = panel.get_child(0).transform
|
||||
post_it.set_owner(self)
|
||||
#post_it.position = Vector2(0,0)
|
||||
reorder_areas("dropzone_content")
|
||||
reorder_areas("post_its_in_list")
|
||||
break
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ func _on_input_event(viewport, event, shape_idx):
|
|||
_move_post_it()
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT:
|
||||
if "handle_mouse_button" in owner:
|
||||
mouse_offset = (get_viewport().get_mouse_position() - global_position)
|
||||
owner.handle_mouse_button(self, event)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ config_version=5
|
|||
|
||||
config/name="Frame of Mind"
|
||||
run/main_scene="res://main.tscn"
|
||||
config/features=PackedStringArray("4.1", "Forward Plus")
|
||||
config/features=PackedStringArray("4.0", "Forward Plus")
|
||||
run/max_fps=60
|
||||
boot_splash/bg_color=Color(0.0313726, 0.0117647, 0.129412, 1)
|
||||
boot_splash/image="res://splash.png"
|
||||
|
|
@ -31,7 +31,7 @@ gdscript/warnings/native_method_override=0
|
|||
[display]
|
||||
|
||||
window/size/viewport_width=1440
|
||||
window/size/viewport_height=1080
|
||||
window/size/viewport_height=960
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
mouse_cursor/custom_image="res://import/interface-elements/cursor.png"
|
||||
|
|
@ -80,7 +80,12 @@ player_backwards={
|
|||
}
|
||||
mouse_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
mouse_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [null, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
look_right={
|
||||
|
|
|
|||
Loading…
Reference in New Issue