mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Selection no longer affects the mirroring point of symmetry
Instead, x_symmetry_point and y_symmetry_point are being used in Project.gd that determine the points of symmetry. This is necessary for #133
This commit is contained in:
parent
70ba60cbaa
commit
7529e967e3
|
@ -67,13 +67,17 @@ func set_pixel_perfect(value: bool) -> void:
|
|||
|
||||
|
||||
func set_pixel(image: Image, position: Vector2, color: Color) -> void:
|
||||
var mirror_x = Global.current_project.x_max + Global.current_project.x_min - position.x - 1
|
||||
var mirror_y = Global.current_project.y_max + Global.current_project.y_min - position.y - 1
|
||||
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_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
|
||||
|
||||
drawers[0].set_pixel(image, position, color, color_op)
|
||||
if horizontal_mirror:
|
||||
if horizontal_mirror and mirror_x_inside:
|
||||
drawers[1].set_pixel(image, Vector2(mirror_x, position.y), color, color_op)
|
||||
if vertical_mirror:
|
||||
if vertical_mirror and mirror_y_inside:
|
||||
drawers[2].set_pixel(image, Vector2(mirror_x, mirror_y), color, color_op)
|
||||
if vertical_mirror:
|
||||
if vertical_mirror and mirror_y_inside:
|
||||
drawers[3].set_pixel(image, Vector2(position.x, mirror_y), color, color_op)
|
||||
|
|
|
@ -16,6 +16,8 @@ var guides := [] # Array of Guides
|
|||
|
||||
var brushes := [] # Array of Images
|
||||
|
||||
var x_symmetry_point := -1
|
||||
var y_symmetry_point := -1
|
||||
var x_min := 0
|
||||
var x_max := 64
|
||||
var y_min := 0
|
||||
|
|
|
@ -129,15 +129,17 @@ func fill_in_color(position : Vector2) -> void:
|
|||
|
||||
func fill_in_area(position : Vector2) -> void:
|
||||
var project : Project = Global.current_project
|
||||
var mirror_x := project.x_max + project.x_min - position.x - 1
|
||||
var mirror_y := project.y_max + project.y_min - position.y - 1
|
||||
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_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
|
||||
|
||||
_flood_fill(position)
|
||||
if tool_slot.horizontal_mirror:
|
||||
if tool_slot.horizontal_mirror and mirror_x_inside:
|
||||
_flood_fill(Vector2(mirror_x, position.y))
|
||||
if tool_slot.vertical_mirror:
|
||||
if tool_slot.vertical_mirror and mirror_y_inside:
|
||||
_flood_fill(Vector2(mirror_x, mirror_y))
|
||||
if tool_slot.vertical_mirror:
|
||||
if tool_slot.vertical_mirror and mirror_y_inside:
|
||||
_flood_fill(Vector2(position.x, mirror_y))
|
||||
|
||||
|
||||
|
|
|
@ -268,15 +268,18 @@ func draw_tool_brush(position : Vector2) -> void:
|
|||
var src_rect := Rect2(dst_rect.position - dst, dst_rect.size)
|
||||
dst = dst_rect.position
|
||||
|
||||
var mirror_x = draw_rect.end.x + draw_rect.position.x - dst.x - src_rect.size.x
|
||||
var mirror_y = draw_rect.end.y + draw_rect.position.y - dst.y - src_rect.size.y
|
||||
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_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
|
||||
|
||||
_draw_brush_image(_brush_image, src_rect, dst)
|
||||
if tool_slot.horizontal_mirror:
|
||||
if tool_slot.horizontal_mirror and mirror_x_inside:
|
||||
_draw_brush_image(_mirror_brushes.x, _flip_rect(src_rect, size, true, false), Vector2(mirror_x, dst.y))
|
||||
if tool_slot.vertical_mirror:
|
||||
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:
|
||||
if tool_slot.vertical_mirror and mirror_x_inside:
|
||||
_draw_brush_image(_mirror_brushes.y, _flip_rect(src_rect, size, false, true), Vector2(dst.x, mirror_y))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue