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

Apply mirror view to all tools

This commit is contained in:
Manolis Papadeas 2021-03-29 23:00:09 +03:00
parent 5a0e80b1cf
commit f1a6cf6bd8
2 changed files with 7 additions and 7 deletions

View file

@ -169,6 +169,10 @@ func handle_draw(position : Vector2, event : InputEvent) -> void:
if not (Global.can_draw and Global.has_focus):
return
var draw_pos := position
if Global.mirror_view:
draw_pos.x = Global.current_project.size.x - position.x - 1
if event is InputEventWithModifiers:
control = event.control
shift = event.shift
@ -178,9 +182,9 @@ func handle_draw(position : Vector2, event : InputEvent) -> void:
if event.button_index in [BUTTON_LEFT, BUTTON_RIGHT]:
if event.pressed and _active_button == -1:
_active_button = event.button_index
_slots[_active_button].tool_node.draw_start(position)
_slots[_active_button].tool_node.draw_start(draw_pos)
elif not event.pressed and event.button_index == _active_button:
_slots[_active_button].tool_node.draw_end(position)
_slots[_active_button].tool_node.draw_end(draw_pos)
_active_button = -1
if event is InputEventMouseMotion:
@ -193,7 +197,7 @@ func handle_draw(position : Vector2, event : InputEvent) -> void:
_slots[BUTTON_LEFT].tool_node.cursor_move(position)
_slots[BUTTON_RIGHT].tool_node.cursor_move(position)
if _active_button != -1:
_slots[_active_button].tool_node.draw_move(position)
_slots[_active_button].tool_node.draw_move(draw_pos)
var project : Project = Global.current_project
var text := "[%s×%s]" % [project.size.x, project.size.y]

View file

@ -258,8 +258,6 @@ func draw_tool_circle(position : Vector2, fill := false) -> void:
func draw_tool_brush(position : Vector2) -> void:
var project : Project = Global.current_project
if Global.mirror_view:
position.x = project.size.x - position.x
if project.tile_mode and project.get_tile_mode_rect().has_point(position):
position = position.posmodv(project.size)
@ -334,8 +332,6 @@ func draw_indicator_at(position : Vector2, offset : Vector2, color : Color) -> v
func _set_pixel(position : Vector2) -> void:
var project : Project = Global.current_project
if Global.mirror_view:
position.x = project.size.x - position.x - 1
if project.tile_mode and project.get_tile_mode_rect().has_point(position):
position = position.posmodv(project.size)