1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Remove unneeded has_focus checks

This commit is contained in:
Emmanouil Papadeas 2024-01-24 03:06:09 +02:00
parent d9c0cd7546
commit 42de5ccb29
8 changed files with 11 additions and 17 deletions

View file

@ -541,7 +541,6 @@ func handle_draw(position: Vector2i, event: InputEvent) -> void:
var project := Global.current_project var project := Global.current_project
var text := "[%s×%s]" % [project.size.x, project.size.y] var text := "[%s×%s]" % [project.size.x, project.size.y]
if Global.has_focus:
text += " %s, %s" % [position.x, position.y] text += " %s, %s" % [position.x, position.y]
if not _slots[MOUSE_BUTTON_LEFT].tool_node.cursor_text.is_empty(): if not _slots[MOUSE_BUTTON_LEFT].tool_node.cursor_text.is_empty():
text += " %s" % _slots[MOUSE_BUTTON_LEFT].tool_node.cursor_text text += " %s" % _slots[MOUSE_BUTTON_LEFT].tool_node.cursor_text

View file

@ -91,7 +91,6 @@ func _input(event: InputEvent) -> void:
Tools.handle_draw(Vector2i(current_pixel.floor()), event) Tools.handle_draw(Vector2i(current_pixel.floor()), event)
if sprite_changed_this_frame: if sprite_changed_this_frame:
if Global.has_focus:
queue_redraw() queue_redraw()
update_selected_cels_textures() update_selected_cels_textures()

View file

@ -2,12 +2,11 @@ extends Node2D
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if Global.has_focus:
if event is InputEventMouse or event is InputEventKey: if event is InputEventMouse or event is InputEventKey:
queue_redraw() queue_redraw()
func _draw() -> void: func _draw() -> void:
# Draw rectangle to indicate the pixel currently being hovered on # Draw rectangle to indicate the pixel currently being hovered on
if Global.has_focus and Global.can_draw: if Global.can_draw:
Tools.draw_indicator() Tools.draw_indicator()

View file

@ -29,7 +29,7 @@ func draw_guide_line():
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if !Global.show_mouse_guides or !Global.can_draw or !Global.has_focus: if !Global.show_mouse_guides or !Global.can_draw:
visible = false visible = false
return return
visible = true visible = true

View file

@ -2,11 +2,10 @@ extends Node2D
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if Global.has_focus:
if event is InputEventMouse or event is InputEventKey: if event is InputEventMouse or event is InputEventKey:
queue_redraw() queue_redraw()
func _draw() -> void: func _draw() -> void:
if Global.has_focus and Global.can_draw: if Global.can_draw:
Tools.draw_preview() Tools.draw_preview()

View file

@ -39,7 +39,6 @@ func _input(_event: InputEvent) -> void:
if ( if (
Input.is_action_just_pressed(&"left_mouse") Input.is_action_just_pressed(&"left_mouse")
and Global.can_draw and Global.can_draw
and Global.has_focus
and rect.has_point(mouse_pos) and rect.has_point(mouse_pos)
): ):
if ( if (

View file

@ -65,7 +65,7 @@ func _input(event: InputEvent) -> void:
var project_size := Global.current_project.size var project_size := Global.current_project.size
if track_mouse: if track_mouse:
if !Global.can_draw or !Global.has_focus or Global.perspective_editor.tracker_disabled: if !Global.can_draw or Global.perspective_editor.tracker_disabled:
hide_perspective_line() hide_perspective_line()
return return
default_color.a = 0.5 default_color.a = 0.5
@ -94,7 +94,7 @@ func try_rotate_scale():
var test_line := (points[1] - points[0]).rotated(deg_to_rad(90)).normalized() var test_line := (points[1] - points[0]).rotated(deg_to_rad(90)).normalized()
var from_a := mouse_point - test_line * CIRCLE_RAD * 2 / Global.camera.zoom.x var from_a := mouse_point - test_line * CIRCLE_RAD * 2 / Global.camera.zoom.x
var from_b := mouse_point + test_line * CIRCLE_RAD * 2 / Global.camera.zoom.x var from_b := mouse_point + test_line * CIRCLE_RAD * 2 / Global.camera.zoom.x
if Input.is_action_just_pressed("left_mouse") and Global.can_draw and Global.has_focus: if Input.is_action_just_pressed("left_mouse") and Global.can_draw:
if ( if (
Geometry2D.segment_intersects_segment(from_a, from_b, points[0], points[1]) Geometry2D.segment_intersects_segment(from_a, from_b, points[0], points[1])
or mouse_point.distance_to(points[1]) < CIRCLE_RAD * 2 / Global.camera.zoom.x or mouse_point.distance_to(points[1]) < CIRCLE_RAD * 2 / Global.camera.zoom.x

View file

@ -75,7 +75,6 @@ func _input(_event: InputEvent):
if ( if (
Input.is_action_just_pressed("left_mouse") Input.is_action_just_pressed("left_mouse")
and Global.can_draw and Global.can_draw
and Global.has_focus
and mouse_point.distance_to(start) < 8 / Global.camera.zoom.x and mouse_point.distance_to(start) < 8 / Global.camera.zoom.x
): ):
if ( if (