fix: normalize zoom slider to linear scale
C++ / fmt (pull_request) Successful in 4s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 7s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Successful in 27s
Rust / build (pull_request) Successful in 51s
Python / verify (pull_request) Successful in 1m45s
Rust / fmt (pull_request) Successful in 31s
Rust / clippy (pull_request) Successful in 47s

This commit is contained in:
2026-09-30 00:50:31 +02:00
parent f41075d316
commit c2428d1d76
+13 -5
View File
@@ -13,13 +13,23 @@ import qs.Services
Item { Item {
id: wrapper id: wrapper
readonly property var currentScreen: screens.length > selectedScreenIndex ? screens[selectedScreenIndex] : null
readonly property real maxZoom: 5.0
property int buttonRowHeight: Tokens.padding.large * 3 property int buttonRowHeight: Tokens.padding.large * 3
property bool changesMade: false property bool changesMade: false
readonly property var currentScreen: screens.length > selectedScreenIndex ? screens[selectedScreenIndex] : null
property var screens: [] property var screens: []
property int selectedScreenIndex: 0 property int selectedScreenIndex: 0
property bool shouldBeActive: true property bool shouldBeActive: true
function zoomFromSlider(t: real): real {
return 1 / (1 - t * (1 - 1 / maxZoom));
}
function sliderFromZoom(zoom: real): real {
return (1 - 1 / zoom) / (1 - 1 / maxZoom);
}
function applyCrop(): void { function applyCrop(): void {
if (!cropRectLoader.item || !currentScreen) if (!cropRectLoader.item || !currentScreen)
return; return;
@@ -144,14 +154,12 @@ Item {
Layout.leftMargin: Tokens.padding.small Layout.leftMargin: Tokens.padding.small
Layout.preferredHeight: Tokens.padding.medium * 3 Layout.preferredHeight: Tokens.padding.medium * 3
Layout.rightMargin: Tokens.padding.small Layout.rightMargin: Tokens.padding.small
from: 1.0
implicitHeight: Tokens.padding.small * 3 implicitHeight: Tokens.padding.small * 3
insetIcon: "crop" insetIcon: "crop"
to: 5.0 value: cropRectLoader.item ? wrapper.sliderFromZoom(cropRectLoader.item.zoom) : 0
value: cropRectLoader.item ? cropRectLoader.item.zoom : 1.0
onInteraction: value => { onInteraction: value => {
wrapper.zoomClipRect(1 + (value * 4)); wrapper.zoomClipRect(wrapper.zoomFromSlider(value));
} }
onPosChanged: wrapper.changesMade = true onPosChanged: wrapper.changesMade = true