Finished.
This commit is contained in:
|
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 294 KiB |
@@ -16,8 +16,12 @@ Repeater {
|
||||
|
||||
required property url fileUrl
|
||||
required property string fileBaseName
|
||||
required property int index
|
||||
property bool loaded: false
|
||||
property alias hovered: mouse.containsMouse
|
||||
property alias zIndex: gifSaved.zIndex
|
||||
|
||||
z: gifSaved.zIndex
|
||||
visible: gifItem.loaded
|
||||
onXChanged: if ( gifItem.loaded ) gifSaved.positionX = gifItem.x
|
||||
onYChanged: if ( gifItem.loaded ) gifSaved.positionY = gifItem.y
|
||||
@@ -32,6 +36,7 @@ Repeater {
|
||||
}
|
||||
|
||||
Mouse {
|
||||
id: mouse
|
||||
onWheel: (wheel)=> {
|
||||
gifSaved.scaling = Math.max( 1, ( gifSaved.scaling + 0.1 * ( wheel.angleDelta.y / 120 ) ) )
|
||||
}
|
||||
@@ -48,12 +53,14 @@ Repeater {
|
||||
property string configPath: configDir + name
|
||||
|
||||
onLoaded: {
|
||||
if ( gifSaved.zIndex === -1 ) gifSaved.zIndex = gifItem.index
|
||||
gifItem.x = gifSaved.positionX
|
||||
gifItem.y = gifSaved.positionY
|
||||
gifItem.loaded = true
|
||||
}
|
||||
|
||||
onLoadFailed: {
|
||||
gifSaved.zIndex = gifItem.index
|
||||
writeAdapter()
|
||||
gifItem.loaded = true
|
||||
}
|
||||
@@ -70,6 +77,7 @@ Repeater {
|
||||
property real scaling: 1
|
||||
property int positionX: 0
|
||||
property int positionY: 0
|
||||
property int zIndex: -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import QtQuick
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
drag.target: parent
|
||||
drag.axis: Drag.XAndYAxis
|
||||
drag.minimumX: 0
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
<div align="Center">
|
||||
<h3> Pet March (Evernight) </h3>
|
||||
<p>My selfmade desktop pet using QT </p>
|
||||
<img src=./Assets/evernight.gif style="margin: 0px 30px 0px 0px;" />
|
||||
<img src=./Assets/Evernight.gif style="margin: 0px 30px 0px 0px;" />
|
||||
</div>
|
||||
|
||||
## Feature list
|
||||
|
||||
- [x] Hyprland keybind support
|
||||
- [x] Swap Overlay <> Bottom
|
||||
- [x] Swap Mouse area targetted -/+
|
||||
- [x] Swap Overlay <> Bottom
|
||||
- [x] Swap Mouse area targetted -/+
|
||||
- [x] Dynamic pets
|
||||
- [x] Multiple pets
|
||||
- [x] Config location ~/.config/I-DeskPet/config.json
|
||||
{"gifFolder": "PATH"}
|
||||
{"gifFolder": "PATH"}
|
||||
- [x] Evernight base gif img
|
||||
|
||||
## To-Do list
|
||||
- [] Setting more json settings
|
||||
- [] Clear up code
|
||||
- [] Auto update gifs modeldata
|
||||
|
||||
@@ -9,7 +9,7 @@ import qs.Modules
|
||||
|
||||
PanelWindow {
|
||||
id: mainWindow
|
||||
WlrLayershell.namespace: "IDeskPet-Pet"
|
||||
WlrLayershell.namespace: "I-DeskPet"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
surfaceFormat.opaque: false
|
||||
@@ -123,4 +123,45 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
appid: "I-DeskPet"
|
||||
name: "cycle-zIndex"
|
||||
onPressed: {
|
||||
let items = mainWindow.repeaterItems
|
||||
if ( items.length < 2 ) return
|
||||
|
||||
// Find the hovered GIF
|
||||
let hovered = null
|
||||
for ( let i = 0; i < items.length; i++ ) {
|
||||
if ( items[i].hovered ) {
|
||||
hovered = items[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
if ( !hovered ) return
|
||||
|
||||
let currentZ = hovered.zIndex
|
||||
let maxZ = items.length - 1
|
||||
|
||||
if ( currentZ >= maxZ ) {
|
||||
// Already on top, wrap to bottom: shift everyone else up by 1
|
||||
for ( let i = 0; i < items.length; i++ ) {
|
||||
if ( items[i] !== hovered ) {
|
||||
items[i].zIndex += 1
|
||||
}
|
||||
}
|
||||
hovered.zIndex = 0
|
||||
} else {
|
||||
// Swap with the item directly above
|
||||
for ( let i = 0; i < items.length; i++ ) {
|
||||
if ( items[i] !== hovered && items[i].zIndex === currentZ + 1 ) {
|
||||
items[i].zIndex = currentZ
|
||||
break
|
||||
}
|
||||
}
|
||||
hovered.zIndex = currentZ + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user