mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Fix out-of-bounds error when color picking outside the image (#291)
This commit is contained in:
parent
65828b328a
commit
f715b566b1
|
@ -229,7 +229,7 @@ func scale_image(width : int, height : int, interpolation : int) -> void:
|
|||
# Different method for scale3x
|
||||
if interpolation == 5:
|
||||
var times : Vector2 = Vector2(ceil(width/(3.0*sprite.get_width())),ceil(height/(3.0*sprite.get_height())))
|
||||
for j in range(max(times.x,times.y)):
|
||||
for _j in range(max(times.x,times.y)):
|
||||
sprite.copy_from(scale3X(sprite))
|
||||
sprite.resize(width, height, 0)
|
||||
else:
|
||||
|
|
|
@ -37,8 +37,14 @@ func draw_end(_position : Vector2) -> void:
|
|||
|
||||
|
||||
func _pick_color(position : Vector2) -> void:
|
||||
if position.x < 0 or position.y < 0:
|
||||
return
|
||||
|
||||
var image := Image.new()
|
||||
image.copy_from(_get_draw_image())
|
||||
if position.x > image.get_width() - 1 or position.y > image.get_height() - 1:
|
||||
return
|
||||
|
||||
image.lock()
|
||||
var color := image.get_pixelv(position)
|
||||
var button := BUTTON_LEFT if _color_slot == 0 else BUTTON_RIGHT
|
||||
|
|
Loading…
Reference in a new issue