53 lines
1.7 KiB
QML
53 lines
1.7 KiB
QML
import QtQuick
|
|
import QtQuick.Shapes
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Wayland
|
|
|
|
PanelWindow {
|
|
id: corner
|
|
required property real radius
|
|
required property int angle
|
|
required property color fillColor
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
|
|
color: "transparent"
|
|
implicitWidth: corner.radius
|
|
implicitHeight: corner.radius
|
|
|
|
|
|
function anglePointX(angle) {
|
|
return (corner.radius * Math.sqrt(2) * 1/2 * Math.sin(angle)) + corner.radius/2
|
|
}
|
|
function anglePointY(angle) {
|
|
return (corner.radius * Math.sqrt(2) * 1/2 * Math.cos(angle)) + corner.radius/2
|
|
}
|
|
Shape {
|
|
anchors.fill: parent
|
|
preferredRendererType: Shape.CurveRenderer
|
|
|
|
ShapePath {
|
|
fillColor: corner.fillColor
|
|
strokeColor: "transparent"
|
|
startX: anglePointX(Math.PI * 5/4 + corner.angle * Math.PI/180)
|
|
startY: anglePointY(Math.PI * 5/4 + corner.angle * Math.PI/180)
|
|
PathLine {
|
|
x: anglePointX(Math.PI * 3/4 + corner.angle * Math.PI/180)
|
|
y: anglePointY(Math.PI * 3/4 + corner.angle * Math.PI/180)
|
|
}
|
|
PathAngleArc {
|
|
radiusX: corner.radius
|
|
radiusY: corner.radius
|
|
startAngle: 270 - corner.angle
|
|
sweepAngle: -90
|
|
centerX: anglePointX(Math.PI * 1/4 + corner.angle * Math.PI/180)
|
|
centerY: anglePointY(Math.PI * 1/4 + corner.angle * Math.PI/180)
|
|
}
|
|
PathLine {
|
|
x: anglePointX(Math.PI * 5/4 + corner.angle * Math.PI/180)
|
|
y: anglePointY(Math.PI * 5/4 + corner.angle * Math.PI/180)
|
|
}
|
|
}
|
|
}
|
|
}
|