mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Remove drawn_rect from Selection.gd and use draw_preview() in RectSelect.gd instead
This commit is contained in:
parent
5f84629144
commit
ea8bfcd25d
|
@ -32,21 +32,30 @@ func draw_move(position : Vector2) -> void:
|
|||
_start_pos += position - _offset
|
||||
_rect = _get_result_rect(_start_pos, position)
|
||||
_set_cursor_text(_rect)
|
||||
Global.canvas.selection.drawn_rect = _rect
|
||||
Global.canvas.selection.update()
|
||||
_offset = position
|
||||
|
||||
|
||||
func draw_end(position : Vector2) -> void:
|
||||
.draw_end(position)
|
||||
_rect = Rect2(0, 0, 0, 0)
|
||||
Global.canvas.selection.drawn_rect = _rect
|
||||
Global.canvas.selection.update()
|
||||
_square = false
|
||||
_expand_from_center = false
|
||||
_displace_origin = false
|
||||
|
||||
|
||||
func draw_preview() -> void:
|
||||
if !_move:
|
||||
var canvas : Node2D = Global.canvas.previews
|
||||
var _position := canvas.position
|
||||
var _scale := canvas.scale
|
||||
if Global.mirror_view:
|
||||
_position.x = _position.x + Global.current_project.size.x
|
||||
_scale.x = -1
|
||||
canvas.draw_set_transform(_position, canvas.rotation, _scale)
|
||||
canvas.draw_rect(_rect, Color.black, false)
|
||||
canvas.draw_set_transform(canvas.position, canvas.rotation, canvas.scale)
|
||||
|
||||
|
||||
func apply_selection(_position) -> void:
|
||||
if !_add and !_subtract and !_intersect:
|
||||
Global.canvas.selection.clear_selection()
|
||||
|
|
|
@ -54,7 +54,6 @@ var original_offset := Vector2.ZERO
|
|||
var preview_image := Image.new()
|
||||
var preview_image_texture := ImageTexture.new()
|
||||
var undo_data : Dictionary
|
||||
var drawn_rect := Rect2(0, 0, 0, 0)
|
||||
var gizmos := [] # Array of Gizmos
|
||||
var dragged_gizmo : Gizmo = null
|
||||
var prev_angle := 0
|
||||
|
@ -143,7 +142,6 @@ func _draw() -> void:
|
|||
_position.x = _position.x + Global.current_project.size.x
|
||||
_scale.x = -1
|
||||
draw_set_transform(_position, rotation, _scale)
|
||||
draw_rect(drawn_rect, Color.black, false)
|
||||
if big_bounding_rectangle.size != Vector2.ZERO:
|
||||
for gizmo in gizmos: # Draw gizmos
|
||||
draw_rect(gizmo.rect, Color.black)
|
||||
|
|
Loading…
Reference in a new issue