on xenial help sign in
fix positioning of context
fe249d3Michael Zanetti
Components/Carousel.qml+4−2
@@ -49,6 +49,8 @@ Item {
49 property alias highlightIndex: listView.highlightIndex
49 property alias highlightIndex: listView.highlightIndex
50 /// exposes the delegate of the currentItem
50 /// exposes the delegate of the currentItem
51 readonly property alias currentItem: listView.currentItem
51 readonly property alias currentItem: listView.currentItem
52+ /// exposes the distance to the next row (only one row in carousel, so it's the topMargins
53+ readonly property alias verticalSpacing: listView.verticalMargin
52
54
53 /// Emitted when the user clicked on an item
55 /// Emitted when the user clicked on an item
54 /// @param index is the index of the clicked item
56 /// @param index is the index of the clicked item
@@ -160,7 +162,7 @@ Item {
160 /* We're clicking the selected item and
162 /* We're clicking the selected item and
161 we're in the neighbourhood of radius 1 pixel from it.
163 we're in the neighbourhood of radius 1 pixel from it.
162 Let's emit the clicked signal. */
164 Let's emit the clicked signal. */
163− carousel.clicked(index, listView.model, delegateItem.y)
165+ carousel.clicked(index, listView.model, 0)
164 return
166 return
165 }
167 }
166
168
@@ -184,7 +186,7 @@ Item {
184 /* We're pressAndHold the selected item and
186 /* We're pressAndHold the selected item and
185 we're in the neighbourhood of radius 1 pixel from it.
187 we're in the neighbourhood of radius 1 pixel from it.
186 Let's emit the pressAndHold signal. */
188 Let's emit the pressAndHold signal. */
187− carousel.pressAndHold(index, listView.model, delegateItem.y);
189+ carousel.pressAndHold(index, listView.model, 0);
188 return;
190 return;
189 }
191 }
190
192
Dash/GenericScopeView.qml+16−27
@@ -381,42 +381,30 @@ ScopeView {
381 // when the first preview is ready to be displayed.
381 // when the first preview is ready to be displayed.
382 property bool init: true
382 property bool init: true
383
383
384− // Used internally
385− property int oldRow: -1
386− property bool categoryWasFiltered: false
387− property int initialContenY: 0
388−
389 onCurrentIndexChanged: {
384 onCurrentIndexChanged: {
390 var row = Math.floor(currentIndex / categoryDelegate.columns);
385 var row = Math.floor(currentIndex / categoryDelegate.columns);
391 if (categoryDelegate.collapsedRowCount <= row) {
386 if (categoryDelegate.collapsedRowCount <= row) {
392 categoryView.expandedCategoryId = categoryId
387 categoryView.expandedCategoryId = categoryId
393 }
388 }
394− if (!init && model !== undefined) {
395− var item = model.get(currentIndex)
396− scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
397− if (oldRow != -1) {
398− if (row < oldRow) {
399− var effectMove = 0;
400− if (categoryView.contentY - categoryDelegate.cellHeight < 0) {
401− effectMove = categoryDelegate.cellHeight - categoryView.contentY;
402− effect.positionPx -= effectMove;
403− }
404− categoryView.contentY -= categoryDelegate.cellHeight - effectMove;
405− } else if (row > oldRow){
406− var effectMove = 0;
407− if (categoryView.contentY + categoryDelegate.cellHeight > categoryView.contentHeight - categoryView.height) {
408− effectMove = (categoryView.contentY + categoryDelegate.cellHeight) - (categoryView.contentHeight - categoryView.height);
409− effect.positionPx += effectMove;
410− }
411− categoryView.contentY += categoryDelegate.cellHeight - effectMove
412− }
413− }
414− }
415− oldRow = row;
416
389
417 if (open) {
390 if (open) {
418 categoryDelegate.highlightIndex = currentIndex
391 categoryDelegate.highlightIndex = currentIndex
419 }
392 }
393+ var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
394+ var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
395+ print("newContentY", newContentY, categoryView.originY);
396+ var effectAdjust = effect.positionPx;
397+ if (newContentY < 0) {
398+ effectAdjust += newContentY;
399+ newContentY = 0;
400+ }
401+ if (newContentY > categoryView.contentHeight - categoryView.height) {
402+ effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
403+ newContentY = categoryView.contentHeight - categoryView.height;
404+ }
405+
406+ effect.positionPx = effectAdjust;
407+ categoryView.contentY = newContentY;
420 }
408 }
421
409
422 property bool open: false
410 property bool open: false
@@ -426,6 +414,7 @@ ScopeView {
426 if (open) {
414 if (open) {
427 onScreen = true;
415 onScreen = true;
428 categoryDelegate.highlightIndex = currentIndex;
416 categoryDelegate.highlightIndex = currentIndex;
417+ newContentY = categoryView.contentY;
429 } else {
418 } else {
430 // Cancel any pending preview requests or actions
419 // Cancel any pending preview requests or actions
431 if (previewListView.currentItem.previewData !== undefined) {
420 if (previewListView.currentItem.previewData !== undefined) {