Added SymmetryGuides

Two special guides - one horizontal and one vertical - that let you change the axis of symmetry for mirroring. On the next commit(s) I will make them visible only if mirroring is toggled on. Almost solves #133
This commit is contained in:
OverloadedOrama 2020-07-16 04:25:59 +03:00
parent 7529e967e3
commit 9fa91ffd8e
7 changed files with 77 additions and 18 deletions

View file

@ -129,8 +129,8 @@ func fill_in_color(position : Vector2) -> void:
func fill_in_area(position : Vector2) -> void:
var project : Project = Global.current_project
var mirror_x = project.size.x - project.x_symmetry_point - position.x
var mirror_y = project.size.y - project.y_symmetry_point - position.y
var mirror_x = project.x_symmetry_point - position.x
var mirror_y = project.y_symmetry_point - position.y
var mirror_x_inside : bool = mirror_x >= project.x_min and mirror_x <= project.x_max - 1
var mirror_y_inside : bool = mirror_y >= project.y_min and mirror_y <= project.y_max - 1

View file

@ -269,8 +269,8 @@ func draw_tool_brush(position : Vector2) -> void:
dst = dst_rect.position
var project : Project = Global.current_project
var mirror_x = project.size.x - (project.x_symmetry_point + 1) - dst.x - src_rect.size.x
var mirror_y = project.size.y - (project.y_symmetry_point + 1) - dst.y - src_rect.size.y
var mirror_x = (project.x_symmetry_point + 1) - dst.x - src_rect.size.x
var mirror_y = (project.y_symmetry_point + 1) - dst.y - src_rect.size.y
var mirror_x_inside : bool = mirror_x >= project.x_min and mirror_x <= project.x_max - 1
var mirror_y_inside : bool = mirror_y >= project.y_min and mirror_y <= project.y_max - 1
@ -279,7 +279,7 @@ func draw_tool_brush(position : Vector2) -> void:
_draw_brush_image(_mirror_brushes.x, _flip_rect(src_rect, size, true, false), Vector2(mirror_x, dst.y))
if tool_slot.vertical_mirror and mirror_y_inside:
_draw_brush_image(_mirror_brushes.xy, _flip_rect(src_rect, size, true, true), Vector2(mirror_x, mirror_y))
if tool_slot.vertical_mirror and mirror_x_inside:
if tool_slot.vertical_mirror and mirror_y_inside:
_draw_brush_image(_mirror_brushes.y, _flip_rect(src_rect, size, false, true), Vector2(dst.x, mirror_y))