mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Selection rotation with gizmos works on selections without content now
Still not ready and thus not exposed
This commit is contained in:
parent
964e9fbd26
commit
3d04a8d276
|
@ -13,6 +13,11 @@ var is_pasting := false
|
||||||
var big_bounding_rectangle := Rect2i():
|
var big_bounding_rectangle := Rect2i():
|
||||||
set(value):
|
set(value):
|
||||||
big_bounding_rectangle = value
|
big_bounding_rectangle = value
|
||||||
|
if value.size == Vector2i(0, 0):
|
||||||
|
set_process_input(false)
|
||||||
|
Global.can_draw = true
|
||||||
|
else:
|
||||||
|
set_process_input(true)
|
||||||
for slot in Tools._slots.values():
|
for slot in Tools._slots.values():
|
||||||
if slot.tool_node is BaseSelectionTool:
|
if slot.tool_node is BaseSelectionTool:
|
||||||
slot.tool_node.set_spinbox_values()
|
slot.tool_node.set_spinbox_values()
|
||||||
|
@ -88,8 +93,6 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
var project := Global.current_project
|
var project := Global.current_project
|
||||||
if big_bounding_rectangle.size == Vector2i(0, 0):
|
|
||||||
return
|
|
||||||
image_current_pixel = canvas.current_pixel
|
image_current_pixel = canvas.current_pixel
|
||||||
if Global.mirror_view:
|
if Global.mirror_view:
|
||||||
image_current_pixel.x = Global.current_project.size.x - image_current_pixel.x
|
image_current_pixel.x = Global.current_project.size.x - image_current_pixel.x
|
||||||
|
@ -123,6 +126,7 @@ func _input(event: InputEvent) -> void:
|
||||||
transform_content_confirm()
|
transform_content_confirm()
|
||||||
if not is_moving_content:
|
if not is_moving_content:
|
||||||
original_bitmap.copy_from(Global.current_project.selection_map)
|
original_bitmap.copy_from(Global.current_project.selection_map)
|
||||||
|
original_big_bounding_rectangle = big_bounding_rectangle
|
||||||
if Input.is_action_pressed("transform_move_selection_only"):
|
if Input.is_action_pressed("transform_move_selection_only"):
|
||||||
undo_data = get_undo_data(false)
|
undo_data = get_undo_data(false)
|
||||||
temp_rect = big_bounding_rectangle
|
temp_rect = big_bounding_rectangle
|
||||||
|
@ -387,19 +391,18 @@ func resize_selection() -> void:
|
||||||
|
|
||||||
func _gizmo_rotate() -> void: ## Currently unused, as it does not work properly yet
|
func _gizmo_rotate() -> void: ## Currently unused, as it does not work properly yet
|
||||||
var angle := image_current_pixel.angle_to_point(mouse_pos_on_gizmo_drag)
|
var angle := image_current_pixel.angle_to_point(mouse_pos_on_gizmo_drag)
|
||||||
var pivot := Vector2(big_bounding_rectangle.size.x / 2.0, big_bounding_rectangle.size.y / 2.0)
|
if is_moving_content:
|
||||||
preview_image.copy_from(original_preview_image)
|
var pivot := Vector2(big_bounding_rectangle.size.x / 2.0, big_bounding_rectangle.size.y / 2.0)
|
||||||
DrawingAlgos.nn_rotate(preview_image, angle, pivot)
|
preview_image.copy_from(original_preview_image)
|
||||||
preview_image_texture = ImageTexture.create_from_image(preview_image)
|
DrawingAlgos.nn_rotate(preview_image, angle, pivot)
|
||||||
|
preview_image_texture = ImageTexture.create_from_image(preview_image)
|
||||||
|
|
||||||
var bitmap_image := SelectionMap.new()
|
Global.current_project.selection_map.copy_from(original_bitmap)
|
||||||
bitmap_image.copy_from(original_bitmap)
|
|
||||||
var bitmap_pivot := (
|
var bitmap_pivot := (
|
||||||
original_big_bounding_rectangle.position
|
original_big_bounding_rectangle.position
|
||||||
+ ((original_big_bounding_rectangle.end - original_big_bounding_rectangle.position) / 2)
|
+ ((original_big_bounding_rectangle.end - original_big_bounding_rectangle.position) / 2)
|
||||||
)
|
)
|
||||||
DrawingAlgos.nn_rotate(bitmap_image, angle, bitmap_pivot)
|
DrawingAlgos.nn_rotate(Global.current_project.selection_map, angle, bitmap_pivot)
|
||||||
Global.current_project.selection_map.copy_from(bitmap_image)
|
|
||||||
Global.current_project.selection_map_changed()
|
Global.current_project.selection_map_changed()
|
||||||
big_bounding_rectangle = Global.current_project.selection_map.get_used_rect()
|
big_bounding_rectangle = Global.current_project.selection_map.get_used_rect()
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
Loading…
Reference in a new issue