accept only odd numbers for iconSize and zoom

work/spdx
Michail Vourlakos 4 years ago
parent e7bd122fab
commit 95f86bed8f

@ -31,7 +31,8 @@ Ability.ParabolicEffectPrivate {
factor.zoom: {
var storedZoom = LatteCore.WindowSystem.compositingActive && animations.active ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1;
var maxSize = storedZoom * metrics.iconSize;
maxSize = Math.round(maxSize);
//! round to nearest odd number
maxSize = 2 * Math.round(Math.round(maxSize) / 2);
//! this way we make sure that the iconSize at the maximum of its parabolic effect is an integer
return (maxSize/metrics.iconSize);

@ -35,14 +35,22 @@ AbilityHost.Metrics {
//! private properties to avoid too many not needed animation calculations
readonly property int _iconSize: autosizeEnabled && autosize.iconSize > 0 ? Math.min(autosize.iconSize, maxIconSize) : maxIconSize
readonly property int _maxIconSize: portionIconSize!==-1 ? portionIconSize : plasmoid.configuration.iconSize
readonly property int _maxIconSize: {
//! round to nearest odd number
var storedIconSize = 2 * Math.round(plasmoid.configuration.iconSize / 2)
return portionIconSize!==-1 ? portionIconSize : storedIconSize;
}
//! Private Properties
readonly property int portionIconSize: { //icon size based on screen height
if ((plasmoid.configuration.proportionIconSize===-1) || !latteView)
return -1;
return Math.max(16,Math.round(latteView.screenGeometry.height * plasmoid.configuration.proportionIconSize/100));
var basedOnScreenHeight = Math.max(16,Math.round(latteView.screenGeometry.height * plasmoid.configuration.proportionIconSize/100))
//! round to nearest odd number
return 2 * Math.round(basedOnScreenHeight/2);
}
readonly property bool autosizeEnabled: autosize !== undefined && autosize.isActive

@ -84,16 +84,17 @@ PlasmaComponents.Page {
LatteComponents.Slider {
id: appletsSizeSlider
Layout.fillWidth: true
value: plasmoid.configuration.iconSize
//!round to nearest odd number
value: 2 * Math.round(plasmoid.configuration.iconSize / 2)
from: 16
to: 512
stepSize: dialog.advancedLevel || (plasmoid.configuration.iconSize % 8 !== 0) || dialog.viewIsPanel ? 1 : 8
stepSize: dialog.advancedLevel || (plasmoid.configuration.iconSize % 8 !== 0) || dialog.viewIsPanel ? 2 : 8
wheelEnabled: false
function updateIconSize() {
if (!pressed) {
plasmoid.configuration.iconSize = value
syncGeometry.restart()
plasmoid.configuration.iconSize = value;
syncGeometry.restart();
}
}

Loading…
Cancel
Save