mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-13 09:12:08 -04:00
clipboard: Fix thumbnail load & modal bottom margin
This commit is contained in:
@@ -86,7 +86,7 @@ Item {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.leftMargin: Theme.spacingM
|
anchors.leftMargin: Theme.spacingM
|
||||||
anchors.rightMargin: Theme.spacingM
|
anchors.rightMargin: Theme.spacingM
|
||||||
anchors.bottomMargin: modal.showKeyboardHints ? (ClipboardConstants.keyboardHintsHeight + Theme.spacingM * 2) : 0
|
anchors.bottomMargin: (modal.showKeyboardHints ? (ClipboardConstants.keyboardHintsHeight + Theme.spacingM * 2) : 0) + Theme.spacingXS
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
DankListView {
|
DankListView {
|
||||||
@@ -112,14 +112,7 @@ Item {
|
|||||||
if (index < 0 || index >= count) {
|
if (index < 0 || index >= count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const itemHeight = ClipboardConstants.itemHeight + spacing;
|
positionViewAtIndex(index, ListView.Contain);
|
||||||
const itemY = index * itemHeight;
|
|
||||||
const itemBottom = itemY + itemHeight;
|
|
||||||
if (itemY < contentY) {
|
|
||||||
contentY = itemY;
|
|
||||||
} else if (itemBottom > contentY + height) {
|
|
||||||
contentY = itemBottom - height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
@@ -178,14 +171,7 @@ Item {
|
|||||||
if (index < 0 || index >= count) {
|
if (index < 0 || index >= count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const itemHeight = ClipboardConstants.itemHeight + spacing;
|
positionViewAtIndex(index, ListView.Contain);
|
||||||
const itemY = index * itemHeight;
|
|
||||||
const itemBottom = itemY + itemHeight;
|
|
||||||
if (itemY < contentY) {
|
|
||||||
contentY = itemY;
|
|
||||||
} else if (itemBottom > contentY + height) {
|
|
||||||
contentY = itemBottom - height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ Item {
|
|||||||
sourceSize.height: 128
|
sourceSize.height: 128
|
||||||
|
|
||||||
function tryLoadImage() {
|
function tryLoadImage() {
|
||||||
if (loadQueued || entryType !== "image" || cachedImageData) {
|
if (thumbnailImage.loadQueued || entryType !== "image" || thumbnailImage.cachedImageData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadQueued = true;
|
thumbnailImage.loadQueued = true;
|
||||||
if (modal.activeImageLoads < modal.maxConcurrentLoads) {
|
if (modal.activeImageLoads < modal.maxConcurrentLoads) {
|
||||||
modal.activeImageLoads++;
|
modal.activeImageLoads++;
|
||||||
loadImage();
|
thumbnailImage.loadImage();
|
||||||
} else {
|
} else {
|
||||||
retryTimer.restart();
|
retryTimer.restart();
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ Item {
|
|||||||
DMSService.sendRequest("clipboard.getEntry", {
|
DMSService.sendRequest("clipboard.getEntry", {
|
||||||
"id": entry.id
|
"id": entry.id
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
loadQueued = false;
|
thumbnailImage.loadQueued = false;
|
||||||
if (modal.activeImageLoads > 0) {
|
if (modal.activeImageLoads > 0) {
|
||||||
modal.activeImageLoads--;
|
modal.activeImageLoads--;
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ Item {
|
|||||||
}
|
}
|
||||||
const data = response.result?.data;
|
const data = response.result?.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
cachedImageData = data;
|
thumbnailImage.cachedImageData = data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user