mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
improve internal splitters length computations
This commit is contained in:
parent
69df6400f2
commit
33d08c92a0
@ -34,9 +34,12 @@ Item {
|
||||
property int fillApplets: 0
|
||||
property int fillRealApplets: 0 //with no internal separators counted
|
||||
|
||||
property int lengthWithoutSplitters: 0 //with no internal separators length
|
||||
|
||||
//it is used in calculations for fillWidth,fillHeight applets
|
||||
property int sizeWithNoFillApplets: 0
|
||||
|
||||
|
||||
readonly property int maxIndex: 99999
|
||||
property int firstVisibleIndex: -1
|
||||
property int lastVisibleIndex: -1
|
||||
@ -54,6 +57,29 @@ Item {
|
||||
if (grid.children[i]
|
||||
&& !grid.children[i].isAutoFillApplet
|
||||
&& !grid.children[i].isHidden) {
|
||||
|
||||
if (grid.children[i].isInternalViewSplitter) {
|
||||
space += root.maxJustifySplitterSize;
|
||||
} else {
|
||||
space = root.isHorizontal ? space + grid.children[i].width : space + grid.children[i].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return space;
|
||||
}
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: appletsContainer
|
||||
property:"lengthWithoutSplitters"
|
||||
when: appletsContainer && grid && !updateIsBlocked && inNormalFillCalculationsState
|
||||
value: {
|
||||
var space = 0;
|
||||
for (var i=0; i<grid.children.length; ++i){
|
||||
if (grid.children[i]
|
||||
&& !grid.children[i].isInternalViewSplitter
|
||||
&& !grid.children[i].isHidden) {
|
||||
space = root.isHorizontal ? space + grid.children[i].width : space + grid.children[i].height;
|
||||
}
|
||||
}
|
||||
|
@ -59,13 +59,7 @@ Item {
|
||||
|
||||
//! Fill Applet(s)
|
||||
property bool inFillCalculations: false //temp record, is used in calculations for fillWidth,fillHeight applets
|
||||
property bool isAutoFillApplet: {
|
||||
if (isInternalViewSplitter) {
|
||||
return isFillSplitter;
|
||||
}
|
||||
|
||||
return isRequestingFill;
|
||||
}
|
||||
property bool isAutoFillApplet: isRequestingFill
|
||||
|
||||
property bool isRequestingFill: {
|
||||
if (!applet || !applet.Layout)
|
||||
@ -83,19 +77,6 @@ Item {
|
||||
property int maxAutoFillLength: -1 //it is used in calculations for fillWidth,fillHeight applets
|
||||
property int minAutoFillLength: -1 //it is used in calculations for fillWidth,fillHeight applets
|
||||
|
||||
readonly property int isFillSplitter: isInternalViewSplitter
|
||||
&& ((parent === layoutsContainer.startLayout
|
||||
&& appletItem.layouter.startLayout.fillRealApplets === 0
|
||||
&& (appletItem.layouter.mainLayout.shownApplets>=1 /*main layout has applet in it*/
|
||||
|| (appletItem.layouter.mainLayout.shownApplets===0 /*main layout is empty*/
|
||||
&& appletItem.layouter.endLayout.fillRealApplets === 0)))
|
||||
|| (parent === layoutsContainer.endLayout
|
||||
&& appletItem.layouter.endLayout.fillRealApplets === 0
|
||||
&& (appletItem.layouter.mainLayout.shownApplets>=1 /*main layout has applet in it*/
|
||||
|| (appletItem.layouter.mainLayout.shownApplets===0 /*main layout is empty*/
|
||||
&& appletItem.layouter.startLayout.fillRealApplets === 0))))
|
||||
|
||||
|
||||
readonly property bool inConfigureAppletsDragging: root.dragOverlay
|
||||
&& root.dragOverlay.currentApplet
|
||||
&& root.dragOverlay.pressed
|
||||
|
@ -40,8 +40,8 @@ Item{
|
||||
if (appletItem.isInternalViewSplitter) {
|
||||
if (!root.inConfigureAppletsMode) {
|
||||
return 0;
|
||||
} else if (appletItem.inConfigureAppletsDragging || !appletItem.isFillSplitter){
|
||||
return appletMinimumLength; // /* /*(lengthAppletPadding + metrics.margin.length)*2*/
|
||||
} else {
|
||||
return appletItem.inConfigureAppletsDragging ? appletMinimumLength : internalSplitterComputedLength;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,14 +104,14 @@ Item{
|
||||
|
||||
readonly property int appletPreferredLength: {
|
||||
if (isInternalViewSplitter) {
|
||||
return appletItem.isFillSplitter ? Infinity : appletMinimumLength;
|
||||
return appletMinimumLength;
|
||||
}
|
||||
return root.isHorizontal ? appletPreferredWidth : appletPreferredHeight;
|
||||
}
|
||||
|
||||
readonly property int appletMaximumLength: {
|
||||
if (isInternalViewSplitter) {
|
||||
return isFillSplitter ? (root.isHorizontal ? root.width : root.height) : appletMinimumLength;
|
||||
return Infinity;
|
||||
}
|
||||
|
||||
root.isHorizontal ? appletMaximumWidth : appletMaximumHeight;
|
||||
@ -152,6 +152,31 @@ Item{
|
||||
property Item containerForOverlayIcon: _containerForOverlayIcon
|
||||
property Item overlayIconLoader: _overlayIconLoader
|
||||
|
||||
readonly property int internalSplitterComputedLength: {
|
||||
if (!appletItem.isInternalViewSplitter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var parentLayoutLength = 0;
|
||||
var parentTwinLayoutLength = 0;
|
||||
|
||||
if (appletItem.parent === layoutsContainer.startLayout) {
|
||||
parentLayoutLength = appletItem.layouter.startLayout.lengthWithoutSplitters;
|
||||
parentTwinLayoutLength = appletItem.layouter.endLayout.lengthWithoutSplitters;
|
||||
} else if (appletItem.parent === layoutsContainer.endLayout) {
|
||||
parentLayoutLength = appletItem.layouter.endLayout.lengthWithoutSplitters;
|
||||
parentTwinLayoutLength = appletItem.layouter.startLayout.lengthWithoutSplitters;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var parentLayoutCenter = (appletItem.layouter.maxLength - layoutsContainer.mainLayout.length)/2;
|
||||
var twinLayoutExceededCenter = Math.max(0, (parentTwinLayoutLength + root.maxJustifySplitterSize) - parentLayoutCenter);
|
||||
var availableLength = Math.max(0, parentLayoutCenter - twinLayoutExceededCenter);
|
||||
|
||||
return Math.max(root.maxJustifySplitterSize, availableLength - parentLayoutLength);
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 0.8 * appletItem.animations.duration.proposed
|
||||
|
Loading…
x
Reference in New Issue
Block a user