From 3f66f0904535783c63ce381f5bb3ab0cec912d18 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 21 Apr 2019 15:38:04 +0300 Subject: [PATCH] bound published tasks geometries at scrollarea --- .../package/contents/ui/task/TaskItem.qml | 43 ++++++++++++++++++- .../ui/taskslayout/ScrollableList.qml | 3 ++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/plasmoid/package/contents/ui/task/TaskItem.qml b/plasmoid/package/contents/ui/task/TaskItem.qml index 6a58629e9..5465916ba 100644 --- a/plasmoid/package/contents/ui/task/TaskItem.qml +++ b/plasmoid/package/contents/ui/task/TaskItem.qml @@ -1192,18 +1192,48 @@ MouseArea{ || (latteView && currentLayout && latteView.universalLayoutManager && currentLayout.name === latteView.universalLayoutManager.currentLayoutName))) { var globalChoords = backend.globalRect(taskItem); + var limits = backend.globalRect(scrollableList); + + //! Limit the published geometries boundaries at scrolling area boundaries + var adjX = Math.min(limits.x+limits.width, Math.max(limits.x, globalChoords.x)); + var adjY = Math.min(limits.y+limits.height, Math.max(limits.y, globalChoords.y)); + + var length = root.iconSize * wrapper.mScale; //! Magic Lamp effect doesn't like coordinates outside the screen and //! width,heights of zero value... So we now normalize the geometries //! sent in order to avoid such circumstances if (root.vertical) { + if (adjY !== globalChoords.y) { + if (((globalChoords.y+globalChoords.height) < limits.y) || (globalChoords.y)>(limits.y+limits.height)) { + //! totally out of boundaries + length = 4; + } else { + //! semi-part out of boundaries + length = Math.max(4, Math.abs(adjY - globalChoords.y)); + } + } + globalChoords.width = 1; - globalChoords.height = Math.max(root.iconSize, taskItem.height); + globalChoords.height = length; } else { + if (adjX !== globalChoords.x) { + if (((globalChoords.x+globalChoords.width) < limits.x) || (globalChoords.x)>(limits.x+limits.width)) { + //! totally out of boundaries + length = 4; + } else { + //! semi-part out of boundaries + length = Math.max(4, Math.abs(adjX - globalChoords.x)); + } + } + globalChoords.height = 1; - globalChoords.width = Math.max(root.iconSize, taskItem.width); + globalChoords.width = length; } + globalChoords.x = adjX; + globalChoords.y = adjY; + if (root.position === PlasmaCore.Types.BottomPositioned) { globalChoords.y = plasmoid.screenGeometry.y+plasmoid.screenGeometry.height-1; } else if (root.position === PlasmaCore.Types.TopPositioned) { @@ -1362,6 +1392,15 @@ MouseArea{ } } + Connections { + target: scrollableList + onAnimationsFinishedChanged: { + if (!scrollableList.animationsFinished) { + taskItem.slotPublishGeometries(); + } + } + } + ///// End of Helper functions //// diff --git a/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml b/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml index 8728c433a..38bf36cb0 100644 --- a/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml +++ b/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml @@ -31,6 +31,7 @@ Flickable{ property int offset: 0 + readonly property bool animationsFinished: !horizontalAnimation.running && !verticalAnimation.running readonly property bool centered: userPanelPosition === Latte.Types.Center readonly property bool reversed: Qt.application.layoutDirection === Qt.RightToLeft @@ -132,6 +133,7 @@ Flickable{ Behavior on contentX { NumberAnimation { + id: horizontalAnimation duration: root.durationTime*units.longDuration easing.type: Easing.OutQuad } @@ -139,6 +141,7 @@ Flickable{ Behavior on contentY { NumberAnimation { + id: verticalAnimation duration: root.durationTime*units.longDuration easing.type: Easing.OutQuad }