more improvements for calculations

--various improvements for calculations for panel size,
shadows calculations, configuration window showing
metrics
v0.6
Michail Vourlakos 8 years ago
parent c4fcd9a7d3
commit 25f4de2f5c

@ -102,6 +102,8 @@ void DockConfigView::syncGeometry()
const auto location = m_dockView->containment()->location(); const auto location = m_dockView->containment()->location();
const auto sGeometry = screen()->geometry(); const auto sGeometry = screen()->geometry();
int clearThickness = m_dockView->normalThickness();
switch (m_dockView->containment()->formFactor()) { switch (m_dockView->containment()->formFactor()) {
case Plasma::Types::Horizontal: { case Plasma::Types::Horizontal: {
const QSize size(rootObject()->width(), rootObject()->height()); const QSize size(rootObject()->width(), rootObject()->height());
@ -111,10 +113,10 @@ void DockConfigView::syncGeometry()
if (location == Plasma::Types::TopEdge) { if (location == Plasma::Types::TopEdge) {
setPosition(sGeometry.center().x() - size.width() / 2 setPosition(sGeometry.center().x() - size.width() / 2
, m_dockView->normalThickness()); , clearThickness);
} else if (location == Plasma::Types::BottomEdge) { } else if (location == Plasma::Types::BottomEdge) {
setPosition(sGeometry.center().x() - size.width() / 2 setPosition(sGeometry.center().x() - size.width() / 2
, sGeometry.height() - m_dockView->normalThickness() - size.height()); , sGeometry.height() - clearThickness - size.height());
} }
} }
break; break;
@ -126,10 +128,10 @@ void DockConfigView::syncGeometry()
resize(size); resize(size);
if (location == Plasma::Types::LeftEdge) { if (location == Plasma::Types::LeftEdge) {
setPosition(m_dockView->currentThickness() setPosition(clearThickness
, sGeometry.center().y() - size.height() / 2); , sGeometry.center().y() - size.height() / 2);
} else if (location == Plasma::Types::RightEdge) { } else if (location == Plasma::Types::RightEdge) {
setPosition(sGeometry.width() - m_dockView->currentThickness() - size.width() setPosition(sGeometry.width() - clearThickness - size.width()
, sGeometry.center().y() - size.height() / 2); , sGeometry.center().y() - size.height() / 2);
} }
} }

