~ci-train-bot/unity8/ubuntu-rtm-14.09-proposed

« back to all changes in this revision

Viewing changes to qml/Panel/IndicatorsBar.qml

  • Committer: CI Train Bot
  • Author(s): Nick Dedekind
  • Date: 2015-01-20 11:18:06 UTC
  • mfrom: (1410.2.8 rtm-20150113)
  • Revision ID: ci-train-bot@canonical.com-20150120111806-98c0xuq7cncqfiw7
Unhook Lights interface from indicator widgets
Approved by: Albert Astals Cid Fixes: #1385331

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
    function addScrollOffset(scrollAmmout) {
48
48
        if (scrollAmmout < 0) { // left scroll
49
 
            if (flickable.contentX < 0) return; // already off the left.
50
 
            if (flickable.contentX + scrollAmmout < 0) scrollAmmout = -flickable.contentX; // going to be off the left
 
49
            if (flickable.contentX + flickable.width > row.width) return; // already off the left.
 
50
 
 
51
            if (flickable.contentX + flickable.width - scrollAmmout > row.width) { // going to be off the right
 
52
                scrollAmmout = (flickable.contentX + flickable.width) - row.width;
 
53
            }
51
54
        } else { // right scroll
52
 
            if (flickable.contentX + flickable.width > row.width) return; // already off the right.
53
 
            if (flickable.contentX + flickable.width + scrollAmmout > row.width) { // going to be off the right
54
 
                scrollAmmout = row.width - (flickable.contentX + flickable.width);
55
 
            }
 
55
            if (flickable.contentX < 0) return; // already off the right.
 
56
            if (flickable.contentX - scrollAmmout < 0) scrollAmmout = flickable.contentX; // going to be off the right
56
57
        }
57
58
        d.scrollOffset = d.scrollOffset + scrollAmmout;
58
59
    }
91
92
            flickable.resetContentXComponents();
92
93
 
93
94
            if (expanded && !flickable.moving) {
94
 
 
95
95
                // gap between left and row?
96
 
                if (flickable.contentX < 0) {
97
 
                    d.alignmentAdjustment += flickable.contentX;
98
 
                // gap between right and row?
99
 
                } else if (flickable.contentX + flickable.width > row.width) {
 
96
                if (flickable.contentX + flickable.width > row.width) {
100
97
                    // row width is less than flickable
101
98
                    if (row.width < flickable.width) {
102
 
                        d.alignmentAdjustment += flickable.contentX;
 
99
                        d.alignmentAdjustment -= flickable.contentX;
103
100
                    } else {
104
 
                        d.alignmentAdjustment += ((flickable.contentX + flickable.width) - row.width);
 
101
                        d.alignmentAdjustment -= ((flickable.contentX + flickable.width) - row.width);
105
102
                    }
 
103
 
 
104
                    // gap between right and row?
 
105
                } else if (flickable.contentX < 0) {
 
106
                    d.alignmentAdjustment -= flickable.contentX;
 
107
 
106
108
                // current item overlap on left
107
 
                } else if (row.currentItem && row.currentItem.x < flickable.contentX) {
108
 
                    d.alignmentAdjustment -= (row.currentItem.x - flickable.contentX);
 
109
                } else if (row.currentItem && (flickable.contentX + flickable.width) < (row.width - row.currentItem.x)) {
 
110
                    d.alignmentAdjustment += ((row.width - row.currentItem.x) - (flickable.contentX + flickable.width));
 
111
 
109
112
                // current item overlap on right
110
 
                } else if (row.currentItem && row.currentItem.x + row.currentItem.width > flickable.contentX + flickable.width) {
111
 
                    d.alignmentAdjustment -= ((row.currentItem.x + row.currentItem.width) - (flickable.contentX + flickable.width));
 
113
                } else if (row.currentItem && flickable.contentX > (row.width - row.currentItem.x - row.currentItem.width)) {
 
114
                    d.alignmentAdjustment -= flickable.contentX - (row.width - row.currentItem.x - row.currentItem.width);
112
115
                }
113
116
            }
114
117
        }
134
137
            id: flickable
135
138
            objectName: "flickable"
136
139
 
 
140
            // we rotate it because we want the Flickable to align its content item
 
141
            // on the right instead of on the left
 
142
            rotation: 180
 
143
 
137
144
            anchors.fill: parent
138
145
            contentWidth: row.width
 
146
            contentX: d.combinedOffset
139
147
            interactive: false
140
 
            // align right + offset from row selection + scrolling
141
 
            contentX: row.width - flickable.width - d.combinedOffset
142
148
 
143
149
            // contentX can change by user interaction as well as user offset changes
144
150
            // This function re-aligns the offsets so that the offsets match the contentX
145
151
            function resetContentXComponents() {
146
 
                d.scrollOffset += (flickable.contentX - (row.width - flickable.width - d.combinedOffset));
 
152
                d.scrollOffset += d.combinedOffset - flickable.contentX;
147
153
            }
148
154
 
149
155
            rebound: Transition {
162
168
                    bottom: parent.bottom
163
169
                }
164
170
 
 
171
                // Compensate for the Flickable rotation (ie, counter-rotate)
 
172
                rotation: 180
 
173
 
165
174
                lateralPosition: {
166
175
                    if (root.lateralPosition == -1) return -1;
167
176