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

@ -29,6 +29,12 @@ ContainerAbility.Animations {
property Item metrics: null property Item metrics: null
property QtObject settings: 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 //! Public Properties
active: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive active: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive
hasThicknessAnimation: (needBothAxis.count>0) || (needThickness.count>0) hasThicknessAnimation: (needBothAxis.count>0) || (needThickness.count>0)

@ -73,7 +73,8 @@ Item {
property bool isExpanded: false 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 isInternalViewSplitter: (internalSplitterId > 0)
property bool isLattePlasmoid: latteApplet !== null property bool isLattePlasmoid: latteApplet !== null
property bool isZoomed: false property bool isZoomed: false

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

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

Loading…
Cancel
Save