on xenial help sign in
some cleanup
commit5c197f1d74b1d7fcbf4a8a3d4312da7c85f99f7a authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 24 Jun 2013, 10:16 (13 years ago) parentf30b359
1 file changed+11−17
Launcher/LauncherDelegate.qml+11−17
Launcher/LauncherDelegate.qml+11−17
@@ -98,7 +98,7 @@ Item {
9898 property real angle: root.angle
9999 rotation: root.inverted ? 180 : 0
100100
101− anchors.verticalCenterOffset: root.offset + (height - root.effectiveHeight)/2 * (angle < 0 ? 1 : -1)
101+ anchors.verticalCenterOffset: root.offset
102102
103103 property variant source: ShaderEffectSource {
104104 sourceItem: iconItem
@@ -106,6 +106,10 @@ Item {
106106 }
107107
108108 transform: [
109+ // Rotating 3 times at top/bottom because that increases the perspective.
110+ // This is a hack, but as QML does not support real 3D coordinates
111+ // getting a higher perspective can only be done by a hack. This is the most
112+ // readable/understandable one I could come up with.
109113 Rotation {
110114 axis { x: 1; y: 0; z: 0 }
111115 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
@@ -121,30 +125,18 @@ Item {
121125 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
122126 angle: root.angle * 0.7
123127 },
128+ // Because rotating it 3 times moves it more to the front/back, i.e. it gets
129+ // bigger/smaller we need a scale to eliminate that side effect again.
124130 Scale {
125131 xScale: 1 - (Math.abs(angle) / 500)
126132 yScale: 1 - (Math.abs(angle) / 500)
127133 origin { x: iconItem.width / 2; y: iconItem.height / 2}
128− },
129− Translate {
130− y: -(root.height - root.effectiveHeight) * 0.5 * priv.orientationFlag
131134 }
132135
133136 ]
134137
135−/* vertexShader: "
136− uniform highp mat4 qt_Matrix;
137− attribute highp vec4 qt_Vertex;
138− varying highp vec2 qt_MultiTexCoord0;
139− varying highp vec2 coord;
140− uniform lowp float angle;
141− varying highp vec2 centerPoint;
142− void main() {
143− coord = qt_MultiTexCoord0;
144− highp vec4 rotatedVertex = qt_Vertex * angle;
145− gl_Position = qt_Matrix * rotatedVertex;
146− }"
147−*/
138+ // Using a fragment shader instead of QML's opacity and BrightnessContrast
139+ // to be able to do both in one step which gives quite some better performance
148140 fragmentShader: "
149141 varying highp vec2 qt_TexCoord0;
150142 uniform sampler2D source;
@@ -183,6 +175,7 @@ Item {
183175 PropertyChanges {
184176 target: root
185177
178+ // This is the offset that keeps the items in the panel
186179 offset: {
187180 // First/last items are special
188181 if (index == 0 || index == iconRepeater.count-1) {
@@ -208,6 +201,7 @@ Item {
208201
209202 }
210203
204+ // The angle used for rotating
211205 angle: {
212206 //return 0;
213207 // First item is special