fix issues with new maxLength

v0.6
Michail Vourlakos 8 years ago
parent d227b854f7
commit 29ac7ce331

@ -23,6 +23,8 @@ import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import QtGraphicalEffects 1.0
import org.kde.latte 0.1 as Latte
Image{
id: editVisual
width: root.isHorizontal ? root.maxLength : visibilityManager.thicknessNormalOriginalValue
@ -67,6 +69,7 @@ Image{
Connections{
target: root
onIconSizeChanged: initializeEditPosition();
onPanelAlignmentChanged: initializeEditPosition();
}
onRootThicknessChanged: {
@ -95,34 +98,70 @@ Image{
function initializeNormalPosition() {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
x = root.width/2 - root.maxLength/2;
y = rootThickness;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
x = rootThickness;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
x = -editVisual.thickness;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
x = root.width/2 - root.maxLength/2;
y = -editVisual.thickness;
}
if (root.isHorizontal) {
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
x = root.width/2 - root.maxLength/2;
} else if (root.panelAlignment === Latte.Dock.Left) {
x = 0;
} else if (root.panelAlignment === Latte.Dock.Center) {
x = root.width/2 - root.maxLength/2;
} else if (root.panelAlignment === Latte.Dock.Right) {
x = root.width - root.maxLength;
}
} else if (root.isVertical) {
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
y = root.height/2 - root.maxLength/2;
} else if (root.panelAlignment === Latte.Dock.Top) {
y = 0;
} else if (root.panelAlignment === Latte.Dock.Center) {
y = root.height/2 - root.maxLength/2;
} else if (root.panelAlignment === Latte.Dock.Bottom) {
y = root.height - root.maxLength;
}
}
}
function initializeEditPosition() {
if (root.editMode) {
if (plasmoid.location === PlasmaCore.Types.LeftEdge){
x = 0;
y = root.height/2 - editVisual.height/2;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
x = root.width/2 - editVisual.width/2;
y = 0;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
x = root.width/2 - editVisual.width/2;
y = rootThickness - thickness + shadowSize;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
x = rootThickness - thickness + shadowSize;
}
if (root.isHorizontal) {
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
x = root.width/2 - editVisual.width/2;
} else if (root.panelAlignment === Latte.Dock.Left) {
x = 0;
} else if (root.panelAlignment === Latte.Dock.Center) {
x = root.width/2 - editVisual.width/2;
} else if (root.panelAlignment === Latte.Dock.Right) {
x = root.width - editVisual.width;
}
} else if (root.isVertical) {
if (plasmoid.configuration.panelPosition === Latte.Dock.Justify) {
y = root.height/2 - editVisual.height/2;
} else if (root.panelAlignment === Latte.Dock.Top) {
y = 0;
} else if (root.panelAlignment === Latte.Dock.Center) {
y = root.height/2 - editVisual.height/2;
} else if (root.panelAlignment === Latte.Dock.Bottom) {
y = root.height - editVisual.height;
}
}
}
}

@ -37,9 +37,9 @@ Item{
// parent: root
z:0
property int panelWidth: secondLayout.count > 0 && root.isHorizontal && !root.editMode ?
property int panelWidth: (root.panelAlignment === Latte.Dock.Justify) && root.isHorizontal && !root.editMode ?
layoutsContainer.width + 2*spacing : mainLayout.width + spacing
property int panelHeight: secondLayout.count > 0 && root.isVertical && !root.editMode ?
property int panelHeight: (root.panelAlignment === Latte.Dock.Justify) && root.isVertical && !root.editMode ?
layoutsContainer.height + 2*spacing : mainLayout.height + spacing
width: root.isHorizontal ? panelWidth : smallSize

@ -49,7 +49,7 @@ DragDrop.DropArea {
property bool editMode: plasmoid.userConfiguring
property bool immutable: plasmoid.immutable
property bool inStartup: true
property bool isHorizontal: plasmoid.formFactor == PlasmaCore.Types.Horizontal
property bool isHorizontal: plasmoid.formFactor === PlasmaCore.Types.Horizontal
property bool isVertical: !isHorizontal
property bool isHovered: nowDock ? ((nowDockHoveredIndex !== -1) && (layoutsContainer.hoveredIndex !== -1)) //|| wholeArea.containsMouse
: (layoutsContainer.hoveredIndex !== -1) //|| wholeArea.containsMouse

Loading…
Cancel
Save