mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fixed crash that occured when trying to delete contents of a selection that were outside the canvas' borders
This commit is contained in:
parent
ff3b5e321b
commit
db29c1af67
|
@ -95,7 +95,7 @@ func _input(event : InputEvent) -> void:
|
|||
update()
|
||||
|
||||
sprite_changed_this_frame = false
|
||||
current_pixel = get_local_mouse_position() - location
|
||||
current_pixel = get_local_mouse_position() + location
|
||||
var mouse_pos := current_pixel
|
||||
var mouse_pos_floored := mouse_pos.floor()
|
||||
var mouse_pos_ceiled := mouse_pos.ceil()
|
||||
|
@ -449,7 +449,7 @@ func _draw() -> void:
|
|||
draw_line(Vector2(location.x, y), Vector2(size.x, y), Global.grid_color, true)
|
||||
|
||||
#Draw rectangle to indicate the pixel currently being hovered on
|
||||
var mouse_pos := get_local_mouse_position() + location
|
||||
var mouse_pos := current_pixel
|
||||
if point_in_rectangle(mouse_pos, location, location + size):
|
||||
mouse_pos = mouse_pos.floor()
|
||||
if Global.left_square_indicator_visible && Global.can_draw:
|
||||
|
|
|
@ -133,7 +133,8 @@ func _process(delta : float) -> void:
|
|||
Global.canvas.handle_undo("Draw")
|
||||
for xx in range(start_pos.x, end_pos.x):
|
||||
for yy in range(start_pos.y, end_pos.y):
|
||||
layer.set_pixel(xx, yy, Color(0, 0, 0, 0))
|
||||
if point_in_rectangle(Vector2(xx, yy), Global.canvas.location - Vector2.ONE, Global.canvas.location + Global.canvas.size):
|
||||
layer.set_pixel(xx, yy, Color(0, 0, 0, 0))
|
||||
Global.canvas.handle_redo("Draw")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue