mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Background: avoid resizing wallpapers if one of the axis fits perfectly on screen.
This commit is contained in:
@@ -121,6 +121,7 @@ Variants {
|
|||||||
visible: false
|
visible: false
|
||||||
cache: false
|
cache: false
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
sourceSize: undefined
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Image.Error) {
|
if (status === Image.Error) {
|
||||||
@@ -137,6 +138,11 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function calculateSourceSize() {
|
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) {
|
if (implicitWidth > 0 && implicitHeight > 0) {
|
||||||
const imageAspectRatio = implicitWidth / implicitHeight
|
const imageAspectRatio = implicitWidth / implicitHeight
|
||||||
if (modelData.width >= modelData.height) {
|
if (modelData.width >= modelData.height) {
|
||||||
@@ -161,6 +167,7 @@ Variants {
|
|||||||
visible: false
|
visible: false
|
||||||
cache: false
|
cache: false
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
sourceSize: undefined
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Image.Error) {
|
if (status === Image.Error) {
|
||||||
@@ -177,6 +184,11 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function calculateSourceSize() {
|
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) {
|
if (implicitWidth > 0 && implicitHeight > 0) {
|
||||||
const imageAspectRatio = implicitWidth / implicitHeight
|
const imageAspectRatio = implicitWidth / implicitHeight
|
||||||
if (modelData.width >= modelData.height) {
|
if (modelData.width >= modelData.height) {
|
||||||
|
|||||||
Reference in New Issue
Block a user