hide cursor on canvas, add mouse focus event, brush preview solid when small

This commit is contained in:
2019-03-06 20:39:27 +01:00
parent 5eba9f1227
commit 3296de98cc
15 changed files with 194 additions and 24 deletions

View File

@@ -1474,14 +1474,14 @@ Here's a list of what's available in this release.
<border color="0 0 0 0.6" width="80" dir="col" pad="5" align="center" mouse-capture="true" shrink="1">
<node dir="row" pad="5" shrink="1" min-height="100" max-height="150">
<!--size-->
<node dir="col" margin="0 4 0 0" align="center">
<node dir="col" margin="0 4 0 0" height="100%" align="center">
<text text="Size" margin="0 0 10 0"/>
<slider-v id="quick-size" height="100%" width="30"/>
<slider-v id="quick-size" height="1" grow="1" width="30"/>
</node>
<!--flow-->
<node dir="col" align="center">
<node dir="col" align="center" height="100%">
<text text="Flow" margin="0 0 10 0"/>
<slider-v id="quick-flow" height="100%" width="30"/>
<slider-v id="quick-flow" height="1" grow="1" width="30"/>
</node>
</node>
<!--color-->

View File

@@ -16,6 +16,8 @@ void main()
uniform sampler2D tex;
uniform mediump vec4 col;
uniform mediump float alpha;
uniform bool draw_outline;
in mediump vec2 uv;
out mediump vec4 frag;
@@ -23,16 +25,23 @@ out mediump vec4 frag;
void main()
{
mediump float stroke = 1.0 - texture(tex, uv).r;
int zero_count = 0;
if (textureOffset(tex, uv, ivec2(-1, -1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(-1, 0)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(-1, +1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2( 0, -1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2( 0, 0)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2( 0, +1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(+1, -1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(+1, 0)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(+1, +1)).r > 0.99) zero_count++;
mediump float edge = (zero_count > 1 && zero_count < 9) ? 0.75 : 0.0;
frag = vec4(col.rgb, edge * (1.0 - float(zero_count) / 9.f));
if (draw_outline)
{
int zero_count = 0;
if (textureOffset(tex, uv, ivec2(-1, -1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(-1, 0)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(-1, +1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2( 0, -1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2( 0, 0)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2( 0, +1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(+1, -1)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(+1, 0)).r > 0.99) zero_count++;
if (textureOffset(tex, uv, ivec2(+1, +1)).r > 0.99) zero_count++;
mediump float edge = (zero_count > 1 && zero_count < 9) ? 0.75 : 0.0;
frag = vec4(col.rgb, edge * (1.0 - float(zero_count) / 9.f));
}
else
{
frag = vec4(col.rgb, stroke * alpha);
}
}