track container fill calculations better

--container fill calculations are now tracked much
better when they are applied.
--as an improvement fill calculations are now taking place
at all edit mode states. So inConfigureApplets mode
the fill(s) applets do not throw out of screen
applets that are the layout edges
pull/15/head
Michail Vourlakos 5 years ago
parent 836cecec41
commit 28ec313bd2

@ -218,8 +218,7 @@ function initializationPhase(availableSpace, sizePerApplet, noOfApplets){
function updateSizeForAppletsInFill() {
if ((!animations.hasThicknessAnimation && !root.inConfigureAppletsMode)
|| (behaveAsPlasmaPanel && root.inConfigureAppletsMode)) {
if (animations.inNormalFillCalculationsState) {
// console.log("-------------");
// console.log("s1...");
var noA = startLayout.fillApplets + mainLayout.fillApplets + endLayout.fillApplets;
@ -229,6 +228,8 @@ function updateSizeForAppletsInFill() {
// console.log("s2...");
if (mainLayout.shownApplets === 0 || root.panelAlignment !== LatteCore.Types.Justify) {
// console.log(" S2 _ SIZES ::: " + root.maxLength + " ___ " + startLayout.sizeWithNoFillApplets + " ___ " + mainLayout.sizeWithNoFillApplets + " ___ " + endLayout.sizeWithNoFillApplets);
var availableSpace = Math.max(0, root.maxLength - startLayout.sizeWithNoFillApplets - mainLayout.sizeWithNoFillApplets - endLayout.sizeWithNoFillApplets - root.panelEdgeSpacing);
var sizePerApplet = availableSpace / noA;
@ -271,6 +272,8 @@ function updateSizeForAppletsInFill() {
} else {
//! Justify mode in all remaining cases
// console.log(" S3 _ SIZES ::: " + root.maxLength + " ___ " + startLayout.sizeWithNoFillApplets + " ___ " + mainLayout.sizeWithNoFillApplets + " ___ " + endLayout.sizeWithNoFillApplets);
//! compute the two free spaces around the centered layout
//! they are called start and end accordingly
var halfMainLayout = mainLayout.sizeWithNoFillApplets / 2;
@ -289,7 +292,6 @@ function updateSizeForAppletsInFill() {
initLayoutForFillsCalculations(mainLayout);
initLayoutForFillsCalculations(endLayout);
//console.log("s3...");
var res;
//! first pass

@ -29,6 +29,12 @@ ContainerAbility.Animations {
property Item metrics: null
property QtObject settings: null
readonly property bool inNormalFillCalculationsState: needBothAxis.count === 0
&& needThickness.count === 0
&& ((needLength.count === 0)
|| (needLength.count===1 && editModeVisual.inEditMode))
//! Public Properties
active: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive
hasThicknessAnimation: (needBothAxis.count>0) || (needThickness.count>0)

@ -73,7 +73,8 @@ Item {
property bool isExpanded: false
property bool isHidden: (applet && applet.status === PlasmaCore.Types.HiddenStatus) || isInternalViewSplitter
property bool isHidden: (applet && applet.status === PlasmaCore.Types.HiddenStatus)
|| (isInternalViewSplitter && !root.inConfigureAppletsMode)
property bool isInternalViewSplitter: (internalSplitterId > 0)
property bool isLattePlasmoid: latteApplet !== null
property bool isZoomed: false

@ -51,12 +51,15 @@ Abilities.AbilityGrid {
property:"sizeWithNoFillApplets"
when: appletsContainer
value: {
if (!visibilityManager || !visibilityManager.normalState && !(root.editMode && !root.inConfigureAppletsMode))
if (!animations.inNormalFillCalculationsState) {
return;
}
var space = 0;
for (var i=0; i<appletsContainer.children.length; ++i){
if (appletsContainer.children[i] && !appletsContainer.children[i].needsFillSpace && !appletsContainer.children[i].isHidden) {
if (appletsContainer.children[i]
&& !appletsContainer.children[i].needsFillSpace
&& !appletsContainer.children[i].isHidden) {
space = root.isHorizontal ? space + appletsContainer.children[i].width : space + appletsContainer.children[i].height;
}
}
@ -69,10 +72,9 @@ Abilities.AbilityGrid {
var res = 0;
for (var i=0; i<children.length; ++i){
if (children[i] && children[i].applet
&& (children[i].applet.status === PlasmaCore.Types.HiddenStatus || children[i].isInternalViewSplitter)) {
if (children[i] && children[i].isHidden) {
//do nothing
} else if (children[i] && children[i].applet){
} else if (children[i] && (children[i].applet || children[i].isInternalViewSplitter)){
res = res + 1;
}
}
@ -157,7 +159,6 @@ Abilities.AbilityGrid {
onShownAppletsChanged: layoutsContainer.updateSizeForAppletsInFill();
onSizeWithNoFillAppletsChanged: layoutsContainer.updateSizeForAppletsInFill();
//////////////////////////BEGIN states
//user set Panel Positions
// 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom

@ -290,6 +290,7 @@ Item{
function updateSizeForAppletsInFill() {
if (!updateSizeForAppletsInFillTimer.running) {
HeuristicTools.updateSizeForAppletsInFill();
updateSizeForAppletsInFillTimer.start();
}
}
@ -299,11 +300,20 @@ Item{
onIconSizeAnimationEnded: delayUpdateMaskArea.start();
}
Connections {
target: animations
onInNormalFillCalculationsStateChanged: {
if (animations.inNormalFillCalculationsState) {
layoutsContainer.updateSizeForAppletsInFill();
}
}
}
//! This timer is needed in order to reduce the calls to heavy cpu function
//! HeuristicTools.updateSizeForAppletsInFill()
Timer{
id: updateSizeForAppletsInFillTimer
interval: 10
interval: 50
onTriggered: HeuristicTools.updateSizeForAppletsInFill();
}

Loading…
Cancel
Save