more improvements for calculations

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

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

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

@ -95,12 +95,12 @@ Item{
opacity: root.useThemePanel ? 1 : 0
visible: (opacity == 0) ? false : true
property int panelSize: ((plasmoid.location === PlasmaCore.Types.BottomEdge) ||
(plasmoid.location === PlasmaCore.Types.TopEdge)) ?
automaticPanelSize + belower.height:
automaticPanelSize + belower.width
property int panelSize: automaticPanelSize + root.shadowsSize
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{
NumberAnimation { duration: 200 }
@ -109,8 +109,8 @@ Item{
Binding {
target: root
property: "shadowsSize"
value: shadowsSvgItem && root.useThemePanel ?
(root.isVertical ? shadowsSvgItem.margins.top : shadowsSvgItem.margins.bottom) : 0
when: shadowsSvgItem
value: shadowsSvgItem.shadowsSize
}
Binding {

@ -39,25 +39,26 @@ Item{
property bool inStartup: root.inStartup
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 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
//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 thicknessAutoHidden: 2
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
//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 thicknessNormalOriginal: root.useThemePanel ? Math.max(thicknessNormalOriginalValue, root.realPanelSize) : thicknessNormalOriginalValue
property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + 1
property int thicknessZoomOriginal: statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + 2
property int thicknessNormalOriginal: Math.max(thicknessNormalOriginalValue, root.realPanelSize)
property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + root.shadowsSize + 1
property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + root.shadowsSize + 2,
root.realPanelSize+editModeVisual.shadowSize)
Binding{
target: dock
@ -129,9 +130,9 @@ Item{
console.log(root.animationsNeedBothAxis + ", " + root.animationsNeedLength + ", " +
root.animationsNeedThickness + ", " + dock.visibility.isHidden);
if (previoiusNormalState !== normalState) {
if (previousNormalState !== 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
//before updating the localDockGeometry
var shadow = root.shadowsSize;
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
newMaskArea.width = newMaskArea.width - editModeVisual.shadowSize - 1;
newMaskArea.width = newMaskArea.width - shadow - 1;
} else {
newMaskArea.height = newMaskArea.height - editModeVisual.shadowSize - 1;
newMaskArea.height = newMaskArea.height - shadow - 1;
}
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
newMaskArea.y = newMaskArea.y + editModeVisual.shadowSize;
newMaskArea.y = newMaskArea.y + shadow;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
newMaskArea.x = newMaskArea.x + editModeVisual.shadowSize;
newMaskArea.x = newMaskArea.x + shadow;
}
dock.setLocalDockGeometry(newMaskArea);

@ -250,7 +250,7 @@ PlasmaComponents.Page {
value: plasmoid.configuration.panelSize
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
function updatePanelSize() {

Loading…
Cancel
Save