mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 07:04:43 -04:00
Possible fix of #10 - thanks azagaya!
This commit is contained in:
parent
3312b8064f
commit
f10bf4c96f
2 changed files with 6 additions and 0 deletions
|
@ -625,6 +625,11 @@ func flood_fill(pos : Vector2, target_color : Color, replace_color : Color) -> v
|
|||
|
||||
var q = [pos]
|
||||
for n in q:
|
||||
#If the difference in colors is very small, break the loop (thanks @azagaya on GitHub!)
|
||||
var c = target_color - replace_color
|
||||
var dist = sqrt(c.r*c.r + c.g*c.g + c.b*c.b + c.a*c.a)
|
||||
if dist <= 0.005:
|
||||
break
|
||||
var west : Vector2 = n
|
||||
var east : Vector2 = n
|
||||
while west.x >= west_limit && layers[current_layer_index][0].get_pixelv(west) == target_color:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue