mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Minor code cleanups
This commit is contained in:
parent
87261e93c6
commit
056cb76a46
|
@ -25,7 +25,7 @@ func _ready() -> void:
|
|||
Global.zoom_level_spinbox.get_child(0).connect("focus_exited", self, "zoom_focus_exited")
|
||||
|
||||
|
||||
func zoom_label_clicked(event :InputEvent):
|
||||
func zoom_label_clicked(event :InputEvent) -> void:
|
||||
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
|
||||
if event.doubleclick:
|
||||
Global.zoom_level_label.visible = false
|
||||
|
@ -35,12 +35,12 @@ func zoom_label_clicked(event :InputEvent):
|
|||
Global.zoom_level_spinbox.get_child(0).grab_focus() #since the actual lineedit is the first child of spinbox
|
||||
|
||||
|
||||
func zoom_value_changed(value):
|
||||
func zoom_value_changed(value) -> void:
|
||||
if name == "Camera2D":
|
||||
zoom_camera_percent(value)
|
||||
|
||||
|
||||
func zoom_focus_exited():
|
||||
func zoom_focus_exited() -> void:
|
||||
if Global.zoom_level_spinbox.value != round(100 / zoom.x): #If user pressed enter while editing
|
||||
if name == "Camera2D":
|
||||
zoom_camera_percent(Global.zoom_level_spinbox.value)
|
||||
|
@ -207,7 +207,8 @@ func zoom_camera(dir : int) -> void:
|
|||
offset = offset + (-0.5 * viewport_size + mouse_pos) * (prev_zoom - zoom)
|
||||
zoom_changed()
|
||||
|
||||
func zoom_camera_percent(value :float):
|
||||
|
||||
func zoom_camera_percent(value : float) -> void:
|
||||
var percent :float = (100.0 / value)
|
||||
var new_zoom = Vector2(percent, percent)
|
||||
if Global.smooth_zoom:
|
||||
|
@ -217,6 +218,7 @@ func zoom_camera_percent(value :float):
|
|||
zoom = new_zoom
|
||||
zoom_changed()
|
||||
|
||||
|
||||
func zoom_changed() -> void:
|
||||
update_transparent_checker_offset()
|
||||
if name == "Camera2D":
|
||||
|
|
|
@ -8,12 +8,12 @@ enum ImageMenuId {SCALE_IMAGE, CENTRALIZE_IMAGE, CROP_IMAGE, RESIZE_CANVAS, FLIP
|
|||
enum SelectMenuId {SELECT_ALL, CLEAR_SELECTION, INVERT}
|
||||
enum HelpMenuId {VIEW_SPLASH_SCREEN, ONLINE_DOCS, ISSUE_TRACKER, OPEN_LOGS_FOLDER, CHANGELOG, ABOUT_PIXELORAMA}
|
||||
|
||||
var file_menu_button : MenuButton
|
||||
var edit_menu_button : MenuButton
|
||||
var view_menu_button : MenuButton
|
||||
var image_menu_button : MenuButton
|
||||
var select_menu_button : MenuButton
|
||||
var help_menu_button : MenuButton
|
||||
onready var file_menu_button : MenuButton = find_node("FileMenu")
|
||||
onready var edit_menu_button : MenuButton = find_node("EditMenu")
|
||||
onready var view_menu_button : MenuButton = find_node("ViewMenu")
|
||||
onready var image_menu_button : MenuButton = find_node("ImageMenu")
|
||||
onready var select_menu_button : MenuButton = find_node("SelectMenu")
|
||||
onready var help_menu_button : MenuButton = find_node("HelpMenu")
|
||||
|
||||
var file_menu : PopupMenu
|
||||
var view_menu : PopupMenu
|
||||
|
@ -21,13 +21,6 @@ var zen_mode := false
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
file_menu_button = find_node("FileMenu")
|
||||
edit_menu_button = find_node("EditMenu")
|
||||
view_menu_button = find_node("ViewMenu")
|
||||
image_menu_button = find_node("ImageMenu")
|
||||
select_menu_button = find_node("SelectMenu")
|
||||
help_menu_button = find_node("HelpMenu")
|
||||
|
||||
setup_file_menu()
|
||||
setup_edit_menu()
|
||||
setup_view_menu()
|
||||
|
|
Loading…
Reference in a new issue