mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
homescreen: Fix non-existent property calls and remove unused file
This commit is contained in:
parent
058de1555e
commit
68b7d3897e
3 changed files with 17 additions and 125 deletions
|
|
@ -200,6 +200,7 @@ DragDrop.DropArea {
|
|||
return true;
|
||||
}
|
||||
appletContainerComponent: MobileAppletContainer {
|
||||
homeScreenState: dropArea.homeScreenState
|
||||
launcherDragManager: dropArea.launcherDragManager
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ import "private" as Private
|
|||
|
||||
ContainmentLayoutManager.BasicAppletContainer {
|
||||
id: appletContainer
|
||||
|
||||
property var homeScreenState
|
||||
property real screenWidth: homeScreenState.availableScreenWidth
|
||||
property real screenHeight: homeScreenState.availableScreenHeight
|
||||
|
||||
configOverlayComponent: Private.ConfigOverlay {}
|
||||
|
||||
property LauncherDragManager launcherDragManager
|
||||
|
|
@ -62,19 +67,19 @@ ContainmentLayoutManager.BasicAppletContainer {
|
|||
if (pos.x < PlasmaCore.Units.gridUnit) {
|
||||
launcherRepeater.scrollLeftRequested();
|
||||
//SCROLL RIGHT
|
||||
} else if (pos.x > mainFlickable.width - PlasmaCore.Units.gridUnit) {
|
||||
} else if (pos.x > screenWidth - PlasmaCore.Units.gridUnit) {
|
||||
launcherRepeater.scrollRightRequested();
|
||||
//DON't SCROLL
|
||||
} else {
|
||||
launcherRepeater.stopScrollRequested();
|
||||
}
|
||||
|
||||
appletContainer.x = Math.max(0, Math.min(mainFlickable.width - appletContainer.width, appletContainer.x));
|
||||
appletContainer.x = Math.max(0, Math.min(screenWidth - appletContainer.width, appletContainer.x));
|
||||
}
|
||||
onWidthChanged: {
|
||||
if (appletContainer.x + appletContainer.width > mainFlickable.width * Math.max(1, Math.ceil(appletContainer.x / mainFlickable.width))) {
|
||||
if (appletContainer.x + appletContainer.width > screenWidth * Math.max(1, Math.ceil(appletContainer.x / screenWidth))) {
|
||||
appletsLayout.releaseSpace(appletContainer);
|
||||
appletContainer.width = (mainFlickable.width * Math.max(1, Math.ceil(appletContainer.x / mainFlickable.width)) - appletContainer.x);
|
||||
appletContainer.width = (screenWidth * Math.max(1, Math.ceil(appletContainer.x / screenWidth)) - appletContainer.x);
|
||||
appletsLayout.positionItem(appletContainer);
|
||||
}
|
||||
}
|
||||
|
|
@ -88,21 +93,21 @@ ContainmentLayoutManager.BasicAppletContainer {
|
|||
target: dropArea
|
||||
function onWidthChanged () {
|
||||
let spaceReleased = false;
|
||||
if (appletContainer.width > mainFlickable.width || appletContainer.height > mainFlickable.height) {
|
||||
if (appletContainer.width > screenWidth || appletContainer.height > screenHeight) {
|
||||
appletsLayout.releaseSpace(appletContainer);
|
||||
appletContainer.width = Math.min(appletContainer.width, mainFlickable.width);
|
||||
appletContainer.height = Math.min(appletContainer.height, mainFlickable.height);
|
||||
appletContainer.width = Math.min(appletContainer.width, screenWidth);
|
||||
appletContainer.height = Math.min(appletContainer.height, screenHeight);
|
||||
spaceReleased = true;
|
||||
}
|
||||
if (Math.floor((appletContainer.x) / mainFlickable.width) < Math.floor((appletContainer.x + appletContainer.width/2) / mainFlickable.width)) {
|
||||
if (Math.floor((appletContainer.x) / screenWidth) < Math.floor((appletContainer.x + appletContainer.width/2) / screenWidth)) {
|
||||
appletsLayout.releaseSpace(appletContainer);
|
||||
appletContainer.x = Math.floor((appletContainer.x + appletContainer.width) / mainFlickable.width) * mainFlickable.width;
|
||||
appletContainer.x = Math.floor((appletContainer.x + appletContainer.width) / screenWidth) * screenWidth;
|
||||
appletsLayout.positionItem(appletContainer);
|
||||
spaceReleased = false;
|
||||
|
||||
} else if (Math.floor((appletContainer.x + appletContainer.width/2) / mainFlickable.width) < Math.floor((appletContainer.x + appletContainer.width) / mainFlickable.width)) {
|
||||
} else if (Math.floor((appletContainer.x + appletContainer.width/2) / screenWidth) < Math.floor((appletContainer.x + appletContainer.width) / screenWidth)) {
|
||||
appletsLayout.releaseSpace(appletContainer);
|
||||
appletContainer.x = Math.ceil(appletContainer.x / mainFlickable.width) * mainFlickable.width - appletContainer.width;
|
||||
appletContainer.x = Math.ceil(appletContainer.x / screenWidth) * screenWidth - screenWidth;
|
||||
appletsLayout.positionItem(appletContainer);
|
||||
spaceReleased = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Marco Martin <mart@kde.org>
|
||||
* SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.14
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||
|
||||
import ".." as Launcher
|
||||
|
||||
DragHandler {
|
||||
id: root
|
||||
yAxis.enabled: enabled
|
||||
xAxis.enabled: enabled
|
||||
property Flickable mainFlickable
|
||||
property Launcher.AbstractAppDrawer appDrawer
|
||||
signal snapPage
|
||||
signal snapNextPage
|
||||
signal snapPrevPage
|
||||
|
||||
enum ScrollDirection {
|
||||
None,
|
||||
Left,
|
||||
Right,
|
||||
Vertical
|
||||
}
|
||||
|
||||
property real __initialMainFlickableX
|
||||
property real __oldTranslationY: 0
|
||||
property int __scrollDirection: DragGestureHandler.None
|
||||
onTranslationChanged: {
|
||||
if (active) {
|
||||
if (root.appDrawer) {
|
||||
if (__scrollDirection === DragGestureHandler.None) {
|
||||
if (root.appDrawer.flickable.contentY > PlasmaCore.Units.gridUnit * 2) {
|
||||
|
||||
__scrollDirection = DragGestureHandler.Vertical;
|
||||
snapPage();
|
||||
} else if (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit) {
|
||||
|
||||
__scrollDirection = DragGestureHandler.Right;
|
||||
root.appDrawer.close();
|
||||
} else if (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit) {
|
||||
|
||||
__scrollDirection = DragGestureHandler.Left;
|
||||
root.appDrawer.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (__scrollDirection !== DragGestureHandler.Left && __scrollDirection !== DragGestureHandler.Right) {
|
||||
|
||||
// ensure it does not conflict with task switcher
|
||||
if (!MobileShell.HomeScreenControls.taskSwitcher.visible) {
|
||||
// if swipe up, scroll app drawer
|
||||
root.appDrawer.flickable.contentY = Math.min(root.appDrawer.drawerTopMargin, Math.max(0, -translation.y));
|
||||
|
||||
if (translation.y < 0 && MobileShell.TopPanelControls.inSwipe) {
|
||||
MobileShell.TopPanelControls.endSwipe();
|
||||
}
|
||||
|
||||
// if swipe down, scroll top panel
|
||||
if (translation.y > 0) {
|
||||
if (!MobileShell.TopPanelControls.inSwipe) {
|
||||
MobileShell.TopPanelControls.startSwipe();
|
||||
}
|
||||
MobileShell.TopPanelControls.requestRelativeScroll(translation.y - __oldTranslationY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (__scrollDirection !== DragGestureHandler.Vertical) {
|
||||
let newContentX = Math.min((mainFlickable.width * mainFlickable.totalPages) - mainFlickable.width, Math.max(0, __initialMainFlickableX - translation.x));
|
||||
|
||||
if (__scrollDirection !== DragGestureHandler.None) {
|
||||
if (mainFlickable.contentX < newContentX) {
|
||||
__scrollDirection = DragGestureHandler.Right;
|
||||
} else {
|
||||
__scrollDirection = DragGestureHandler.Left;
|
||||
}
|
||||
}
|
||||
|
||||
mainFlickable.contentX = newContentX;
|
||||
}
|
||||
}
|
||||
|
||||
__oldTranslationY = translation.y;
|
||||
}
|
||||
|
||||
onActiveChanged: {
|
||||
if (active) {
|
||||
__initialMainFlickableX = mainFlickable.contentX;
|
||||
} else {
|
||||
if (root.appDrawer) {
|
||||
root.appDrawer.snapDrawerStatus();
|
||||
}
|
||||
if (MobileShell.TopPanelControls.inSwipe) {
|
||||
MobileShell.TopPanelControls.endSwipe();
|
||||
}
|
||||
if (__scrollDirection === DragGestureHandler.Left && (__initialMainFlickableX - mainFlickable.contentX > PlasmaCore.Units.gridUnit * 5)) {
|
||||
snapPrevPage();
|
||||
} else if (__scrollDirection === DragGestureHandler.Right && (mainFlickable.contentX - __initialMainFlickableX > PlasmaCore.Units.gridUnit * 5)) {
|
||||
snapNextPage();
|
||||
} else {
|
||||
snapPage();
|
||||
}
|
||||
__scrollDirection = DragGestureHandler.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue