on xenial help sign in
Made panel heights a bit more easy to understand.
commit3673b8a0acf1fe24057754333f21cbea968cac5d authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 17 Jul 2013, 16:05 (13 years ago) parent74598dc
2 files changed+42−46
Panel/Indicators.qml+17−42 Panel/Panel.qml+25−4
Panel/Indicators.qml+17−42
@@ -25,14 +25,12 @@ import "../Components/Math.js" as MathLocal
2525Showable {
2626 id: indicators
2727
28− property int referenceOpenedHeight: units.gu(71)
29− property real openedHeight: pinnedMode ? referenceOpenedHeight - panelHeight
30− : referenceOpenedHeight
28+ property real openedHeight: units.gu(71)
3129 property int panelHeight: units.gu(3)
3230 property bool pinnedMode: true //should be set true if indicators menu can cover whole screen
3331
3432 property int hintValue
35− readonly property int lockThreshold: referenceOpenedHeight / 2
33+ readonly property int lockThreshold: openedHeight / 2
3634 property bool fullyOpened: height == openedHeight
3735 property bool partiallyOpened: height > panelHeight && !fullyOpened
3836
@@ -56,18 +54,20 @@ Showable {
5654
5755 onHeightChanged: {
5856 // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
59− var contentProgress = indicators.height - handle.get_height();
57+ var revealProgress = indicators.height - panelHeight
6058 if (!showAnimation.running && !hideAnimation.running) {
61− if (contentProgress <= hintValue && indicators.state == "reveal") {
59+ if (revealProgress == 0) {
60+ indicators.state = "initial"
61+ } else if (revealProgress <= hintValue && indicators.state == "reveal") {
6262 indicators.state = "hint";
63− } else if (contentProgress > hintValue && contentProgress < lockThreshold) {
63+ } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
6464 indicators.state = "reveal";
65− } else if (contentProgress >= lockThreshold && lockThreshold > 0) {
65+ } else if (revealProgress >= lockThreshold && lockThreshold > 0) {
6666 indicators.state = "locked";
6767 }
6868 }
6969
70− if (contentProgress == 0) {
70+ if (revealProgress == 0) {
7171 menuContent.releaseContent();
7272 }
7373 }
@@ -155,7 +155,7 @@ Showable {
155155 left: parent.left
156156 right: parent.right
157157 top: indicatorRow.bottom
158− bottom: parent.bottom
158+ bottom: handle.top
159159 }
160160 indicatorsModel: indicatorsModel
161161 clip: !indicators.fullyOpened
@@ -188,7 +188,7 @@ Showable {
188188 anchors {
189189 left: parent.left
190190 right: parent.right
191− top: menuContent.bottom
191+ bottom: parent.bottom
192192 }
193193 height: get_height()
194194 clip: height < handleImage.height
@@ -212,33 +212,14 @@ Showable {
212212 }
213213 }
214214
215− PanelSeparatorLine {
216− id: indicatorsSeparatorLine
217− visible: true
218− anchors {
219− top: handle.bottom
220− left: indicators.left
221− right: indicators.right
222− }
223− }
224−
225− BorderImage {
226− id: dropShadow
227− anchors {
228− top: indicators.top
229− bottom: indicatorsSeparatorLine.bottom
230− left: indicators.left
231− right: indicators.right
232− margins: -units.gu(1)
233− }
234− visible: indicators.height > panelHeight
235− source: "graphics/rectangular_dropshadow.sci"
236− }
237−
238215 PanelBackground {
239216 anchors.fill: indicatorRow
240217 }
241218
219+ IndicatorsDataModel {
220+ id: indicatorsModel
221+ }
222+
242223 IndicatorRow {
243224 id: indicatorRow
244225 objectName: "indicatorRow"
@@ -251,11 +232,6 @@ Showable {
251232 state: indicators.state
252233
253234 onCurrentItemIndexChanged: menuContent.currentIndex = currentItemIndex
254−
255− }
256−
257− IndicatorsDataModel {
258− id: indicatorsModel
259235 }
260236
261237 Connections {
@@ -314,7 +290,7 @@ Showable {
314290 hintDisplacement: pinnedMode ? indicators.hintValue : 0
315291 autoCompleteDragThreshold: maxTotalDragDistance / 2
316292 stretch: true
317− maxTotalDragDistance: openedHeight - handle.height
293+ maxTotalDragDistance: openedHeight - panelHeight
318294 distanceThreshold: pinnedMode ? 0 : units.gu(3)
319295
320296 onStatusChanged: {
@@ -326,13 +302,12 @@ Showable {
326302 DragHandle {
327303 id: hideDragHandle
328304 anchors.fill: handle
329− height: panelHeight
330305 direction: Direction.Upwards
331306 enabled: indicators.shown
332307 hintDisplacement: units.gu(2)
333308 autoCompleteDragThreshold: maxTotalDragDistance / 6
334309 stretch: true
335− maxTotalDragDistance: referenceOpenedHeight - 2*panelHeight
310+ maxTotalDragDistance: openedHeight - panelHeight
336311 distanceThreshold: 0
337312 }
338313
Panel/Panel.qml+25−4
@@ -39,7 +39,6 @@ Item {
3939 }
4040 height: __panelMinusSeparatorLineHeight
4141 y: 0
42− onYChanged: indicatorsMenu.y = y;
4342
4443 Behavior on y { StandardAnimation {} }
4544 }
@@ -76,18 +75,40 @@ Item {
7675 id: indicatorsMenu
7776
7877 anchors.right: parent.right
79− y: 0
78+ y: panelBackground.y
8079 width: root.indicatorsMenuWidth
8180 shown: false
8281 hintValue: __panelMinusSeparatorLineHeight * 3
8382 panelHeight: __panelMinusSeparatorLineHeight
84− referenceOpenedHeight: parent.height
85−
83+ openedHeight: parent.height + (pinnedMode ? 0 : root.panelHeight)
8684 pinnedMode: !fullscreenMode
8785
8886 property real unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
8987 }
9088
89+ PanelSeparatorLine {
90+ id: indicatorsSeparatorLine
91+ visible: true
92+ anchors {
93+ top: indicatorsMenu.bottom
94+ left: indicatorsMenu.left
95+ right: indicatorsMenu.right
96+ }
97+ }
98+
99+ BorderImage {
100+ id: dropShadow
101+ anchors {
102+ top: indicators.top
103+ bottom: indicatorsSeparatorLine.bottom
104+ left: indicators.left
105+ right: indicators.right
106+ margins: -units.gu(1)
107+ }
108+ visible: indicatorsMenu.height > indicatorsMenu.panelHeight
109+ source: "graphics/rectangular_dropshadow.sci"
110+ }
111+
91112 SearchIndicator {
92113 id: search
93114 objectName: "search"