mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-16 10:42:06 -04:00
feat(Frame): Close the gaps
This commit is contained in:
@@ -2,8 +2,8 @@ import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import qs.Common
|
||||
|
||||
// Unified connected silhouette: body + concave arcs as one ShapePath.
|
||||
// PathArc pattern — 4 arcs + 4 lines, no sibling alignment.
|
||||
// Unified connected silhouette: body + near/far concave arcs as one ShapePath.
|
||||
// Keeping the connected chrome in one path avoids sibling alignment seams.
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -14,6 +14,10 @@ Item {
|
||||
property real bodyHeight: 0
|
||||
|
||||
property real connectorRadius: 12
|
||||
property real startConnectorRadius: connectorRadius
|
||||
property real endConnectorRadius: connectorRadius
|
||||
property real farStartConnectorRadius: 0
|
||||
property real farEndConnectorRadius: 0
|
||||
|
||||
property real surfaceRadius: 12
|
||||
|
||||
@@ -21,20 +25,36 @@ Item {
|
||||
|
||||
// ── Derived layout ──
|
||||
readonly property bool _horiz: barSide === "top" || barSide === "bottom"
|
||||
readonly property real _cr: Math.max(0, connectorRadius)
|
||||
readonly property real _sc: Math.max(0, startConnectorRadius)
|
||||
readonly property real _ec: Math.max(0, endConnectorRadius)
|
||||
readonly property real _fsc: Math.max(0, farStartConnectorRadius)
|
||||
readonly property real _fec: Math.max(0, farEndConnectorRadius)
|
||||
readonly property real _firstCr: barSide === "left" ? _sc : _ec
|
||||
readonly property real _secondCr: barSide === "left" ? _ec : _sc
|
||||
readonly property real _firstFarCr: barSide === "left" ? _fsc : _fec
|
||||
readonly property real _secondFarCr: barSide === "left" ? _fec : _fsc
|
||||
readonly property real _farExtent: Math.max(_fsc, _fec)
|
||||
readonly property real _sr: Math.max(0, Math.min(surfaceRadius, (_horiz ? bodyWidth : bodyHeight) / 2, (_horiz ? bodyHeight : bodyWidth) / 2))
|
||||
readonly property real _firstSr: _firstFarCr > 0 ? 0 : _sr
|
||||
readonly property real _secondSr: _secondFarCr > 0 ? 0 : _sr
|
||||
readonly property real _firstFarInset: _firstFarCr > 0 ? _firstFarCr : _firstSr
|
||||
readonly property real _secondFarInset: _secondFarCr > 0 ? _secondFarCr : _secondSr
|
||||
|
||||
// Root-level aliases — PathArc/PathLine elements can't use `parent`.
|
||||
readonly property real _bw: bodyWidth
|
||||
readonly property real _bh: bodyHeight
|
||||
readonly property real _totalW: _horiz ? _bw + _cr * 2 : _bw
|
||||
readonly property real _totalH: _horiz ? _bh : _bh + _cr * 2
|
||||
readonly property real _bodyLeft: _horiz ? _sc : (barSide === "right" ? _farExtent : 0)
|
||||
readonly property real _bodyRight: _bodyLeft + _bw
|
||||
readonly property real _bodyTop: _horiz ? (barSide === "bottom" ? _farExtent : 0) : _sc
|
||||
readonly property real _bodyBottom: _bodyTop + _bh
|
||||
readonly property real _totalW: _horiz ? _bw + _sc + _ec : _bw + _farExtent
|
||||
readonly property real _totalH: _horiz ? _bh + _farExtent : _bh + _sc + _ec
|
||||
|
||||
width: _totalW
|
||||
height: _totalH
|
||||
|
||||
readonly property real bodyX: _horiz ? _cr : 0
|
||||
readonly property real bodyY: _horiz ? 0 : _cr
|
||||
readonly property real bodyX: root._bodyLeft
|
||||
readonly property real bodyY: root._bodyTop
|
||||
|
||||
Shape {
|
||||
anchors.fill: parent
|
||||
@@ -94,27 +114,27 @@ Item {
|
||||
relativeX: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._cr;
|
||||
return root._firstCr;
|
||||
case "right":
|
||||
return -root._cr;
|
||||
return -root._firstCr;
|
||||
default:
|
||||
return -root._cr;
|
||||
return -root._firstCr;
|
||||
}
|
||||
}
|
||||
relativeY: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return -root._cr;
|
||||
return -root._firstCr;
|
||||
case "left":
|
||||
return root._cr;
|
||||
return root._firstCr;
|
||||
case "right":
|
||||
return -root._cr;
|
||||
return -root._firstCr;
|
||||
default:
|
||||
return root._cr;
|
||||
return root._firstCr;
|
||||
}
|
||||
}
|
||||
radiusX: root._cr
|
||||
radiusY: root._cr
|
||||
radiusX: root._firstCr
|
||||
radiusY: root._firstCr
|
||||
direction: root.barSide === "bottom" ? PathArc.Clockwise : PathArc.Counterclockwise
|
||||
}
|
||||
|
||||
@@ -123,23 +143,23 @@ Item {
|
||||
x: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._bw - root._sr;
|
||||
return root._bodyRight - root._firstSr;
|
||||
case "right":
|
||||
return root._sr;
|
||||
return root._bodyLeft + root._firstSr;
|
||||
default:
|
||||
return root._totalW - root._cr;
|
||||
return root._bodyRight;
|
||||
}
|
||||
}
|
||||
y: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._sr;
|
||||
return root._bodyTop + root._firstSr;
|
||||
case "left":
|
||||
return root._cr;
|
||||
return root._bodyTop;
|
||||
case "right":
|
||||
return root._cr + root._bh;
|
||||
return root._bodyBottom;
|
||||
default:
|
||||
return root._totalH - root._sr;
|
||||
return root._bodyBottom - root._firstSr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,52 +169,160 @@ Item {
|
||||
relativeX: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._sr;
|
||||
return root._firstSr;
|
||||
case "right":
|
||||
return -root._sr;
|
||||
return -root._firstSr;
|
||||
default:
|
||||
return -root._sr;
|
||||
return -root._firstSr;
|
||||
}
|
||||
}
|
||||
relativeY: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return -root._sr;
|
||||
return -root._firstSr;
|
||||
case "left":
|
||||
return root._sr;
|
||||
return root._firstSr;
|
||||
case "right":
|
||||
return -root._sr;
|
||||
return -root._firstSr;
|
||||
default:
|
||||
return root._sr;
|
||||
return root._firstSr;
|
||||
}
|
||||
}
|
||||
radiusX: root._sr
|
||||
radiusY: root._sr
|
||||
radiusX: root._firstSr
|
||||
radiusY: root._firstSr
|
||||
direction: root.barSide === "bottom" ? PathArc.Counterclockwise : PathArc.Clockwise
|
||||
}
|
||||
|
||||
// Opposite-side connector 1
|
||||
PathLine {
|
||||
x: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._firstFarCr > 0 ? root._bodyRight + root._firstFarCr : root._bodyRight;
|
||||
case "right":
|
||||
return root._firstFarCr > 0 ? root._bodyLeft - root._firstFarCr : root._bodyLeft;
|
||||
default:
|
||||
return root._firstFarCr > 0 ? root._bodyRight : root._bodyRight - root._firstSr;
|
||||
}
|
||||
}
|
||||
y: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._firstFarCr > 0 ? root._bodyTop - root._firstFarCr : root._bodyTop;
|
||||
case "left":
|
||||
return root._firstFarCr > 0 ? root._bodyTop : root._bodyTop + root._firstSr;
|
||||
case "right":
|
||||
return root._firstFarCr > 0 ? root._bodyBottom : root._bodyBottom - root._firstSr;
|
||||
default:
|
||||
return root._firstFarCr > 0 ? root._bodyBottom + root._firstFarCr : root._bodyBottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PathArc {
|
||||
relativeX: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return -root._firstFarCr;
|
||||
case "right":
|
||||
return root._firstFarCr;
|
||||
default:
|
||||
return -root._firstFarCr;
|
||||
}
|
||||
}
|
||||
relativeY: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._firstFarCr;
|
||||
case "left":
|
||||
return root._firstFarCr;
|
||||
case "right":
|
||||
return -root._firstFarCr;
|
||||
default:
|
||||
return -root._firstFarCr;
|
||||
}
|
||||
}
|
||||
radiusX: root._firstFarCr
|
||||
radiusY: root._firstFarCr
|
||||
direction: root.barSide === "bottom" ? PathArc.Clockwise : PathArc.Counterclockwise
|
||||
}
|
||||
|
||||
// Far edge
|
||||
PathLine {
|
||||
x: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._bw;
|
||||
return root._bodyRight;
|
||||
case "right":
|
||||
return 0;
|
||||
return root._bodyLeft;
|
||||
default:
|
||||
return root._cr + root._sr;
|
||||
return root._bodyLeft + root._secondFarInset;
|
||||
}
|
||||
}
|
||||
y: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return 0;
|
||||
return root._bodyTop;
|
||||
case "left":
|
||||
return root._cr + root._bh - root._sr;
|
||||
return root._bodyBottom - root._secondFarInset;
|
||||
case "right":
|
||||
return root._cr + root._sr;
|
||||
return root._bodyTop + root._secondFarInset;
|
||||
default:
|
||||
return root._totalH;
|
||||
return root._bodyBottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Opposite-side connector 2
|
||||
PathArc {
|
||||
relativeX: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._secondFarCr;
|
||||
case "right":
|
||||
return -root._secondFarCr;
|
||||
default:
|
||||
return -root._secondFarCr;
|
||||
}
|
||||
}
|
||||
relativeY: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return -root._secondFarCr;
|
||||
case "left":
|
||||
return root._secondFarCr;
|
||||
case "right":
|
||||
return -root._secondFarCr;
|
||||
default:
|
||||
return root._secondFarCr;
|
||||
}
|
||||
}
|
||||
radiusX: root._secondFarCr
|
||||
radiusY: root._secondFarCr
|
||||
direction: root.barSide === "bottom" ? PathArc.Clockwise : PathArc.Counterclockwise
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._secondFarCr > 0 ? root._bodyRight : root._bodyRight;
|
||||
case "right":
|
||||
return root._secondFarCr > 0 ? root._bodyLeft : root._bodyLeft;
|
||||
default:
|
||||
return root._secondFarCr > 0 ? root._bodyLeft : root._bodyLeft + root._secondSr;
|
||||
}
|
||||
}
|
||||
y: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._secondFarCr > 0 ? root._bodyTop : root._bodyTop;
|
||||
case "left":
|
||||
return root._secondFarCr > 0 ? root._bodyBottom : root._bodyBottom - root._secondSr;
|
||||
case "right":
|
||||
return root._secondFarCr > 0 ? root._bodyTop : root._bodyTop + root._secondSr;
|
||||
default:
|
||||
return root._secondFarCr > 0 ? root._bodyBottom : root._bodyBottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,27 +332,27 @@ Item {
|
||||
relativeX: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return -root._sr;
|
||||
return -root._secondSr;
|
||||
case "right":
|
||||
return root._sr;
|
||||
return root._secondSr;
|
||||
default:
|
||||
return -root._sr;
|
||||
return -root._secondSr;
|
||||
}
|
||||
}
|
||||
relativeY: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._sr;
|
||||
return root._secondSr;
|
||||
case "left":
|
||||
return root._sr;
|
||||
return root._secondSr;
|
||||
case "right":
|
||||
return -root._sr;
|
||||
return -root._secondSr;
|
||||
default:
|
||||
return -root._sr;
|
||||
return -root._secondSr;
|
||||
}
|
||||
}
|
||||
radiusX: root._sr
|
||||
radiusY: root._sr
|
||||
radiusX: root._secondSr
|
||||
radiusY: root._secondSr
|
||||
direction: root.barSide === "bottom" ? PathArc.Counterclockwise : PathArc.Clockwise
|
||||
}
|
||||
|
||||
@@ -233,23 +361,23 @@ Item {
|
||||
x: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return root._cr;
|
||||
return root._bodyLeft + root._ec;
|
||||
case "right":
|
||||
return root._bw - root._cr;
|
||||
return root._bodyRight - root._sc;
|
||||
default:
|
||||
return root._cr;
|
||||
return root._bodyLeft;
|
||||
}
|
||||
}
|
||||
y: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._totalH - root._cr;
|
||||
return root._bodyBottom - root._sc;
|
||||
case "left":
|
||||
return root._cr + root._bh;
|
||||
return root._bodyBottom;
|
||||
case "right":
|
||||
return root._cr;
|
||||
return root._bodyTop;
|
||||
default:
|
||||
return root._cr;
|
||||
return root._bodyTop + root._sc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,27 +387,27 @@ Item {
|
||||
relativeX: {
|
||||
switch (root.barSide) {
|
||||
case "left":
|
||||
return -root._cr;
|
||||
return -root._secondCr;
|
||||
case "right":
|
||||
return root._cr;
|
||||
return root._secondCr;
|
||||
default:
|
||||
return -root._cr;
|
||||
return -root._secondCr;
|
||||
}
|
||||
}
|
||||
relativeY: {
|
||||
switch (root.barSide) {
|
||||
case "bottom":
|
||||
return root._cr;
|
||||
return root._secondCr;
|
||||
case "left":
|
||||
return root._cr;
|
||||
return root._secondCr;
|
||||
case "right":
|
||||
return -root._cr;
|
||||
return -root._secondCr;
|
||||
default:
|
||||
return -root._cr;
|
||||
return -root._secondCr;
|
||||
}
|
||||
}
|
||||
radiusX: root._cr
|
||||
radiusY: root._cr
|
||||
radiusX: root._secondCr
|
||||
radiusY: root._secondCr
|
||||
direction: root.barSide === "bottom" ? PathArc.Clockwise : PathArc.Counterclockwise
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,9 @@ Item {
|
||||
"bodyH": root.alignedHeight,
|
||||
"animX": _connectedChromeAnimX(),
|
||||
"animY": _connectedChromeAnimY(),
|
||||
"screen": root.screen ? root.screen.name : ""
|
||||
"screen": root.screen ? root.screen.name : "",
|
||||
"omitStartConnector": root._closeGapOmitStartConnector(),
|
||||
"omitEndConnector": root._closeGapOmitEndConnector()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -299,6 +301,9 @@ Item {
|
||||
root._releaseConnectedChromeState();
|
||||
}
|
||||
}
|
||||
function onFrameCloseGapsChanged() {
|
||||
root._syncPopoutChromeState();
|
||||
}
|
||||
}
|
||||
|
||||
readonly property bool useBackgroundWindow: !CompositorService.isHyprland || CompositorService.useHyprlandFocusGrab
|
||||
@@ -421,6 +426,7 @@ Item {
|
||||
readonly property real screenWidth: screen ? screen.width : 0
|
||||
readonly property real screenHeight: screen ? screen.height : 0
|
||||
readonly property real dpr: screen ? screen.devicePixelRatio : 1
|
||||
readonly property bool closeFrameGapsActive: SettingsData.frameCloseGaps && frameOwnsConnectedChrome
|
||||
readonly property real frameInset: {
|
||||
if (!SettingsData.frameEnabled)
|
||||
return 0;
|
||||
@@ -435,6 +441,83 @@ Item {
|
||||
return Math.max(ft + gap, fr);
|
||||
}
|
||||
|
||||
function _popupGapValue() {
|
||||
const useAutoGaps = storedBarConfig?.popupGapsAuto !== undefined ? storedBarConfig.popupGapsAuto : true;
|
||||
const manualGapValue = storedBarConfig?.popupGapsManual !== undefined ? storedBarConfig.popupGapsManual : 4;
|
||||
const rawPopupGap = useAutoGaps ? Math.max(4, storedBarSpacing) : manualGapValue;
|
||||
return Theme.isConnectedEffect ? 0 : rawPopupGap;
|
||||
}
|
||||
|
||||
function _frameEdgeInset(side) {
|
||||
if (!SettingsData.frameEnabled || !root.screen)
|
||||
return 0;
|
||||
const edges = SettingsData.getActiveBarEdgesForScreen(root.screen);
|
||||
const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
||||
return Math.max(0, raw);
|
||||
}
|
||||
|
||||
function _edgeGapFor(side, popupGap) {
|
||||
if (root.closeFrameGapsActive)
|
||||
return Math.max(popupGap, _frameEdgeInset(side));
|
||||
return Math.max(popupGap, frameInset);
|
||||
}
|
||||
|
||||
function _sideAdjacentClearance(side) {
|
||||
switch (side) {
|
||||
case "left":
|
||||
return adjacentBarClearance(adjacentBarInfo.leftBar);
|
||||
case "right":
|
||||
return adjacentBarClearance(adjacentBarInfo.rightBar);
|
||||
case "top":
|
||||
return adjacentBarClearance(adjacentBarInfo.topBar);
|
||||
case "bottom":
|
||||
return adjacentBarClearance(adjacentBarInfo.bottomBar);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function _nearFrameBound(value, bound) {
|
||||
return Math.abs(value - bound) <= Math.max(1, Theme.hairline(root.dpr) * 2);
|
||||
}
|
||||
|
||||
function _closeGapClampedToFrameSide(side) {
|
||||
if (!root.closeFrameGapsActive)
|
||||
return false;
|
||||
const popupGap = _popupGapValue();
|
||||
const edgeGap = _edgeGapFor(side, popupGap);
|
||||
const adjacentGap = _sideAdjacentClearance(side);
|
||||
if (edgeGap < adjacentGap - Math.max(1, Theme.hairline(root.dpr) * 2))
|
||||
return false;
|
||||
|
||||
switch (side) {
|
||||
case "left":
|
||||
return _nearFrameBound(root.alignedX, edgeGap);
|
||||
case "right":
|
||||
return _nearFrameBound(root.alignedX, screenWidth - popupWidth - edgeGap);
|
||||
case "top":
|
||||
return _nearFrameBound(root.alignedY, edgeGap);
|
||||
case "bottom":
|
||||
return _nearFrameBound(root.alignedY, screenHeight - popupHeight - edgeGap);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _closeGapOmitStartConnector() {
|
||||
const side = contentContainer.connectedBarSide;
|
||||
if (side === "top" || side === "bottom")
|
||||
return _closeGapClampedToFrameSide("left");
|
||||
return _closeGapClampedToFrameSide("top");
|
||||
}
|
||||
|
||||
function _closeGapOmitEndConnector() {
|
||||
const side = contentContainer.connectedBarSide;
|
||||
if (side === "top" || side === "bottom")
|
||||
return _closeGapClampedToFrameSide("right");
|
||||
return _closeGapClampedToFrameSide("bottom");
|
||||
}
|
||||
|
||||
readonly property var shadowLevel: Theme.elevationLevel3
|
||||
readonly property real shadowFallbackOffset: 6
|
||||
readonly property real shadowRenderPadding: (Theme.elevationEnabled && SettingsData.popoutElevationEnabled) ? Theme.elevationRenderPadding(shadowLevel, effectiveShadowDirection, shadowFallbackOffset, 8, 16) : 0
|
||||
@@ -510,47 +593,43 @@ Item {
|
||||
}
|
||||
|
||||
readonly property real alignedX: Theme.snap((() => {
|
||||
const useAutoGaps = storedBarConfig?.popupGapsAuto !== undefined ? storedBarConfig.popupGapsAuto : true;
|
||||
const manualGapValue = storedBarConfig?.popupGapsManual !== undefined ? storedBarConfig.popupGapsManual : 4;
|
||||
const rawPopupGap = useAutoGaps ? Math.max(4, storedBarSpacing) : manualGapValue;
|
||||
const popupGap = Theme.isConnectedEffect ? 0 : rawPopupGap;
|
||||
const edgeGap = Math.max(popupGap, frameInset);
|
||||
const popupGap = _popupGapValue();
|
||||
const edgeGapLeft = _edgeGapFor("left", popupGap);
|
||||
const edgeGapRight = _edgeGapFor("right", popupGap);
|
||||
const anchorX = Theme.isConnectedEffect ? connectedAnchorX : triggerX;
|
||||
|
||||
switch (effectiveBarPosition) {
|
||||
case SettingsData.Position.Left:
|
||||
// bar on left: left side is bar-adjacent (popupGap), right side is frame-perpendicular (edgeGap)
|
||||
return Math.max(popupGap, Math.min(screenWidth - popupWidth - edgeGap, anchorX));
|
||||
return Math.max(popupGap, Math.min(screenWidth - popupWidth - edgeGapRight, anchorX));
|
||||
case SettingsData.Position.Right:
|
||||
// bar on right: right side is bar-adjacent (popupGap), left side is frame-perpendicular (edgeGap)
|
||||
return Math.max(edgeGap, Math.min(screenWidth - popupWidth - popupGap, anchorX - popupWidth));
|
||||
return Math.max(edgeGapLeft, Math.min(screenWidth - popupWidth - popupGap, anchorX - popupWidth));
|
||||
default:
|
||||
const rawX = triggerX + (triggerWidth / 2) - (popupWidth / 2);
|
||||
const minX = Math.max(edgeGap, adjacentBarClearance(adjacentBarInfo.leftBar));
|
||||
const maxX = screenWidth - popupWidth - Math.max(edgeGap, adjacentBarClearance(adjacentBarInfo.rightBar));
|
||||
const minX = Math.max(edgeGapLeft, adjacentBarClearance(adjacentBarInfo.leftBar));
|
||||
const maxX = screenWidth - popupWidth - Math.max(edgeGapRight, adjacentBarClearance(adjacentBarInfo.rightBar));
|
||||
return Math.max(minX, Math.min(maxX, rawX));
|
||||
}
|
||||
})(), dpr)
|
||||
|
||||
readonly property real alignedY: Theme.snap((() => {
|
||||
const useAutoGaps = storedBarConfig?.popupGapsAuto !== undefined ? storedBarConfig.popupGapsAuto : true;
|
||||
const manualGapValue = storedBarConfig?.popupGapsManual !== undefined ? storedBarConfig.popupGapsManual : 4;
|
||||
const rawPopupGap = useAutoGaps ? Math.max(4, storedBarSpacing) : manualGapValue;
|
||||
const popupGap = Theme.isConnectedEffect ? 0 : rawPopupGap;
|
||||
const edgeGap = Math.max(popupGap, frameInset);
|
||||
const popupGap = _popupGapValue();
|
||||
const edgeGapTop = _edgeGapFor("top", popupGap);
|
||||
const edgeGapBottom = _edgeGapFor("bottom", popupGap);
|
||||
const anchorY = Theme.isConnectedEffect ? connectedAnchorY : triggerY;
|
||||
|
||||
switch (effectiveBarPosition) {
|
||||
case SettingsData.Position.Bottom:
|
||||
// bar on bottom: bottom side is bar-adjacent (popupGap), top side is frame-perpendicular (edgeGap)
|
||||
return Math.max(edgeGap, Math.min(screenHeight - popupHeight - popupGap, anchorY - popupHeight));
|
||||
return Math.max(edgeGapTop, Math.min(screenHeight - popupHeight - popupGap, anchorY - popupHeight));
|
||||
case SettingsData.Position.Top:
|
||||
// bar on top: top side is bar-adjacent (popupGap), bottom side is frame-perpendicular (edgeGap)
|
||||
return Math.max(popupGap, Math.min(screenHeight - popupHeight - edgeGap, anchorY));
|
||||
return Math.max(popupGap, Math.min(screenHeight - popupHeight - edgeGapBottom, anchorY));
|
||||
default:
|
||||
const rawY = triggerY - (popupHeight / 2);
|
||||
const minY = Math.max(edgeGap, adjacentBarClearance(adjacentBarInfo.topBar));
|
||||
const maxY = screenHeight - popupHeight - Math.max(edgeGap, adjacentBarClearance(adjacentBarInfo.bottomBar));
|
||||
const minY = Math.max(edgeGapTop, adjacentBarClearance(adjacentBarInfo.topBar));
|
||||
const maxY = screenHeight - popupHeight - Math.max(edgeGapBottom, adjacentBarClearance(adjacentBarInfo.bottomBar));
|
||||
return Math.max(minY, Math.min(maxY, rawY));
|
||||
}
|
||||
})(), dpr)
|
||||
|
||||
Reference in New Issue
Block a user