Background: avoid resizing wallpapers if one of the axis fits perfectly on screen.

This commit is contained in:
ItsLemmy
2025-10-10 12:04:09 -04:00
parent acd776a187
commit 7df875dd3e
+12
View File
@@ -121,6 +121,7 @@ Variants {
visible: false
cache: false
asynchronous: true
sourceSize: undefined
onStatusChanged: {
if (status === Image.Error) {
@@ -137,6 +138,11 @@ Variants {
}
function calculateSourceSize() {
if (implicitWidth === modelData.width || implicitHeight === modelData.height) {
// Do not resize if one of the dimensions fits perfectly on the screen
return
}
if (implicitWidth > 0 && implicitHeight > 0) {
const imageAspectRatio = implicitWidth / implicitHeight
if (modelData.width >= modelData.height) {
@@ -161,6 +167,7 @@ Variants {
visible: false
cache: false
asynchronous: true
sourceSize: undefined
onStatusChanged: {
if (status === Image.Error) {
@@ -177,6 +184,11 @@ Variants {
}
function calculateSourceSize() {
if (implicitWidth === modelData.width || implicitHeight === modelData.height) {
// Do not resize if one of the dimensions fits perfectly on the screen
return
}
if (implicitWidth > 0 && implicitHeight > 0) {
const imageAspectRatio = implicitWidth / implicitHeight
if (modelData.width >= modelData.height) {