1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Set the main viewport's cursor to be cross, and set it as a custom cursor image

Instead of setting the main arrow as a custom cursor every time the cursor gets inside the viewport, set the viewport's default cursor to be the cross, and change the cross's image once in Global.gd
This commit is contained in:
OverloadedOrama 2020-06-13 18:09:46 +03:00
parent 2e587e3634
commit c6b977d48e
5 changed files with 5 additions and 7 deletions

View file

@ -241,6 +241,7 @@ func _ready() -> void:
# XDGDataDirs depends on it nyaa
directory_module = XDGDataPaths.new()
image_clipboard = Image.new()
Input.set_custom_mouse_cursor(Global.cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
var root = get_tree().get_root()
control = find_node_by_name(root, "Control")

View file

@ -162,8 +162,6 @@ func _input(event : InputEvent) -> void:
Global.cursor_position_label.text = "[%s×%s] %s, %s" % [current_project.size.x, current_project.size.y, mouse_pos_floored.x, mouse_pos_floored.y]
if !cursor_image_has_changed:
cursor_image_has_changed = true
if Global.cursor_image.get_data().get_size() != Vector2.ZERO:
Input.set_custom_mouse_cursor(Global.cursor_image, 0, Vector2(15, 15))
if Global.show_left_tool_icon:
Global.left_cursor.visible = true
if Global.show_right_tool_icon:
@ -174,7 +172,6 @@ func _input(event : InputEvent) -> void:
cursor_image_has_changed = false
Global.left_cursor.visible = false
Global.right_cursor.visible = false
Input.set_custom_mouse_cursor(null)
# Handle Undo/Redo
var can_handle : bool = Global.can_draw && Global.has_focus && !made_line

View file

@ -181,7 +181,6 @@ func _on_QuitDialog_confirmed() -> void:
func _on_BackupConfirmation_confirmed(project_paths : Array, backup_paths : Array) -> void:
OpenSave.reload_backup_file(project_paths, backup_paths)
# Global.tabs.delete_tab(0)
OpenSave.autosave_timer.start()
$ExportDialog.file_name = OpenSave.current_save_paths[0].get_file().trim_suffix(".pxo")
$ExportDialog.directory_path = OpenSave.current_save_paths[0].get_base_dir()

View file

@ -67,7 +67,7 @@ func _process(_delta : float) -> void:
update()
else:
get_parent().get_parent().mouse_default_cursor_shape = Input.CURSOR_ARROW
get_parent().get_parent().mouse_default_cursor_shape = Input.CURSOR_CROSS
if is_dragging:
if (Global.current_tools[0] == Global.Tools.RECTSELECT && Input.is_action_pressed("left_mouse")) || (Global.current_tools[1] == Global.Tools.RECTSELECT && Input.is_action_pressed("right_mouse")):

View file

@ -22,7 +22,7 @@
[ext_resource path="res://assets/graphics/dark_themes/tools/zoom.png" type="Texture" id=21]
[ext_resource path="res://src/UI/ViewportContainer.gd" type="Script" id=23]
[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.0627451, 0.0627451, 0.0627451, 1 )
expand_margin_top = 6.0
@ -266,6 +266,7 @@ margin_left = 16.0
margin_right = 890.0
margin_bottom = 426.0
focus_mode = 2
mouse_default_cursor_shape = 3
size_flags_horizontal = 3
size_flags_vertical = 3
stretch = true
@ -320,7 +321,7 @@ script = ExtResource( 7 )
[node name="AnimationTimeline" parent="CanvasAndTimeline" instance=ExtResource( 18 )]
margin_top = 492.0
margin_bottom = 692.0
custom_styles/panel = SubResource( 2 )
custom_styles/panel = SubResource( 1 )
[node name="RightPanel" type="Panel" parent="."]
margin_left = 950.0