mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-20 10:09:48 +00:00
449ee60d49
* Moved Reference Images to it's Folder * Moved the rest to their respective folders * formatting * Fix formatting I removed the `PackedScene` static typing declaration to reduce the number of characters in the line to less than 100. It's not really needed anyway, as Godot should be able to figure out that it's a PackedScene, since it's a tscn file, simply by using `:=`. * reverting some changes * Removed some un-expected things * Fixed TransparentChecker Code * fix typo * Revert it I didn't realize it was intended * Removed unneded changes * removed some unexpected changes Co-authored-by: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com>
39 lines
1.2 KiB
GDScript
39 lines
1.2 KiB
GDScript
extends FlowContainer
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if not Global.has_focus or not Global.can_draw:
|
|
return
|
|
if event is InputEventMouseMotion:
|
|
return
|
|
for action in ["undo", "redo"]:
|
|
if event.is_action_pressed(action):
|
|
return
|
|
|
|
for tool_name in Tools.tools: # Handle tool shortcuts
|
|
var t: Tools.Tool = Tools.tools[tool_name]
|
|
if InputMap.has_action("right_" + t.shortcut + "_tool"):
|
|
if (
|
|
event.is_action_pressed("right_" + t.shortcut + "_tool")
|
|
and (!event.control and !event.command)
|
|
):
|
|
# Shortcut for right button (with Alt)
|
|
Tools.assign_tool(t.name, BUTTON_RIGHT)
|
|
return
|
|
if InputMap.has_action("left_" + t.shortcut + "_tool"):
|
|
if (
|
|
event.is_action_pressed("left_" + t.shortcut + "_tool")
|
|
and (!event.control and !event.command)
|
|
):
|
|
# Shortcut for left button
|
|
Tools.assign_tool(t.name, BUTTON_LEFT)
|
|
return
|
|
|
|
|
|
func _on_Tool_pressed(tool_pressed: BaseButton) -> void:
|
|
var button := -1
|
|
button = BUTTON_LEFT if Input.is_action_just_released("left_mouse") else button
|
|
button = BUTTON_RIGHT if Input.is_action_just_released("right_mouse") else button
|
|
if button != -1:
|
|
Tools.assign_tool(tool_pressed.name, button)
|