on xenial help sign in
plop2
086f3bbNick Dedekind
qml/Panel/New/IndicatorsBar.qml+8−11
@@ -34,6 +34,7 @@ Item {
34 property var initialItem: null
34 property var initialItem: null
35 // the non-expanded distance from row offset to center of initial item
35 // the non-expanded distance from row offset to center of initial item
36 property real originalDistanceFromRight: -1
36 property real originalDistanceFromRight: -1
37+ property real originalItemWidth: -1
37
38
38 // calculate the distance from row offset to center of initial item
39 // calculate the distance from row offset to center of initial item
39 property real distanceFromRight: {
40 property real distanceFromRight: {
@@ -48,8 +49,10 @@ Item {
48 onInitialItemChanged: {
49 onInitialItemChanged: {
49 console.log("INITIAL CHANGED ", initialItem)
50 console.log("INITIAL CHANGED ", initialItem)
50 if (initialItem) {
51 if (initialItem) {
52+ originalItemWidth = initialItem.width;
51 originalDistanceFromRight = row.width - initialItem.x - initialItem.width/2;
53 originalDistanceFromRight = row.width - initialItem.x - initialItem.width/2;
52 } else {
54 } else {
55+ originalItemWidth = -1;
53 originalDistanceFromRight = -1;
56 originalDistanceFromRight = -1;
54 }
57 }
55 }
58 }
@@ -73,7 +76,7 @@ Item {
73 anchors.fill: parent
76 anchors.fill: parent
74 contentWidth: row.width
77 contentWidth: row.width
75 interactive: expanded
78 interactive: expanded
76− clip: true
79+// clip: true
77
80
78 rebound: Transition {
81 rebound: Transition {
79 NumberAnimation {
82 NumberAnimation {
@@ -93,7 +96,7 @@ Item {
93 }
96 }
94 }
97 }
95
98
96− onContentXChanged: console.log("contentX: ", contentX)
99+ Behavior on contentX { enabled: !expanded; NumberAnimation { duration: 1000 } }
97 }
100 }
98
101
99 states: [
102 states: [
@@ -122,8 +125,11 @@ Item {
122 rowOffset: {
125 rowOffset: {
123 if (!initialItem) return 0;
126 if (!initialItem) return 0;
124 if (distanceFromRight - initialItem.width <= 0) return 0;
127 if (distanceFromRight - initialItem.width <= 0) return 0;
128+ if (originalDistanceFromRight + originalItemWidth/2 > flickable.width)
129+ return distanceFromRight - originalDistanceFromRight + initialItem.width/2;
125
130
126 var rowOffset = distanceFromRight - originalDistanceFromRight;
131 var rowOffset = distanceFromRight - originalDistanceFromRight;
132+ console.log(originalDistanceFromRight + " flickable.width: " +flickable.width)
127 return rowOffset;
133 return rowOffset;
128 }
134 }
129 }
135 }
@@ -149,13 +155,4 @@ Item {
149 }
155 }
150 }
156 }
151 ]
157 ]
152−
153− transitions: [
154− Transition {
155− to: "minimized"
156− PropertyAction { target: d; properties: "rowOffset" }
157− PropertyAnimation { target: flickable; properties: "contentX"; duration: 1000; easing: UbuntuAnimation.StandardEasing }
158− PropertyAnimation { target: row; properties: "anchors.rightMargin"; duration: 1000; easing: UbuntuAnimation.StandardEasing }
159− }
160− ]
161}
158}