on xenial help sign in
some cleanup
5c197f1Michael Zanetti
Launcher/LauncherDelegate.qml+11−17
@@ -98,7 +98,7 @@ Item {
98 property real angle: root.angle
98 property real angle: root.angle
99 rotation: root.inverted ? 180 : 0
99 rotation: root.inverted ? 180 : 0
100
100
101− anchors.verticalCenterOffset: root.offset + (height - root.effectiveHeight)/2 * (angle < 0 ? 1 : -1)
101+ anchors.verticalCenterOffset: root.offset
102
102
103 property variant source: ShaderEffectSource {
103 property variant source: ShaderEffectSource {
104 sourceItem: iconItem
104 sourceItem: iconItem
@@ -106,6 +106,10 @@ Item {
106 }
106 }
107
107
108 transform: [
108 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.
109 Rotation {
113 Rotation {
110 axis { x: 1; y: 0; z: 0 }
114 axis { x: 1; y: 0; z: 0 }
111 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
115 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
@@ -121,30 +125,18 @@ Item {
121 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
125 origin { x: iconItem.width / 2; y: angle > 0 ? 0 : iconItem.height; z: 0 }
122 angle: root.angle * 0.7
126 angle: root.angle * 0.7
123 },
127 },
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.
124 Scale {
130 Scale {
125 xScale: 1 - (Math.abs(angle) / 500)
131 xScale: 1 - (Math.abs(angle) / 500)
126 yScale: 1 - (Math.abs(angle) / 500)
132 yScale: 1 - (Math.abs(angle) / 500)
127 origin { x: iconItem.width / 2; y: iconItem.height / 2}
133 origin { x: iconItem.width / 2; y: iconItem.height / 2}
128− },
129− Translate {
130− y: -(root.height - root.effectiveHeight) * 0.5 * priv.orientationFlag
131 }
134 }
132
135
133 ]
136 ]
134
137
135−/* vertexShader: "
138+ // Using a fragment shader instead of QML's opacity and BrightnessContrast
136− uniform highp mat4 qt_Matrix;
139+ // to be able to do both in one step which gives quite some better performance
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−*/
148 fragmentShader: "
140 fragmentShader: "
149 varying highp vec2 qt_TexCoord0;
141 varying highp vec2 qt_TexCoord0;
150 uniform sampler2D source;
142 uniform sampler2D source;
@@ -183,6 +175,7 @@ Item {
183 PropertyChanges {
175 PropertyChanges {
184 target: root
176 target: root
185
177
178+ // This is the offset that keeps the items in the panel
186 offset: {
179 offset: {
187 // First/last items are special
180 // First/last items are special
188 if (index == 0 || index == iconRepeater.count-1) {
181 if (index == 0 || index == iconRepeater.count-1) {
@@ -208,6 +201,7 @@ Item {
208
201
209 }
202 }
210
203
204+ // The angle used for rotating
211 angle: {
205 angle: {
212 //return 0;
206 //return 0;
213 // First item is special
207 // First item is special