mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 17:33:50 +03:00
plenty of fixes when dragging/moving applets
This commit is contained in:
parent
434f3b16e6
commit
321a50627d
@ -31,7 +31,7 @@ Item {
|
||||
property int lastVisibleIndex: -1
|
||||
|
||||
//! do not update during dragging/moving applets inConfigureAppletsMode
|
||||
readonly property bool updateIsBlocked: appletsInParentChange //|| (root.dragOverlay && root.dragOverlay.pressed)
|
||||
readonly property bool updateIsBlocked: appletsInParentChange //|| (root.dragOverlay && root.dragOverlay.pressed)
|
||||
|
||||
Binding{
|
||||
target: appletsContainer
|
||||
|
@ -27,7 +27,7 @@ Item{
|
||||
if (!root.inConfigureAppletsMode) {
|
||||
return 0;
|
||||
} else {
|
||||
return appletItem.inConfigureAppletsDragging && root.dragOverlay.currentApplet.isInternalViewSplitter ?
|
||||
return appletItem.inConfigureAppletsDragging && root.dragOverlay.currentApplet.isInternalViewSplitter && root.dragOverlay.currentApplet === appletItem ?
|
||||
appletMinimumLength : internalSplitterComputedLength;
|
||||
}
|
||||
}
|
||||
|
@ -100,10 +100,8 @@ MouseArea {
|
||||
if(currentApplet){
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
currentApplet.y += (mouse.y - lastY);
|
||||
// handle.y = currentApplet.y;
|
||||
} else {
|
||||
currentApplet.x += (mouse.x - lastX);
|
||||
// handle.x = currentApplet.x;
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,15 +166,8 @@ MouseArea {
|
||||
return;
|
||||
}
|
||||
|
||||
handle.x = relevantLayout.x + currentApplet.x;
|
||||
handle.y = relevantLayout.y + currentApplet.y;
|
||||
handle.width = currentApplet.width;
|
||||
handle.height = currentApplet.height;
|
||||
|
||||
lockButton.checked = currentApplet.lockZoom;
|
||||
colorizingButton.checked = !currentApplet.userBlocksColorizing;
|
||||
|
||||
repositionHandler.restart();
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
@ -192,10 +183,6 @@ MouseArea {
|
||||
|
||||
lastX = mouse.x;
|
||||
lastY = mouse.y;
|
||||
placeHolder.width = root.isVertical ? currentApplet.width : Math.min(root.maxLength / 2, currentApplet.width);
|
||||
placeHolder.height = !root.isVertical? currentApplet.height : Math.min(root.maxLength / 2, currentApplet.height);
|
||||
handle.width = placeHolder.width;
|
||||
handle.height = placeHolder.height;
|
||||
fastLayoutManager.insertBefore(currentApplet, placeHolder);
|
||||
currentApplet.parent = root;
|
||||
currentApplet.x = root.isHorizontal ? lastX - currentApplet.width/2 : lastX-appletX;
|
||||
@ -229,11 +216,6 @@ MouseArea {
|
||||
|
||||
var relevantLayout = mapFromItem(layoutsContainer.mainLayout, 0, 0);
|
||||
|
||||
handle.x = relevantLayout.x + currentApplet.x;
|
||||
handle.y = relevantLayout.y + currentApplet.y;
|
||||
// handle.width = currentApplet.width;
|
||||
// handle.height = currentApplet.height;
|
||||
|
||||
if (root.myView.alignment === LatteCore.Types.Justify) {
|
||||
fastLayoutManager.moveAppletsBasedOnJustifyAlignment();
|
||||
}
|
||||
@ -273,20 +255,13 @@ MouseArea {
|
||||
Item {
|
||||
id: placeHolder
|
||||
visible: configurationArea.pressed
|
||||
width: currentApplet !== null ? (root.isVertical ? currentApplet.width : Math.min(root.maxLength / 2, currentApplet.width)) : 0
|
||||
height: currentApplet !== null ? (!root.isVertical ? currentApplet.height : Math.min(root.maxLength / 2, currentApplet.height)) : 0
|
||||
|
||||
readonly property bool isPlaceHolder: true
|
||||
readonly property int length: root.isVertical ? height : width
|
||||
}
|
||||
|
||||
//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
|
||||
Timer {
|
||||
id: repositionHandler
|
||||
interval: 100
|
||||
onTriggered: handle.updatePlacement();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: animations.duration.large * 2
|
||||
@ -298,16 +273,10 @@ MouseArea {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: currentApplet
|
||||
onXChanged: handle.updatePlacement();
|
||||
onYChanged: handle.updatePlacement();
|
||||
onWidthChanged: handle.updatePlacement();
|
||||
onHeightChanged: handle.updatePlacement()
|
||||
}
|
||||
|
||||
Item {
|
||||
id: handle
|
||||
parent: currentApplet ? currentApplet : configurationArea
|
||||
anchors.fill: parent
|
||||
visible: currentApplet && (configurationArea.containsMouse || tooltipMouseArea.containsMouse)
|
||||
|
||||
Loader {
|
||||
@ -321,25 +290,6 @@ MouseArea {
|
||||
}
|
||||
|
||||
//BEGIN functions
|
||||
function updatePlacement(){
|
||||
if(currentApplet){
|
||||
var transformChoords = configurationArea.mapFromItem(currentApplet, 0, 0)
|
||||
|
||||
if (handle.x !== transformChoords.x
|
||||
|| handle.y !== transformChoords.y
|
||||
|| handle.width !== currentApplet.width
|
||||
|| handle.height !== currentApplet.height) {
|
||||
|
||||
handle.x = transformChoords.x;
|
||||
handle.y = transformChoords.y;
|
||||
handle.width = currentApplet.width;
|
||||
handle.height = currentApplet.height;
|
||||
|
||||
repositionHandler.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//END functions
|
||||
|
||||
Item {
|
||||
@ -358,7 +308,7 @@ MouseArea {
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
source: "transform-move"
|
||||
width: Math.min(144, parent.width, parent.height)
|
||||
width: Math.min(144, root.metrics.iconSize)
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
opacity: 0.9
|
||||
|
Loading…
Reference in New Issue
Block a user