mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 06:44:42 -04:00
Added space for panning - Closes #110
This commit is contained in:
parent
a4886a2ee7
commit
48e871586c
5 changed files with 20 additions and 6 deletions
|
@ -11,9 +11,9 @@ func _ready() -> void:
|
|||
func _input(event : InputEvent) -> void:
|
||||
var mouse_pos := viewport_container.get_local_mouse_position()
|
||||
var viewport_size := viewport_container.rect_size
|
||||
if event.is_action_pressed("camera_drag"):
|
||||
if event.is_action_pressed("camera_drag") || event.is_action_pressed("space"):
|
||||
drag = true
|
||||
elif event.is_action_released("camera_drag"):
|
||||
elif event.is_action_released("camera_drag") || event.is_action_released("space"):
|
||||
drag = false
|
||||
|
||||
if Global.can_draw && Rect2(Vector2.ZERO, viewport_size).has_point(mouse_pos):
|
||||
|
|
|
@ -91,11 +91,18 @@ func _input(event : InputEvent) -> void:
|
|||
else:
|
||||
return
|
||||
|
||||
current_pixel = get_local_mouse_position() + location
|
||||
if Global.current_frame == frame && Global.has_focus:
|
||||
update()
|
||||
|
||||
# We don't want to draw when pressing space, because it's used for panning
|
||||
if Input.is_action_pressed("space"):
|
||||
previous_mouse_pos = current_pixel
|
||||
previous_mouse_pos.x = clamp(previous_mouse_pos.x, location.x, location.x + size.x)
|
||||
previous_mouse_pos.y = clamp(previous_mouse_pos.y, location.y, location.y + size.y)
|
||||
return
|
||||
|
||||
sprite_changed_this_frame = false
|
||||
current_pixel = get_local_mouse_position() + location
|
||||
var mouse_pos := current_pixel
|
||||
var mouse_pos_floored := mouse_pos.floor()
|
||||
var mouse_pos_ceiled := mouse_pos.ceil()
|
||||
|
|
|
@ -24,6 +24,7 @@ func _ready() -> void:
|
|||
contributors.create_item(contributor_root).set_text(0, " Subhang Nanduri")
|
||||
contributors.create_item(contributor_root).set_text(0, " danielnaoexiste")
|
||||
contributors.create_item(contributor_root).set_text(0, " huskee")
|
||||
contributors.create_item(contributor_root).set_text(0, " Gaarco")
|
||||
|
||||
var donors_root := donors.create_item()
|
||||
donors.create_item(donors_root).set_text(0, " pcmxms")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue