mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Set the cursor to cross when entering the canvas and to resize when hovering selection gizmos
This commit is contained in:
parent
3d9ce4cb73
commit
6a7e060f73
|
@ -58,24 +58,24 @@ class Gizmo:
|
||||||
type = _type
|
type = _type
|
||||||
direction = _direction
|
direction = _direction
|
||||||
|
|
||||||
func get_cursor() -> DisplayServer.CursorShape:
|
func get_cursor() -> Input.CursorShape:
|
||||||
var cursor := DisplayServer.CURSOR_MOVE
|
var cursor := Input.CURSOR_MOVE
|
||||||
if direction == Vector2i.ZERO:
|
if direction == Vector2i.ZERO:
|
||||||
return DisplayServer.CURSOR_POINTING_HAND
|
return Input.CURSOR_POINTING_HAND
|
||||||
elif direction == Vector2i(-1, -1) or direction == Vector2i(1, 1): # Top left or bottom right
|
elif direction == Vector2i(-1, -1) or direction == Vector2i(1, 1): # Top left or bottom right
|
||||||
if Global.mirror_view:
|
if Global.mirror_view:
|
||||||
cursor = DisplayServer.CURSOR_BDIAGSIZE
|
cursor = Input.CURSOR_BDIAGSIZE
|
||||||
else:
|
else:
|
||||||
cursor = DisplayServer.CURSOR_FDIAGSIZE
|
cursor = Input.CURSOR_FDIAGSIZE
|
||||||
elif direction == Vector2i(1, -1) or direction == Vector2i(-1, 1): # Top right or bottom left
|
elif direction == Vector2i(1, -1) or direction == Vector2i(-1, 1): # Top right or bottom left
|
||||||
if Global.mirror_view:
|
if Global.mirror_view:
|
||||||
cursor = DisplayServer.CURSOR_FDIAGSIZE
|
cursor = Input.CURSOR_FDIAGSIZE
|
||||||
else:
|
else:
|
||||||
cursor = DisplayServer.CURSOR_BDIAGSIZE
|
cursor = Input.CURSOR_BDIAGSIZE
|
||||||
elif direction == Vector2i(0, -1) or direction == Vector2i(0, 1): # Center top or center bottom
|
elif direction == Vector2i(0, -1) or direction == Vector2i(0, 1): # Center top or center bottom
|
||||||
cursor = DisplayServer.CURSOR_VSIZE
|
cursor = Input.CURSOR_VSIZE
|
||||||
elif direction == Vector2i(-1, 0) or direction == Vector2i(1, 0): # Center left or center right
|
elif direction == Vector2i(-1, 0) or direction == Vector2i(1, 0): # Center left or center right
|
||||||
cursor = DisplayServer.CURSOR_HSIZE
|
cursor = Input.CURSOR_HSIZE
|
||||||
return cursor
|
return cursor
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,17 +167,17 @@ func _input(event: InputEvent) -> void:
|
||||||
_gizmo_rotate()
|
_gizmo_rotate()
|
||||||
else: # Set the appropriate cursor
|
else: # Set the appropriate cursor
|
||||||
if gizmo_hover:
|
if gizmo_hover:
|
||||||
DisplayServer.cursor_set_shape(gizmo_hover.get_cursor())
|
Input.set_default_cursor_shape(gizmo_hover.get_cursor())
|
||||||
else:
|
else:
|
||||||
var cursor := DisplayServer.CURSOR_ARROW
|
var cursor := Input.CURSOR_ARROW
|
||||||
if Global.cross_cursor:
|
if Global.cross_cursor:
|
||||||
cursor = DisplayServer.CURSOR_CROSS
|
cursor = Input.CURSOR_CROSS
|
||||||
var layer: BaseLayer = project.layers[project.current_layer]
|
var layer: BaseLayer = project.layers[project.current_layer]
|
||||||
if not layer.can_layer_get_drawn():
|
if not layer.can_layer_get_drawn():
|
||||||
cursor = DisplayServer.CURSOR_FORBIDDEN
|
cursor = Input.CURSOR_FORBIDDEN
|
||||||
|
|
||||||
if DisplayServer.cursor_get_shape() != cursor:
|
if DisplayServer.cursor_get_shape() != cursor:
|
||||||
DisplayServer.cursor_set_shape(cursor)
|
Input.set_default_cursor_shape(cursor)
|
||||||
|
|
||||||
|
|
||||||
func _move_with_arrow_keys(event: InputEvent) -> void:
|
func _move_with_arrow_keys(event: InputEvent) -> void:
|
||||||
|
|
|
@ -305,7 +305,6 @@ layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
mouse_default_cursor_shape = 3
|
|
||||||
stretch = true
|
stretch = true
|
||||||
script = ExtResource("23")
|
script = ExtResource("23")
|
||||||
camera_path = NodePath("SubViewport/Camera2D")
|
camera_path = NodePath("SubViewport/Camera2D")
|
||||||
|
|
|
@ -14,9 +14,11 @@ func _on_ViewportContainer_mouse_entered() -> void:
|
||||||
camera.set_process_input(true)
|
camera.set_process_input(true)
|
||||||
Global.control.left_cursor.visible = Global.show_left_tool_icon
|
Global.control.left_cursor.visible = Global.show_left_tool_icon
|
||||||
Global.control.right_cursor.visible = Global.show_right_tool_icon
|
Global.control.right_cursor.visible = Global.show_right_tool_icon
|
||||||
|
Input.set_default_cursor_shape(Input.CURSOR_CROSS)
|
||||||
|
|
||||||
|
|
||||||
func _on_ViewportContainer_mouse_exited() -> void:
|
func _on_ViewportContainer_mouse_exited() -> void:
|
||||||
camera.set_process_input(false)
|
camera.set_process_input(false)
|
||||||
Global.control.left_cursor.visible = false
|
Global.control.left_cursor.visible = false
|
||||||
Global.control.right_cursor.visible = false
|
Global.control.right_cursor.visible = false
|
||||||
|
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
|
||||||
|
|
Loading…
Reference in a new issue