mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
plenty of fixes for moving/dragging applets
This commit is contained in:
parent
8959e58148
commit
6a6e47c657
@ -674,7 +674,7 @@ void ContainmentInterface::moveAppletsInJustifyAlignment(QQuickItem *start, QQui
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<appletlist.count()-2; ++i) {
|
||||
for(int i=0; i<appletlist.count()-1; ++i) {
|
||||
QQuickItem *before = appletlist[i];
|
||||
QQuickItem *after = appletlist[i+1];
|
||||
|
||||
@ -682,6 +682,24 @@ void ContainmentInterface::moveAppletsInJustifyAlignment(QQuickItem *start, QQui
|
||||
before->stackBefore(after);
|
||||
}
|
||||
}
|
||||
|
||||
//! Confirm Last item of End Layout
|
||||
if (end->childItems().count() > 0) {
|
||||
QQuickItem *lastItem = end->childItems()[end->childItems().count()-1];
|
||||
|
||||
int correctpos{-1};
|
||||
|
||||
for(int i=0; i<appletlist.count()-1; ++i) {
|
||||
if (lastItem == appletlist[i]) {
|
||||
correctpos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (correctpos>=0) {
|
||||
lastItem->stackBefore(appletlist[correctpos+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ Item {
|
||||
var prefSize = curApplet.appletPreferredLength;
|
||||
var maxSize = curApplet.appletMaximumLength;
|
||||
|
||||
console.log( "org.kde.latte s3_0 " + curApplet.applet.pluginName + " : (" +minSize+","+prefSize+","+maxSize+") ");
|
||||
//console.log( "s3_0 " + curApplet.applet.pluginName + " : (" +minSize+","+prefSize+","+maxSize+") ");
|
||||
|
||||
minSize = minSize>=0 && minSize!==Infinity ? minSize : -1;
|
||||
prefSize = minSize>=0 && prefSize!==Infinity ? prefSize : -1;
|
||||
|
@ -58,6 +58,10 @@ Item {
|
||||
//! Fill Applet(s)
|
||||
property bool inFillCalculations: false //temp record, is used in calculations for fillWidth,fillHeight applets
|
||||
property bool isAutoFillApplet: {
|
||||
if (isInternalViewSplitter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!applet || !applet.Layout)
|
||||
return false;
|
||||
|
||||
@ -71,6 +75,18 @@ 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:(parent === layoutsContainer.startLayout
|
||||
&& appletItem.layouter.startLayout.fillApplets === 1
|
||||
&& (appletItem.layouter.mainLayout.shownApplets>=1
|
||||
|| appletItem.layouter.endLayout.fillApplet ===0))
|
||||
|| (parent === layoutsContainer.endLayout
|
||||
&& appletItem.layouter.endLayout.fillApplets === 1
|
||||
&& (appletItem.layouter.mainLayout.shownApplets>=1))
|
||||
|
||||
readonly property bool inConfigureAppletsDragging: root.dragOverlay
|
||||
&& root.dragOverlay.currentApplet
|
||||
&& root.dragOverlay.pressed
|
||||
|
||||
property bool userBlocksColorizing: false
|
||||
property bool appletBlocksColorizing: !communicator.requires.latteSideColoringEnabled
|
||||
property bool appletBlocksParabolicEffect: communicator.requires.parabolicEffectLocked
|
||||
@ -277,8 +293,6 @@ Item {
|
||||
property real computeHeight: root.isVertical ? hiddenSpacerLeft.height + wrapper.height + hiddenSpacerRight.height :
|
||||
wrapper.height
|
||||
|
||||
property string title: isInternalViewSplitter ? "Now Dock Splitter" : ""
|
||||
|
||||
property Item applet: null
|
||||
property Item latteApplet: applet && (applet.pluginName === root.plasmoidName) ?
|
||||
(applet.children[0] ? applet.children[0] : null) : null
|
||||
|
@ -36,8 +36,12 @@ Item{
|
||||
height: root.isHorizontal ? thickness : length
|
||||
|
||||
readonly property int length: {
|
||||
if (appletItem.isInternalViewSplitter && !root.inConfigureAppletsMode) {
|
||||
return 0;
|
||||
if (appletItem.isInternalViewSplitter) {
|
||||
if (!root.inConfigureAppletsMode) {
|
||||
return 0;
|
||||
} else if (appletItem.inConfigureAppletsDragging){
|
||||
return appletMinimumLength + (lengthAppletPadding + metrics.margin.length)*2 ;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSeparator && appletItem.parabolic.isEnabled) {
|
||||
@ -84,11 +88,33 @@ Item{
|
||||
|
||||
readonly property int appletLength: root.isHorizontal ? appletWidth : appletHeight
|
||||
readonly property int appletThickness: root.isHorizontal ? appletHeight : appletWidth
|
||||
readonly property int appletMinimumLength : root.isHorizontal ? appletMinimumWidth : appletMinimumHeight
|
||||
|
||||
readonly property int appletMinimumLength : {
|
||||
if (isInternalViewSplitter) {
|
||||
return Math.min(root.maxJustifySplitterSize, appletItem.metrics.iconSize);
|
||||
}
|
||||
|
||||
return root.isHorizontal ? appletMinimumWidth : appletMinimumHeight
|
||||
}
|
||||
readonly property int appletMinimumThickness: root.isHorizontal ? appletMinimumHeight : appletMinimumWidth
|
||||
readonly property int appletPreferredLength: root.isHorizontal ? appletPreferredWidth : appletPreferredHeight
|
||||
readonly property int appletPreferredLength: {
|
||||
if (isInternalViewSplitter) {
|
||||
/*var isDragged = (root.dragOverlay
|
||||
&& root.dragOverlay.currentApplet
|
||||
&& root.dragOverlay.pressed);*/
|
||||
return appletItem.isFillSplitter ? Infinity : -1;
|
||||
}
|
||||
return root.isHorizontal ? appletPreferredWidth : appletPreferredHeight;
|
||||
}
|
||||
|
||||
readonly property int appletPreferredThickness: root.isHorizontal ? appletPreferredHeight : appletPreferredWidth
|
||||
readonly property int appletMaximumLength: root.isHorizontal ? appletMaximumWidth : appletMaximumHeight
|
||||
readonly property int appletMaximumLength: {
|
||||
if (isInternalViewSplitter) {
|
||||
return Infinity;
|
||||
}
|
||||
|
||||
root.isHorizontal ? appletMaximumWidth : appletMaximumHeight;
|
||||
}
|
||||
readonly property int appletMaximumThickness: root.isHorizontal ? appletMaximumHeight : appletMaximumWidth
|
||||
|
||||
property int iconSize: appletItem.metrics.iconSize
|
||||
@ -232,9 +258,7 @@ Item{
|
||||
property: "layoutLength"
|
||||
when: latteView && !appletItem.isAutoFillApplet && (wrapper.zoomScale === 1)
|
||||
value: {
|
||||
if (appletItem.isInternalViewSplitter){
|
||||
return !root.inConfigureAppletsMode ? 0 : Math.min(appletItem.metrics.iconSize, root.maxJustifySplitterSize);
|
||||
} else if (applet && ( appletMaximumLength < appletItem.metrics.iconSize
|
||||
if (applet && ( appletMaximumLength < appletItem.metrics.iconSize
|
||||
|| appletPreferredLength > appletItem.metrics.iconSize
|
||||
|| appletItem.originalAppletBehavior)) {
|
||||
|
||||
@ -498,10 +522,12 @@ Item{
|
||||
anchors.fill: _wrapperContainer
|
||||
active: appletItem.isInternalViewSplitter && root.inConfigureAppletsMode
|
||||
|
||||
sourceComponent: Item {
|
||||
sourceComponent: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "purple"
|
||||
opacity: 0.4
|
||||
|
||||
PlasmaCore.SvgItem{
|
||||
/*PlasmaCore.SvgItem{
|
||||
id:splitterImage
|
||||
anchors.centerIn: parent
|
||||
width: Math.min(root.maxJustifySplitterSize, appletItem.metrics.iconSize)
|
||||
@ -521,7 +547,7 @@ Item{
|
||||
|
||||
verticalOffset: 2
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,9 +118,11 @@ MouseArea {
|
||||
|
||||
onPositionChanged: {
|
||||
if (pressed) {
|
||||
var padding = units.gridUnit * 3;
|
||||
//! is this really needed ????
|
||||
/*var padding = units.gridUnit * 3;
|
||||
if (currentApplet && (mouse.x < -padding || mouse.y < -padding ||
|
||||
mouse.x > width + padding || mouse.y > height + padding)) {
|
||||
|
||||
var newCont = plasmoid.containmentAt(mouse.x, mouse.y);
|
||||
|
||||
if (newCont && newCont != plasmoid) {
|
||||
@ -129,7 +131,7 @@ MouseArea {
|
||||
root.dragOverlay.currentApplet = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if(currentApplet){
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
@ -234,8 +236,8 @@ MouseArea {
|
||||
handle.height = currentApplet.height;
|
||||
root.layoutManagerInsertBefore(currentApplet, placeHolder);
|
||||
currentApplet.parent = root;
|
||||
currentApplet.x = lastX-appletX;
|
||||
currentApplet.y = lastY-appletY;
|
||||
currentApplet.x = root.isHorizontal ? lastX - currentApplet.width/2 : lastX-appletX;
|
||||
currentApplet.y = root.isVertical ? lastY - currentApplet.height/2 : lastY-appletY;
|
||||
currentApplet.z = 900;
|
||||
}
|
||||
|
||||
@ -292,6 +294,21 @@ MouseArea {
|
||||
currentApplet.latteStyleApplet.decreaseLength();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: currentApplet
|
||||
onWidthChanged: {
|
||||
if (configurationArea.pressed && root.isHorizontal) {
|
||||
currentApplet.x = configurationArea.lastX - currentApplet.width/2;
|
||||
}
|
||||
}
|
||||
|
||||
onHeightChanged: {
|
||||
if (configurationArea.pressed && root.isVertical) {
|
||||
currentApplet.y = configurationArea.lastY - currentApplet.height/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: placeHolder
|
||||
visible: configurationArea.pressed
|
||||
@ -301,6 +318,20 @@ MouseArea {
|
||||
readonly property bool isPlaceHolder: true
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: placeHolder
|
||||
property: "width"
|
||||
when: currentApplet
|
||||
value: currentApplet ? currentApplet.width : 0
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: placeHolder
|
||||
property: "width"
|
||||
when: currentApplet
|
||||
value: currentApplet ? currentApplet.height : 0
|
||||
}
|
||||
|
||||
//Because of the animations for the applets the handler can not catch up to
|
||||
//reposition itself when the currentApplet position or size changes.
|
||||
//This timer fixes that situation
|
||||
|
@ -281,10 +281,6 @@ Item{
|
||||
z:10 //be on top of start and end layouts
|
||||
beginIndex: 100
|
||||
offset: {
|
||||
if (inJustifyCenterOffset!==0) {
|
||||
return inJustifyCenterOffset;
|
||||
}
|
||||
|
||||
if (!centered) {
|
||||
//! it is used for Top/Bottom/Left/Right alignments when they show both background length shadows
|
||||
return background.offset + backgroundTailLength;
|
||||
@ -299,7 +295,6 @@ Item{
|
||||
//! do not update during dragging/moving applets inConfigureAppletsMode
|
||||
readonly property bool offsetUpdateIsBlocked: ((root.dragOverlay && root.dragOverlay.pressed) || layouter.appletsInParentChange)
|
||||
property bool isCoveredFromBothSideLayouts: false
|
||||
property int inJustifyCenterOffset: 0
|
||||
|
||||
alignment: {
|
||||
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
||||
@ -368,39 +363,6 @@ Item{
|
||||
return (startLayout.length + endLayout.length) > (root.maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: _mainLayout
|
||||
property:"inJustifyCenterOffset"
|
||||
when: !_mainLayout.offsetUpdateIsBlocked && layouter.inNormalFillCalculationsState
|
||||
value: {
|
||||
if (root.panelAlignment !== LatteCore.Types.Justify) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var layoutMaxLength = root.maxLength / 2;
|
||||
var sideLayoutMaxLength = layoutMaxLength - mainLayout.length/2;
|
||||
|
||||
if (_mainLayout.isCoveredFromBothSideLayouts && root.inConfigureAppletsMode) {
|
||||
return sideLayoutMaxLength;
|
||||
}
|
||||
|
||||
if (startLayout.length > sideLayoutMaxLength) {
|
||||
return (startLayout.length - sideLayoutMaxLength);
|
||||
} else if (endLayout.length > sideLayoutMaxLength) {
|
||||
return -(endLayout.length - sideLayoutMaxLength);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on inJustifyCenterOffset {
|
||||
NumberAnimation {
|
||||
duration: 0.8 * animations.duration.proposed
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AppletsContainer {
|
||||
@ -481,7 +443,7 @@ Item{
|
||||
readonly property int layoutLength: root.isHorizontal ? debugLayout.grid.width : debugLayout.grid.height
|
||||
|
||||
readonly property string tagText: {
|
||||
return "normal:" + debugLayout.shownApplets + " / fill:" + debugLayout.fillApplets + " / reg_len:" + debugLayout.sizeWithNoFillApplets + " / tot_len:"+layoutLength + " / off:" + _mainLayout.inJustifyCenterOffset;
|
||||
return "normal:" + debugLayout.shownApplets + " / fill:" + debugLayout.fillApplets + " / reg_len:" + debugLayout.sizeWithNoFillApplets + " / tot_len:"+layoutLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user