Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pan with space or any other key #278

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lorien/Assets/I18n/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ ACTION_canvas_pan_up Pan up
ACTION_canvas_pan_down Pan down
ACTION_canvas_pan_right Pan right
ACTION_canvas_pan_left Pan left
ACTION_canvas_pan_key Pan Key

# -----------------------------------------------------------------------------
# Kebindings dialog messages
Expand Down
11 changes: 11 additions & 0 deletions lorien/InfiniteCanvas/PanZoomCamera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ func do_center(screen_space_center_point: Vector2) -> void:
# -------------------------------------------------------------------------------------------------
func tool_event(event: InputEvent) -> void:
if _is_input_enabled:
if event is InputEventKey:
if Utils.event_pressed_bug_workaround("canvas_pan_key", event):
_pan_active = event.is_pressed()
else:
_pan_active = event.is_pressed()

if event is InputEventMouseButton:

# Scroll wheel up/down to zoom
Expand Down Expand Up @@ -132,3 +138,8 @@ func disable_input() -> void:
# -------------------------------------------------------------------------------------------------
func xform(pos: Vector2) -> Vector2:
return (pos * zoom) + offset

# -------------------------------------------------------------------------------------------------
func _notification(what):
if what == MainLoop.NOTIFICATION_WM_MOUSE_EXIT:
_pan_active = false
14 changes: 10 additions & 4 deletions lorien/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ margin_bottom = 202.0
custom_styles/panel = SubResource( 1 )

[node name="ColorPicker" type="ColorPicker" parent="BackgroundColorPickerPopup/PanelContainer"]
margin_left = 84.0
margin_top = 84.0
margin_right = 393.0
margin_bottom = 488.0
margin_left = 96.0
margin_top = 96.0
margin_right = 405.0
margin_bottom = 500.0
edit_alpha = false
presets_enabled = false
presets_visible = false
Expand Down Expand Up @@ -131,8 +131,11 @@ margin_right = 385.0
margin_bottom = 216.5
theme = ExtResource( 8 )
popup_exclusive = true
window_title = "Datei speichern"
access = 2
filters = PoolStringArray( "*.lorien" )
current_dir = "/home/marco/Programming/Lorien/lorien"
current_path = "/home/marco/Programming/Lorien/lorien/"
__meta__ = {
"_edit_lock_": true
}
Expand Down Expand Up @@ -192,6 +195,8 @@ theme = ExtResource( 8 )
popup_exclusive = true
window_title = "Export SVG"
access = 2
current_dir = "/home/marco/Programming/Lorien/lorien"
current_path = "/home/marco/Programming/Lorien/lorien/"

[node name="UnsavedChangesDialog" parent="." instance=ExtResource( 7 )]
visible = false
Expand Down Expand Up @@ -237,6 +242,7 @@ margin_right = 68.5
margin_bottom = 35.0
theme = ExtResource( 8 )
popup_exclusive = true
window_title = "Warnung!"
dialog_text = "Generic message. "
__meta__ = {
"_edit_lock_": true
Expand Down
5 changes: 5 additions & 0 deletions lorien/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@ canvas_pan_right={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
canvas_pan_key={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}

[locale]

Expand Down
Loading