Fix fragmentTransform of linearGradient
This commit is contained in:
@@ -97,8 +97,20 @@ class GUI : Extension {
|
|||||||
this.height = 100.percent
|
this.height = 100.percent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
styleSheet(has class_ "collapse-border") {
|
||||||
|
this.display = Display.FLEX
|
||||||
|
this.flexDirection = FlexDirection.Column
|
||||||
|
this.height = 5.px
|
||||||
|
this.width = 100.percent
|
||||||
|
this.background = Color.RGBa(ColorRGBa.GRAY.shade(0.9))
|
||||||
|
|
||||||
|
and(has state "hover") {
|
||||||
|
this.background = Color.RGBa(ColorRGBa.GRAY.shade(1.1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
styleSheet(has class_ "toolbar") {
|
styleSheet(has class_ "toolbar") {
|
||||||
this.height = 50.px
|
this.height = 42.px
|
||||||
this.width = 100.percent
|
this.width = 100.percent
|
||||||
this.display = Display.FLEX
|
this.display = Display.FLEX
|
||||||
this.flexDirection = FlexDirection.Row
|
this.flexDirection = FlexDirection.Row
|
||||||
@@ -124,6 +136,7 @@ class GUI : Extension {
|
|||||||
this.background = Color.RGBa(ColorRGBa.GRAY.copy(a = 0.99))
|
this.background = Color.RGBa(ColorRGBa.GRAY.copy(a = 0.99))
|
||||||
this.overflow = Overflow.Scroll
|
this.overflow = Overflow.Scroll
|
||||||
|
|
||||||
|
|
||||||
/* 1) setup control style */
|
/* 1) setup control style */
|
||||||
descendant(has type "colorpicker-button") {
|
descendant(has type "colorpicker-button") {
|
||||||
this.width = 175.px
|
this.width = 175.px
|
||||||
@@ -178,6 +191,9 @@ class GUI : Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val collapseBorder = div("collapse-border") {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
val collapsibles = mutableSetOf<Div>()
|
val collapsibles = mutableSetOf<Div>()
|
||||||
val sidebar = div("sidebar") {
|
val sidebar = div("sidebar") {
|
||||||
@@ -230,11 +246,11 @@ class GUI : Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header.mouse.pressed.subscribe {
|
collapseBorder.mouse.pressed.subscribe {
|
||||||
it.cancelPropagation()
|
it.cancelPropagation()
|
||||||
}
|
}
|
||||||
|
|
||||||
header.mouse.clicked.subscribe {
|
collapseBorder.mouse.clicked.subscribe {
|
||||||
val collapsed = ElementClass("collapsed")
|
val collapsed = ElementClass("collapsed")
|
||||||
if (collapsed in sidebar.classes) {
|
if (collapsed in sidebar.classes) {
|
||||||
sidebar.classes.remove(collapsed)
|
sidebar.classes.remove(collapsed)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import org.openrndr.math.Vector2
|
|||||||
fun linearGradient(color0: ColorRGBa, color1: ColorRGBa, offset : Vector2 = Vector2.ZERO, rotation:Double = 0.0) : ShadeStyle {
|
fun linearGradient(color0: ColorRGBa, color1: ColorRGBa, offset : Vector2 = Vector2.ZERO, rotation:Double = 0.0) : ShadeStyle {
|
||||||
return shadeStyle {
|
return shadeStyle {
|
||||||
fragmentTransform = """
|
fragmentTransform = """
|
||||||
vec2 coord = (c_boundsPosition.xy - vec2(0.5) + offset);
|
vec2 coord = (c_boundsPosition.xy - vec2(0.5) + p_offset);
|
||||||
float cr = cos(p_rotation);
|
float cr = cos(p_rotation);
|
||||||
float sr = sin(p_rotation);
|
float sr = sin(p_rotation);
|
||||||
mat2 rm = mat2(cr, -sr, sr, cr);
|
mat2 rm = mat2(cr, -sr, sr, cr);
|
||||||
@@ -30,7 +30,7 @@ fun linearGradient(color0: ColorRGBa, color1: ColorRGBa, offset : Vector2 = Vect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun radialGradient(color0: ColorRGBa, color1: ColorRGBa, offset: Vector2 = Vector2.ZERO, rotation:Double = 0.0) : ShadeStyle {
|
fun radialGradient(color0: ColorRGBa, color1: ColorRGBa, offset: Vector2 = Vector2.ZERO, rotation:Double = 0.0, length: Double = 1.0) : ShadeStyle {
|
||||||
return shadeStyle {
|
return shadeStyle {
|
||||||
fragmentTransform = """
|
fragmentTransform = """
|
||||||
vec2 coord = (c_boundsPosition.xy - vec2(0.5) + p_offset/2.0) * 2.0;
|
vec2 coord = (c_boundsPosition.xy - vec2(0.5) + p_offset/2.0) * 2.0;
|
||||||
@@ -38,7 +38,7 @@ fun radialGradient(color0: ColorRGBa, color1: ColorRGBa, offset: Vector2 = Vecto
|
|||||||
float cr = cos(p_rotation);
|
float cr = cos(p_rotation);
|
||||||
float sr = sin(p_rotation);
|
float sr = sin(p_rotation);
|
||||||
mat2 rm = mat2(cr, -sr, sr, cr);
|
mat2 rm = mat2(cr, -sr, sr, cr);
|
||||||
float f = clamp(length(rm * coord), 0.0, 1.0);
|
float f = clamp(p_length * length(rm * coord), 0.0, 1.0);
|
||||||
|
|
||||||
vec4 gradient = p_color0 * (1.0-f) + p_color1 * f;
|
vec4 gradient = p_color0 * (1.0-f) + p_color1 * f;
|
||||||
|
|
||||||
@@ -52,7 +52,8 @@ fun radialGradient(color0: ColorRGBa, color1: ColorRGBa, offset: Vector2 = Vecto
|
|||||||
parameter("offset", offset)
|
parameter("offset", offset)
|
||||||
parameter("color0", color0.alphaMultiplied)
|
parameter("color0", color0.alphaMultiplied)
|
||||||
parameter("color1", color1.alphaMultiplied)
|
parameter("color1", color1.alphaMultiplied)
|
||||||
parameter("rotation", Math.toRadians(rotation) )
|
parameter("rotation", Math.toRadians(rotation))
|
||||||
|
parameter("length", length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user