feat: initial commit for pixel-snapping components and helpers
This commit is contained in:
+17
-13
@@ -2,9 +2,11 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell
|
||||
import ZShell.Config
|
||||
import ZShell.Components
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Daemons
|
||||
import qs.Services
|
||||
|
||||
@@ -19,14 +21,17 @@ Item {
|
||||
required property ScreenState screenState
|
||||
required property real volume
|
||||
|
||||
implicitHeight: layout.implicitHeight + Tokens.padding.smaller * 2
|
||||
implicitWidth: layout.implicitWidth + Tokens.padding.smaller * 2
|
||||
implicitHeight: layout.implicitHeight + layout.anchors.margins * 2
|
||||
implicitWidth: layout.implicitWidth + layout.anchors.margins * 2
|
||||
|
||||
ColumnLayout {
|
||||
SnapLayout {
|
||||
id: layout
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.fill: parent
|
||||
anchors.margins: Tokens.padding.extraSmall
|
||||
|
||||
spacing: Tokens.spacing.medium
|
||||
orientation: Qt.Vertical
|
||||
|
||||
// Speaker volume
|
||||
CustomMouseArea {
|
||||
@@ -37,8 +42,8 @@ Item {
|
||||
Audio.decrementVolume();
|
||||
}
|
||||
|
||||
implicitHeight: Config.osd.sizes.sliderHeight
|
||||
implicitWidth: Config.osd.sizes.sliderWidth
|
||||
implicitHeight: ZUtils.snap(Config.osd.sizes.sliderHeight, root)
|
||||
implicitWidth: ZUtils.snap(Config.osd.sizes.sliderWidth, root)
|
||||
|
||||
FilledSlider {
|
||||
anchors.fill: parent
|
||||
@@ -63,8 +68,8 @@ Item {
|
||||
Audio.decrementSourceVolume();
|
||||
}
|
||||
|
||||
implicitHeight: Config.osd.sizes.sliderHeight
|
||||
implicitWidth: Config.osd.sizes.sliderWidth
|
||||
implicitHeight: ZUtils.snap(Config.osd.sizes.sliderHeight, root)
|
||||
implicitWidth: ZUtils.snap(Config.osd.sizes.sliderWidth, root)
|
||||
|
||||
FilledSlider {
|
||||
anchors.fill: parent
|
||||
@@ -93,8 +98,8 @@ Item {
|
||||
monitor.setBrightness(monitor.brightness - Config.services.brightnessIncrement);
|
||||
}
|
||||
|
||||
implicitHeight: Config.osd.sizes.sliderHeight
|
||||
implicitWidth: Config.osd.sizes.sliderWidth
|
||||
implicitHeight: ZUtils.snap(Config.osd.sizes.sliderHeight, root)
|
||||
implicitWidth: ZUtils.snap(Config.osd.sizes.sliderWidth, root)
|
||||
|
||||
FilledSlider {
|
||||
anchors.fill: parent
|
||||
@@ -131,8 +136,7 @@ Item {
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
}
|
||||
Anim {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import ZShell
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Daemons
|
||||
|
||||
Item {
|
||||
@@ -30,8 +31,8 @@ Item {
|
||||
}
|
||||
|
||||
anchors.rightMargin: (-implicitWidth - 5 - sidebarOffset) * offsetScale
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: content.implicitWidth
|
||||
implicitHeight: ZUtils.snap(content.implicitHeight, root)
|
||||
implicitWidth: ZUtils.snap(content.implicitWidth, root)
|
||||
opacity: 1 - offsetScale
|
||||
visible: offsetScale < 1
|
||||
|
||||
@@ -98,8 +99,7 @@ Item {
|
||||
id: content
|
||||
|
||||
active: root.shouldBeActive || root.visible
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.fill: parent
|
||||
|
||||
sourceComponent: Content {
|
||||
brightness: root.brightness
|
||||
|
||||
Reference in New Issue
Block a user