forked from Shinonome/dots-hyprland
Remove tricky calculations and fix sourceSize
This commit is contained in:
@@ -54,8 +54,8 @@ Variants {
|
|||||||
property int wallpaperHeight: modelData.height // Some reasonable init value, to be updated
|
property int wallpaperHeight: modelData.height // Some reasonable init value, to be updated
|
||||||
property real scaledWallpaperWidth: wallpaperWidth * effectiveWallpaperScale
|
property real scaledWallpaperWidth: wallpaperWidth * effectiveWallpaperScale
|
||||||
property real scaledWallpaperHeight: wallpaperHeight * effectiveWallpaperScale
|
property real scaledWallpaperHeight: wallpaperHeight * effectiveWallpaperScale
|
||||||
property real parallaxTotalPixelsX: Math.max(screen.width - scaledWallpaperWidth, scaledWallpaperWidth - screen.width)
|
property real parallaxTotalPixelsX: Math.max(0, scaledWallpaperWidth - screen.width)
|
||||||
property real parallaxTotalPixelsY: Math.max(screen.height - scaledWallpaperHeight, scaledWallpaperHeight - screen.height)
|
property real parallaxTotalPixelsY: Math.max(0, scaledWallpaperHeight - screen.height)
|
||||||
readonly property bool verticalParallax: (Config.options.background.parallax.autoVertical && wallpaperHeight > wallpaperWidth) || Config.options.background.parallax.vertical
|
readonly property bool verticalParallax: (Config.options.background.parallax.autoVertical && wallpaperHeight > wallpaperWidth) || Config.options.background.parallax.vertical
|
||||||
// Colors
|
// Colors
|
||||||
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable)
|
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable)
|
||||||
@@ -150,7 +150,7 @@ Variants {
|
|||||||
x: {
|
x: {
|
||||||
if (bgRoot.screen.width > bgRoot.scaledWallpaperWidth) {
|
if (bgRoot.screen.width > bgRoot.scaledWallpaperWidth) {
|
||||||
// Center the picture
|
// Center the picture
|
||||||
return bgRoot.parallaxTotalPixelsX / 2;
|
return (bgRoot.screen.width - bgRoot.scaledWallpaperWidth) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
let usedFraction = middleFraction;
|
let usedFraction = middleFraction;
|
||||||
@@ -167,7 +167,7 @@ Variants {
|
|||||||
y: {
|
y: {
|
||||||
if (bgRoot.screen.height > bgRoot.scaledWallpaperHeight) {
|
if (bgRoot.screen.height > bgRoot.scaledWallpaperHeight) {
|
||||||
// Center the picture
|
// Center the picture
|
||||||
return bgRoot.parallaxTotalPixelsY / 2;
|
return (bgRoot.screen.height - bgRoot.scaledWallpaperHeight) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
let usedFraction = middleFraction;
|
let usedFraction = middleFraction;
|
||||||
@@ -193,8 +193,8 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceSize {
|
sourceSize {
|
||||||
width: Math.max(bgRoot.wallpaperWidth, bgRoot.wallpaperWidth / bgRoot.parallaxRation)
|
width: bgRoot.scaledWallpaperWidth
|
||||||
height: Math.max(bgRoot.wallpaperHeight, bgRoot.wallpaperHeight / bgRoot.parallaxRation)
|
height: bgRoot.scaledWallpaperHeight
|
||||||
}
|
}
|
||||||
width: bgRoot.scaledWallpaperWidth
|
width: bgRoot.scaledWallpaperWidth
|
||||||
height: bgRoot.scaledWallpaperHeight
|
height: bgRoot.scaledWallpaperHeight
|
||||||
|
|||||||
Reference in New Issue
Block a user