diff options
author | Marko Niemelä <marko.a.niemela@nokia.com> | 2012-01-31 15:06:59 +0200 |
---|---|---|
committer | Marko Niemelä <marko.a.niemela@nokia.com> | 2012-01-31 15:06:59 +0200 |
commit | 6202581810d050372aab83b14cd4836fe773f93b (patch) | |
tree | b1acd12a9182d98c9c60d4e86ae25bf3f547baba /tests | |
parent | edc307c3576f1a491587f550d9016b0745466554 (diff) |
Fixed TestBed HSL color picker
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/manual/testbed/ColorPicker.qml | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/manual/testbed/ColorPicker.qml b/tests/manual/testbed/ColorPicker.qml index b7fe953..a980492 100755 --- a/tests/manual/testbed/ColorPicker.qml +++ b/tests/manual/testbed/ColorPicker.qml @@ -67,11 +67,11 @@ Item { anchors.left: parent.left anchors.leftMargin: 10 anchors.top: parent.top - anchors.topMargin: 10 + anchors.topMargin: 5 width: 68 height: width - property real hue: root.hue opacity: 0.01 + property real hue: root.hue fragmentShader: " varying mediump vec2 qt_TexCoord0; @@ -116,8 +116,7 @@ Item { void main() { lowp vec4 c = vec4(1.0); - //c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s)); - c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.y, 0.5 * qt_TexCoord0.x * (qt_TexCoord0.y + 1.0))); + c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s)); gl_FragColor = c * qt_Opacity; } " @@ -131,19 +130,18 @@ Item { if (pressed) { var xx = Math.max(0, Math.min(mouse.x, parent.width)) var yy = Math.max(0, Math.min(mouse.y, parent.height)) - crosshair.x = xx - crosshair.width / 2 - crosshair.y = yy - crosshair.height / 2 root.saturation = 1.0 - yy / parent.height - root.lightness = 0.5 * xx / parent.width * (yy / parent.height + 1.0) + root.lightness = xx / parent.width } } + onPressed: positionChanged(mouse) + onEntered: map.opacity = 1 onReleased: { if (mouse.x < 0 || mouse.x > parent.width || mouse.y < 0 || mouse.y > parent.height) { map.opacity = 0.01; } } - onPressed: positionChanged(mouse) onExited: { if (!pressed) { map.opacity = 0.01; @@ -157,11 +155,8 @@ Item { x: root.lightness * parent.width - width / 2 y: (1.0 - root.saturation) * parent.height - height / 2 } - - Behavior on opacity { PropertyAnimation { duration: 100 } } } - Column { anchors.left: parent.left anchors.right: parent.right |