@ -27,16 +27,16 @@ import org.kde.latte 0.1 as Latte
Image{ Image{
id: editVisual id: editVisual
width: root.isHorizontal ? root.maxLength : visibilityManager.thicknessNormalOriginalValue width: root.isHorizontal ? root.maxLength : visibilityManager.thicknessNormalOriginal
height: root.isVertical ? root.maxLength : visibilityManager.thicknessNormalOriginalValue height: root.isVertical ? root.maxLength : visibilityManager.thicknessNormalOriginal
fillMode: Image.Tile fillMode: Image.Tile
source: "../icons/blueprint.jpg" source: "../icons/blueprint.jpg"
opacity: 0 opacity: 0
property int speed: root.durationTime*4*units.longDuration property int speed: root.durationTime*4*units.longDuration
property int thickness: visibilityManager.thicknessNormalOriginalValue + shadowSize property int thickness: visibilityManager.thicknessNormalOriginal + shadowSize
property int rootThickness: visibilityManager.thicknessZoomOriginal property int rootThickness: visibilityManager.thicknessZoomOriginal + shadowSize
property int shadowSize : Math.ceil(root.iconSize / 5) property int shadowSize : Math.ceil(root.iconSize / 5)
property bool animationSent: false property bool animationSent: false
@ -137,9 +137,9 @@ Image{
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) { } else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
y = 0; y = 0;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) { } else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
y = rootThickness - thickness + shadowSize; y = rootThickness - thickness;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) { } else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
x = rootThickness - thickness + shadowSize; x = rootThickness - thickness;
} }
if (root.isHorizontal) { if (root.isHorizontal) {
@ -190,6 +190,7 @@ Image{
ScriptAction{ ScriptAction{
script:{ script:{
editVisual.opacity = 0 editVisual.opacity = 0
editVisual.editAnimationEnded = false;
initializeNormalPosition(); initializeNormalPosition();
@ -212,7 +213,7 @@ Image{
PropertyAnimation { PropertyAnimation {
target: editVisual target: editVisual
property: root.isHorizontal ? "y" : "x" property: root.isHorizontal ? "y" : "x"
to: editVisual.farEdge ? editVisual.rootThickness - editVisual.thickness + editVisual.shadowSize : 0 to: editVisual.farEdge ? editVisual.rootThickness - editVisual.thickness : 0
duration: editVisual.speed duration: editVisual.speed
easing.type: Easing.OutBounce easing.type: Easing.OutBounce

@ -95,12 +95,12 @@ Item{
opacity: root.useThemePanel ? 1 : 0 opacity: root.useThemePanel ? 1 : 0
visible: (opacity == 0) ? false : true visible: (opacity == 0) ? false : true
property int panelSize: ((plasmoid.location === PlasmaCore.Types.BottomEdge) || property int panelSize: automaticPanelSize + root.shadowsSize
(plasmoid.location === PlasmaCore.Types.TopEdge)) ?
automaticPanelSize + belower.height:
automaticPanelSize + belower.width
property int automaticPanelSize: Math.min(root.themePanelSize, root.iconSize + root.statesLineSize) property int automaticPanelSize: Math.min(root.themePanelSize, root.iconSize + root.iconMargin + root.statesLineSize/2)
property int shadowsSize: shadowsSvgItem && root.useThemePanel ?
(root.isVertical ? shadowsSvgItem.margins.right : shadowsSvgItem.margins.bottom) : 0
Behavior on opacity{ Behavior on opacity{
NumberAnimation { duration: 200 } NumberAnimation { duration: 200 }
@ -109,8 +109,8 @@ Item{
Binding { Binding {
target: root target: root
property: "shadowsSize" property: "shadowsSize"
value: shadowsSvgItem && root.useThemePanel ? when: shadowsSvgItem
(root.isVertical ? shadowsSvgItem.margins.top : shadowsSvgItem.margins.bottom) : 0 value: shadowsSvgItem.shadowsSize
} }
Binding { Binding {

@ -39,25 +39,26 @@ Item{
property bool inStartup: root.inStartup property bool inStartup: root.inStartup
property bool normalState : false // this is being set from updateMaskArea property bool normalState : false // this is being set from updateMaskArea
property bool previoiusNormalState : false // this is only for debugging purposes property bool previousNormalState : false // this is only for debugging purposes
property int animationSpeed: root.durationTime * 1.2 * units.longDuration property int animationSpeed: root.durationTime * 1.2 * units.longDuration
property int length: root.isVertical ? Screen.height : Screen.width //screenGeometry.height : screenGeometry.width property int length: root.isVertical ? Screen.height : Screen.width //screenGeometry.height : screenGeometry.width
//it is used in order to not break the calculations for the thickness placement //it is used in order to not break the calculations for the thickness placement
//especially in automatic icon sizes calculations //especially in automatic icon sizes calculations
property int iconMarginOriginal: 0.12*plasmoid.configuration.iconSize property real iconMarginOriginal: 0.12*plasmoid.configuration.iconSize
property int statesLineSizeOriginal: root.nowDock ? Math.ceil( plasmoid.configuration.iconSize/13 ) : 0 property int statesLineSizeOriginal: root.nowDock ? Math.ceil( plasmoid.configuration.iconSize/13 ) : 0
property int thicknessAutoHidden: 2 property int thicknessAutoHidden: 2
property int thicknessMid: root.statesLineSize + (1 + (0.65 * (root.zoomFactor-1)))*(root.iconSize+root.iconMargin) //needed in some animations property int thicknessMid: root.statesLineSize + (1 + (0.65 * (root.zoomFactor-1)))*(root.iconSize+root.iconMargin) //needed in some animations
property int thicknessNormal: root.statesLineSize + root.iconSize + root.iconMargin + root.shadowsSize + 1 property int thicknessNormal: Math.max(root.statesLineSize + root.iconSize + root.iconMargin + root.shadowsSize + 1, root.realPanelSize)
property int thicknessZoom: root.statesLineSize + ((root.iconSize+root.iconMargin) * root.zoomFactor) + 2 property int thicknessZoom: root.statesLineSize + ((root.iconSize+root.iconMargin) * root.zoomFactor) + 2
//it is used to keep thickness solid e.g. when iconSize changes from auto functions //it is used to keep thickness solid e.g. when iconSize changes from auto functions
property int thicknessMidOriginal: statesLineSizeOriginal + (1 + (0.65 * (root.zoomFactor-1)))*(plasmoid.configuration.iconSize+iconMarginOriginal) //needed in some animations property int thicknessMidOriginal: statesLineSizeOriginal + (1 + (0.65 * (root.zoomFactor-1)))*(plasmoid.configuration.iconSize+iconMarginOriginal) //needed in some animations
property int thicknessNormalOriginal: root.useThemePanel ? Math.max(thicknessNormalOriginalValue, root.realPanelSize) : thicknessNormalOriginalValue property int thicknessNormalOriginal: Math.max(thicknessNormalOriginalValue, root.realPanelSize)
property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + 1 property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + root.shadowsSize + 1
property int thicknessZoomOriginal: statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + 2 property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + root.shadowsSize + 2,
root.realPanelSize+editModeVisual.shadowSize)
Binding{ Binding{
target: dock target: dock
@ -129,9 +130,9 @@ Item{
console.log(root.animationsNeedBothAxis + ", " + root.animationsNeedLength + ", " + console.log(root.animationsNeedBothAxis + ", " + root.animationsNeedLength + ", " +
root.animationsNeedThickness + ", " + dock.visibility.isHidden); root.animationsNeedThickness + ", " + dock.visibility.isHidden);
if (previoiusNormalState !== normalState) { if (previousNormalState !== normalState) {
console.log("normal state changed to:" + normalState); console.log("normal state changed to:" + normalState);
previoiusNormalState = normalState; previousNormalState = normalState;
} }
} }
@ -268,16 +269,18 @@ Item{
//the shadows size must be removed from the maskArea //the shadows size must be removed from the maskArea
//before updating the localDockGeometry //before updating the localDockGeometry
var shadow = root.shadowsSize;
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) { if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
newMaskArea.width = newMaskArea.width - editModeVisual.shadowSize - 1; newMaskArea.width = newMaskArea.width - shadow - 1;
} else { } else {
newMaskArea.height = newMaskArea.height - editModeVisual.shadowSize - 1; newMaskArea.height = newMaskArea.height - shadow - 1;
} }
if (plasmoid.location === PlasmaCore.Types.BottomEdge) { if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
newMaskArea.y = newMaskArea.y + editModeVisual.shadowSize; newMaskArea.y = newMaskArea.y + shadow;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) { } else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
newMaskArea.x = newMaskArea.x + editModeVisual.shadowSize; newMaskArea.x = newMaskArea.x + shadow;
} }
dock.setLocalDockGeometry(newMaskArea); dock.setLocalDockGeometry(newMaskArea);

@ -250,7 +250,7 @@ PlasmaComponents.Page {
value: plasmoid.configuration.panelSize value: plasmoid.configuration.panelSize
minimumValue: 0 minimumValue: 0
maximumValue: plasmoid.configuration.iconSize + units.smallSpacing maximumValue: Number(1.12 * plasmoid.configuration.iconSize).toFixed(0) //0.12*iconSize is the iconMargin
stepSize: 2 stepSize: 2
function updatePanelSize() { function updatePanelSize() {

Loading…
Cancel
Save