mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Compare commits
2 commits
b126e95b64
...
a7cf93d1e5
Author | SHA1 | Date | |
---|---|---|---|
a7cf93d1e5 | |||
508f8f0d15 |
|
@ -114,7 +114,7 @@ var current_project_index := 0:
|
||||||
## Tells if the user allowed to draw on the canvas. Usually it is temporarily set to
|
## Tells if the user allowed to draw on the canvas. Usually it is temporarily set to
|
||||||
## [code]false[/code] when we are moving some gizmo and don't want the current tool to accidentally
|
## [code]false[/code] when we are moving some gizmo and don't want the current tool to accidentally
|
||||||
## start drawing.[br](This does not depend on layer invisibility or lock/unlock status).
|
## start drawing.[br](This does not depend on layer invisibility or lock/unlock status).
|
||||||
var can_draw := false
|
var can_draw := true
|
||||||
## (Intended to be used as getter only) Tells if the user allowed to move the guide while on canvas.
|
## (Intended to be used as getter only) Tells if the user allowed to move the guide while on canvas.
|
||||||
var move_guides_on_canvas := true
|
var move_guides_on_canvas := true
|
||||||
|
|
||||||
|
|
|
@ -153,8 +153,6 @@ func _show_splash_screen() -> void:
|
||||||
|
|
||||||
$Dialogs/SplashDialog.popup_centered() # Splash screen
|
$Dialogs/SplashDialog.popup_centered() # Splash screen
|
||||||
modulate = Color(0.5, 0.5, 0.5)
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
|
||||||
Global.can_draw = true
|
|
||||||
|
|
||||||
|
|
||||||
func _handle_backup() -> void:
|
func _handle_backup() -> void:
|
||||||
|
@ -176,7 +174,6 @@ func _handle_backup() -> void:
|
||||||
_on_BackupConfirmation_custom_action.bind(project_paths, backup_paths)
|
_on_BackupConfirmation_custom_action.bind(project_paths, backup_paths)
|
||||||
)
|
)
|
||||||
backup_confirmation.popup_centered()
|
backup_confirmation.popup_centered()
|
||||||
Global.can_draw = false
|
|
||||||
modulate = Color(0.5, 0.5, 0.5)
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
if Global.open_last_project:
|
if Global.open_last_project:
|
||||||
|
|
|
@ -26,7 +26,6 @@ var image_current_pixel := Vector2.ZERO ## The ACTUAL pixel coordinate of image
|
||||||
|
|
||||||
var temp_rect := Rect2()
|
var temp_rect := Rect2()
|
||||||
var rect_aspect_ratio := 0.0
|
var rect_aspect_ratio := 0.0
|
||||||
var temp_rect_size := Vector2.ZERO
|
|
||||||
var temp_rect_pivot := Vector2.ZERO
|
var temp_rect_pivot := Vector2.ZERO
|
||||||
|
|
||||||
var original_big_bounding_rectangle := Rect2i()
|
var original_big_bounding_rectangle := Rect2i()
|
||||||
|
@ -136,23 +135,22 @@ func _input(event: InputEvent) -> void:
|
||||||
transform_content_start()
|
transform_content_start()
|
||||||
project.selection_offset = Vector2.ZERO
|
project.selection_offset = Vector2.ZERO
|
||||||
else:
|
else:
|
||||||
var prev_temp_rect := temp_rect
|
var horizontal_flip := signi(temp_rect.size.x)
|
||||||
dragged_gizmo.direction.x *= signi(temp_rect.size.x)
|
var vertical_flip := signi(temp_rect.size.y)
|
||||||
dragged_gizmo.direction.y *= signi(temp_rect.size.y)
|
dragged_gizmo.direction.x *= horizontal_flip
|
||||||
|
dragged_gizmo.direction.y *= vertical_flip
|
||||||
temp_rect = big_bounding_rectangle
|
temp_rect = big_bounding_rectangle
|
||||||
# If prev_temp_rect, which used to be the previous temp_rect, has negative size,
|
# If temp_rect had negative size, switch the position and end points
|
||||||
# switch the position and end point in temp_rect
|
if horizontal_flip < 0:
|
||||||
if prev_temp_rect.size.x < 0:
|
|
||||||
var pos := temp_rect.position.x
|
var pos := temp_rect.position.x
|
||||||
temp_rect.position.x = temp_rect.end.x
|
temp_rect.position.x = temp_rect.end.x
|
||||||
temp_rect.end.x = pos
|
temp_rect.end.x = pos
|
||||||
if prev_temp_rect.size.y < 0:
|
if vertical_flip < 0:
|
||||||
var pos := temp_rect.position.y
|
var pos := temp_rect.position.y
|
||||||
temp_rect.position.y = temp_rect.end.y
|
temp_rect.position.y = temp_rect.end.y
|
||||||
temp_rect.end.y = pos
|
temp_rect.end.y = pos
|
||||||
rect_aspect_ratio = absf(temp_rect.size.y / temp_rect.size.x)
|
rect_aspect_ratio = absf(temp_rect.size.y / temp_rect.size.x)
|
||||||
temp_rect_size = temp_rect.size
|
temp_rect_pivot = temp_rect.get_center()
|
||||||
temp_rect_pivot = (temp_rect.position + ((temp_rect.end - temp_rect.position) / 2))
|
|
||||||
|
|
||||||
elif dragged_gizmo: # Mouse released, deselect gizmo
|
elif dragged_gizmo: # Mouse released, deselect gizmo
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
@ -356,8 +354,6 @@ func _resize_rect(pos: Vector2, dir: Vector2) -> void:
|
||||||
var end_x := temp_rect.end.x
|
var end_x := temp_rect.end.x
|
||||||
temp_rect.position.x = pos.x
|
temp_rect.position.x = pos.x
|
||||||
temp_rect.end.x = end_x
|
temp_rect.end.x = end_x
|
||||||
else:
|
|
||||||
temp_rect.size.x = temp_rect_size.x
|
|
||||||
|
|
||||||
if dir.y > 0:
|
if dir.y > 0:
|
||||||
temp_rect.size.y = pos.y - temp_rect.position.y
|
temp_rect.size.y = pos.y - temp_rect.position.y
|
||||||
|
@ -365,8 +361,6 @@ func _resize_rect(pos: Vector2, dir: Vector2) -> void:
|
||||||
var end_y := temp_rect.end.y
|
var end_y := temp_rect.end.y
|
||||||
temp_rect.position.y = pos.y
|
temp_rect.position.y = pos.y
|
||||||
temp_rect.end.y = end_y
|
temp_rect.end.y = end_y
|
||||||
else:
|
|
||||||
temp_rect.size.y = temp_rect_size.y
|
|
||||||
|
|
||||||
|
|
||||||
func resize_selection() -> void:
|
func resize_selection() -> void:
|
||||||
|
@ -387,10 +381,8 @@ func resize_selection() -> void:
|
||||||
preview_image_texture = ImageTexture.create_from_image(preview_image)
|
preview_image_texture = ImageTexture.create_from_image(preview_image)
|
||||||
|
|
||||||
Global.current_project.selection_map.copy_from(original_bitmap)
|
Global.current_project.selection_map.copy_from(original_bitmap)
|
||||||
var bitmap_pivot := (
|
|
||||||
original_big_bounding_rectangle.position
|
var bitmap_pivot := original_big_bounding_rectangle.get_center()
|
||||||
+ ((original_big_bounding_rectangle.end - original_big_bounding_rectangle.position) / 2)
|
|
||||||
)
|
|
||||||
DrawingAlgos.nn_rotate(Global.current_project.selection_map, angle, bitmap_pivot)
|
DrawingAlgos.nn_rotate(Global.current_project.selection_map, angle, bitmap_pivot)
|
||||||
Global.current_project.selection_map.resize_bitmap_values(
|
Global.current_project.selection_map.resize_bitmap_values(
|
||||||
Global.current_project, size, temp_rect.size.x < 0, temp_rect.size.y < 0
|
Global.current_project, size, temp_rect.size.x < 0, temp_rect.size.y < 0
|
||||||
|
|
Loading…
Reference in a new issue