mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Possible fix of #10 - thanks azagaya!
This commit is contained in:
parent
3312b8064f
commit
f10bf4c96f
|
@ -476,6 +476,7 @@ hint_tooltip = "Color picker for the right tool"
|
|||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
|
||||
[node name="BrushType" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"]
|
||||
margin_top = 82.0
|
||||
|
|
|
@ -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…
Reference in a new issue