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:
parent
5a0e80b1cf
commit
f1a6cf6bd8
|
@ -169,6 +169,10 @@ func handle_draw(position : Vector2, event : InputEvent) -> void:
|
||||||
if not (Global.can_draw and Global.has_focus):
|
if not (Global.can_draw and Global.has_focus):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
var draw_pos := position
|
||||||
|
if Global.mirror_view:
|
||||||
|
draw_pos.x = Global.current_project.size.x - position.x - 1
|
||||||
|
|
||||||
if event is InputEventWithModifiers:
|
if event is InputEventWithModifiers:
|
||||||
control = event.control
|
control = event.control
|
||||||
shift = event.shift
|
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.button_index in [BUTTON_LEFT, BUTTON_RIGHT]:
|
||||||
if event.pressed and _active_button == -1:
|
if event.pressed and _active_button == -1:
|
||||||
_active_button = event.button_index
|
_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:
|
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
|
_active_button = -1
|
||||||
|
|
||||||
if event is InputEventMouseMotion:
|
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_LEFT].tool_node.cursor_move(position)
|
||||||
_slots[BUTTON_RIGHT].tool_node.cursor_move(position)
|
_slots[BUTTON_RIGHT].tool_node.cursor_move(position)
|
||||||
if _active_button != -1:
|
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 project : Project = Global.current_project
|
||||||
var text := "[%s×%s]" % [project.size.x, project.size.y]
|
var text := "[%s×%s]" % [project.size.x, project.size.y]
|
||||||
|
|
|
@ -258,8 +258,6 @@ func draw_tool_circle(position : Vector2, fill := false) -> void:
|
||||||
|
|
||||||
func draw_tool_brush(position : Vector2) -> void:
|
func draw_tool_brush(position : Vector2) -> void:
|
||||||
var project : Project = Global.current_project
|
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):
|
if project.tile_mode and project.get_tile_mode_rect().has_point(position):
|
||||||
position = position.posmodv(project.size)
|
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:
|
func _set_pixel(position : Vector2) -> void:
|
||||||
var project : Project = Global.current_project
|
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):
|
if project.tile_mode and project.get_tile_mode_rect().has_point(position):
|
||||||
position = position.posmodv(project.size)
|
position = position.posmodv(project.size)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue