diff --git a/Functions/MovePet.qml b/Functions/MovePet.qml deleted file mode 100644 index bb98e19..0000000 --- a/Functions/MovePet.qml +++ /dev/null @@ -1,16 +0,0 @@ -import QtQuick - -MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - drag.target: null // Not using built-in drag behavior - - onPositionChanged: { - if (mouse.buttons & Qt.LeftButton) { - petMarch.mleft = mouse.x - petMarch.mbottom = mouse.y - console.log("mleft:", petMarch.mleft, "mbottom:", petMarch.mbottom) - } - } -} diff --git a/Modules/Mouse.qml b/Modules/Mouse.qml new file mode 100644 index 0000000..37e3191 --- /dev/null +++ b/Modules/Mouse.qml @@ -0,0 +1,29 @@ +import QtQuick + +MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + property bool dragging: false + property real offsetX: 0 + property real offsetY: 0 + + onPressed: { + if (mouse.x >= original.x && + mouse.x <= original.x + original.width && + mouse.y >= original.y && + mouse.y <= original.y + original.height) { + dragging = true + offsetX = mouse.x - original.x + offsetY = mouse.y - original.y + } + } + + onReleased: dragging = false + + onPositionChanged: { + if (dragging) { + original.x = Math.max(0, Math.min(mouse.x - offsetX, Screen.width - original.width)) + original.y = Math.max(0, Math.min(mouse.y - offsetY, Screen.height - original.height)) + } + } +} diff --git a/Modules/PetMarch.qml b/Modules/PetMarch.qml index bf7d3e6..2e474db 100644 --- a/Modules/PetMarch.qml +++ b/Modules/PetMarch.qml @@ -3,15 +3,16 @@ import Quickshell.Io import Quickshell.Wayland Rectangle { + width: 320 + height: 293 + + // anchors.bottom: parent.bottom + AnimatedImage { source: "../Gifs/evernight.gif" fillMode: Image.PreserveAspectFit } - // margins { - // mainWindow.left: 50 - // } - IpcHandler { target: "command" diff --git a/shell.qml b/shell.qml index 704623c..65177aa 100644 --- a/shell.qml +++ b/shell.qml @@ -3,7 +3,7 @@ import QtQuick import Quickshell import Quickshell.Wayland import qs.Modules -import qs.Functions +// import qs.Functions PanelWindow { id: mainWindow @@ -17,18 +17,36 @@ PanelWindow { margins { left: 0 + right: 0 + top: 0 bottom: 9 } - mask: Region {} + mask: Region { + intersection: intersection.Intersect + } surfaceFormat.opaque: false - implicitWidth: 320 - implicitHeight: 293 + implicitWidth: Screen.width + implicitHeight: Screen.height PetMarch { - id: petMarch + id: petMarch2 color: mainWindow.color - anchors.fill: parent + anchors.right: parent.right + anchors.bottom: parent.bottom + } + + // Mve this pet + PetMarch { + id: original + color: mainWindow.color + x: 0 + y: 1147 + // anchors.leftMargin: parent.leftMargin + // anchors.bottomMargin: parent.bottomMargin + } + + Mouse { } }