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
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:
@@ -13,13 +13,23 @@ import qs.Services
|
||||
Item {
|
||||
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 bool changesMade: false
|
||||
readonly property var currentScreen: screens.length > selectedScreenIndex ? screens[selectedScreenIndex] : null
|
||||
property var screens: []
|
||||
property int selectedScreenIndex: 0
|
||||
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 {
|
||||
if (!cropRectLoader.item || !currentScreen)
|
||||
return;
|
||||
@@ -144,14 +154,12 @@ Item {
|
||||
Layout.leftMargin: Tokens.padding.small
|
||||
Layout.preferredHeight: Tokens.padding.medium * 3
|
||||
Layout.rightMargin: Tokens.padding.small
|
||||
from: 1.0
|
||||
implicitHeight: Tokens.padding.small * 3
|
||||
insetIcon: "crop"
|
||||
to: 5.0
|
||||
value: cropRectLoader.item ? cropRectLoader.item.zoom : 1.0
|
||||
value: cropRectLoader.item ? wrapper.sliderFromZoom(cropRectLoader.item.zoom) : 0
|
||||
|
||||
onInteraction: value => {
|
||||
wrapper.zoomClipRect(1 + (value * 4));
|
||||
wrapper.zoomClipRect(wrapper.zoomFromSlider(value));
|
||||
}
|
||||
|
||||
onPosChanged: wrapper.changesMade = true
|
||||
|
||||
Reference in New Issue
Block a user