forked from Shinonome/dots-hyprland
background: fix small wallpapers going off the screen
This commit is contained in:
@@ -91,13 +91,19 @@ Variants {
|
|||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
const output = wallpaperSizeOutputCollector.text
|
const output = wallpaperSizeOutputCollector.text
|
||||||
const [width, height] = output.split(" ").map(Number);
|
const [width, height] = output.split(" ").map(Number);
|
||||||
|
const [screenWidth, screenHeight] = [bgRoot.screen.width, bgRoot.screen.height];
|
||||||
bgRoot.wallpaperWidth = width
|
bgRoot.wallpaperWidth = width
|
||||||
bgRoot.wallpaperHeight = height
|
bgRoot.wallpaperHeight = height
|
||||||
bgRoot.effectiveWallpaperScale = Math.max(1, Math.min(
|
|
||||||
bgRoot.preferredWallpaperScale,
|
if (width <= screenWidth || height <= screenHeight) { // Undersized/perfectly sized wallpapers
|
||||||
width / bgRoot.screen.width,
|
bgRoot.effectiveWallpaperScale = Math.max(screenWidth / width, screenHeight / height);
|
||||||
height / bgRoot.screen.height
|
} else { // Oversized = can be zoomed for parallax, yay
|
||||||
));
|
bgRoot.effectiveWallpaperScale = Math.min(
|
||||||
|
bgRoot.preferredWallpaperScale,
|
||||||
|
width / screenWidth, height / screenHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bgRoot.updateClockPosition()
|
bgRoot.updateClockPosition()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user