1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Fix selection transformations and move tool not updating the canvas

This commit is contained in:
Emmanouil Papadeas 2023-11-01 02:55:44 +02:00
parent 58e694abec
commit 1e70a15055
2 changed files with 11 additions and 1 deletions

View file

@ -45,6 +45,7 @@ func draw_start(pos: Vector2i) -> void:
if Global.current_project.has_selection:
selection_node.transform_content_start()
_content_transformation_check = selection_node.is_moving_content
Global.canvas.sprite_changed_this_frame = true
func draw_move(pos: Vector2i) -> void:
@ -62,6 +63,7 @@ func draw_move(pos: Vector2i) -> void:
else:
Global.canvas.move_preview_location = pos - _start_pos
_offset = pos
Global.canvas.sprite_changed_this_frame = true
func draw_end(pos: Vector2i) -> void:
@ -91,6 +93,7 @@ func draw_end(pos: Vector2i) -> void:
_start_pos = Vector2.INF
_snap_to_grid = false
Global.canvas.sprite_changed_this_frame = true
func _snap_position(pos: Vector2) -> Vector2:

View file

@ -370,7 +370,7 @@ func _resize_rect(pos: Vector2, dir: Vector2) -> void:
func resize_selection() -> void:
var size := big_bounding_rectangle.size.abs()
var selection_map: SelectionMap = Global.current_project.selection_map
var selection_map := Global.current_project.selection_map
if is_moving_content:
selection_map = original_bitmap
preview_image.copy_from(original_preview_image)
@ -389,6 +389,7 @@ func resize_selection() -> void:
Global.current_project.selection_map = selection_map_copy
Global.current_project.selection_map_changed()
queue_redraw()
Global.canvas.queue_redraw()
func _gizmo_rotate() -> void: # Does not work properly yet
@ -423,6 +424,7 @@ func _gizmo_rotate() -> void: # Does not work properly yet
Global.current_project.selection_map_changed()
big_bounding_rectangle = bitmap_image.get_used_rect()
queue_redraw()
Global.canvas.queue_redraw()
func select_rect(rect: Rect2i, operation: int = SelectionOperation.ADD) -> void:
@ -475,6 +477,7 @@ func move_borders(move: Vector2i) -> void:
marching_ants_outline.offset += Vector2(move)
big_bounding_rectangle.position += move
queue_redraw()
Global.canvas.queue_redraw()
func move_borders_end() -> void:
@ -487,6 +490,7 @@ func move_borders_end() -> void:
else:
Global.current_project.selection_map_changed()
queue_redraw()
Global.canvas.queue_redraw()
func transform_content_start() -> void:
@ -503,6 +507,7 @@ func transform_content_start() -> void:
original_big_bounding_rectangle = big_bounding_rectangle
original_offset = Global.current_project.selection_offset
queue_redraw()
Global.canvas.queue_redraw()
func move_content(move: Vector2) -> void:
@ -547,6 +552,7 @@ func transform_content_confirm() -> void:
is_moving_content = false
is_pasting = false
queue_redraw()
Global.canvas.queue_redraw()
func transform_content_cancel() -> void:
@ -577,6 +583,7 @@ func transform_content_cancel() -> void:
original_bitmap = SelectionMap.new()
is_pasting = false
queue_redraw()
Global.canvas.queue_redraw()
func commit_undo(action: String, undo_data_tmp: Dictionary) -> void: