hefty: bar: fix weird popup shape when smaller than container

This commit is contained in:
end-4
2026-03-09 23:27:52 +01:00
parent 6bd6f30a5e
commit 4e162bd8a6
@@ -111,12 +111,12 @@ Shapes.ShapeCanvas {
} }
color: bgShape.showPopup || progress < 1 ? C.Appearance.colors.colLayer3Base : C.Appearance.colors.colLayer1 color: bgShape.showPopup || progress < 1 ? C.Appearance.colors.colLayer3Base : C.Appearance.colors.colLayer1
xOffset: { xOffset: {
if (!vertical) return showPopup ? -popupXOffset : 0; if (!vertical) return showPopup ? Math.max(-popupXOffset, 0) : 0;
else return bgShape.atBottom ? (width - containerShape.width) : 0; else return bgShape.atBottom ? (width - containerShape.width) : 0;
} }
yOffset: { yOffset: {
if (!vertical) return bgShape.atBottom ? (height - containerShape.height) : 0; if (!vertical) return bgShape.atBottom ? (height - containerShape.height) : 0;
else return showPopup ? -popupYOffset : 0; else return showPopup ? Math.max(-popupYOffset, 0) : 0;
} }
animation: Anim {} animation: Anim {}
@@ -161,64 +161,64 @@ Shapes.ShapeCanvas {
roundedPolygon: { roundedPolygon: {
var points = []; var points = [];
if (!bgShape.showPopup) return containerShape.getFullShape(); if (!bgShape.showPopup) return containerShape.getFullShape();
if (!bgShape.vertical) {
const joinRadiusOverride = containerShape.radiusLimit;
if (!bgShape.vertical) {
const popupBigger = bgShape.popupWidth > bgShape.backgroundWidth;
// Inline comment spam to mitigate qmlls' sabotaging of the (code) layout // Inline comment spam to mitigate qmlls' sabotaging of the (code) layout
points = [ points = [
...(bgShape.atBottom ? containerShape.getFirstBottomPoints() : [ // ...(bgShape.atBottom ? containerShape.getFirstBottomPoints() : [ //
...popupShape.getFirstBottomPoints(), popupShape.getBottomLeftPoint(), // ...popupShape.getFirstBottomPoints(), popupShape.getBottomLeftPoint(), //
...popupShape.leftPoints, // ...popupShape.leftPoints, //
popupShape.getTopLeftPoint(), // popupShape.getTopLeftPoint(0, -bgShape.spacing * (!popupBigger), joinRadiusOverride), //
]), // ]), //
containerShape.getBottomLeftPoint(0, bgShape.spacing * (!bgShape.atBottom ? 1 : 0), containerShape.radiusLimit), // containerShape.getBottomLeftPoint(0, bgShape.spacing * (!bgShape.atBottom && popupBigger), joinRadiusOverride), //
containerShape.getTopLeftPoint(0, bgShape.spacing * (bgShape.atBottom ? -1 : 0), containerShape.radiusLimit), // containerShape.getTopLeftPoint(0, -bgShape.spacing * (bgShape.atBottom && popupBigger), joinRadiusOverride), //
...(!bgShape.atBottom ? containerShape.topPoints : [ // ...(!bgShape.atBottom ? containerShape.topPoints : [ //
popupShape.getBottomLeftPoint(), // popupShape.getBottomLeftPoint(0, bgShape.spacing * (!popupBigger), joinRadiusOverride), //
...popupShape.leftPoints, // ...popupShape.leftPoints, //
popupShape.getTopLeftPoint(), // popupShape.getTopLeftPoint(), //
...popupShape.topPoints, // ...popupShape.topPoints, //
popupShape.getTopRightPoint(), // popupShape.getTopRightPoint(), //
...popupShape.rightPoints, // ...popupShape.rightPoints, //
popupShape.getBottomRightPoint(), // popupShape.getBottomRightPoint(0, bgShape.spacing * (!popupBigger), joinRadiusOverride), //
]), // ]), //
containerShape.getTopRightPoint(0, bgShape.spacing * (bgShape.atBottom ? -1 : 0), containerShape.radiusLimit), // containerShape.getTopRightPoint(0, -bgShape.spacing * (bgShape.atBottom && popupBigger), joinRadiusOverride), //
containerShape.getBottomRightPoint(0, bgShape.spacing * (!bgShape.atBottom ? 1 : 0), containerShape.radiusLimit), // containerShape.getBottomRightPoint(0, bgShape.spacing * (!bgShape.atBottom && popupBigger), joinRadiusOverride), //
...(bgShape.atBottom ? containerShape.getLastBottomPoints() : [ // ...(bgShape.atBottom ? containerShape.getLastBottomPoints() : [ //
popupShape.getTopRightPoint(), // popupShape.getTopRightPoint(0, -bgShape.spacing * (!popupBigger), joinRadiusOverride), //
...popupShape.rightPoints, // ...popupShape.rightPoints, //
popupShape.getBottomRightPoint(), // popupShape.getBottomRightPoint(), //
...popupShape.getLastBottomPoints(), // ...popupShape.getLastBottomPoints(), //
]), ]),
]; ];
} else { } else {
const popupBigger = bgShape.popupHeight > bgShape.backgroundHeight;
points = [ // points = [ //
...containerShape.getFirstBottomPoints(), // ...containerShape.getFirstBottomPoints(), //
containerShape.getBottomLeftPoint(), // containerShape.getBottomLeftPoint(-bgShape.spacing * (popupBigger && bgShape.atBottom), 0, joinRadiusOverride), //
...(!bgShape.atBottom ? containerShape.leftPoints : [ // ...(!bgShape.atBottom ? containerShape.leftPoints : [ //
containerShape.getBottomLeftPoint(-bgShape.spacing, 0, containerShape.radiusLimit), // popupShape.getBottomRightPoint(bgShape.spacing * (!popupBigger)), //
popupShape.getBottomRightPoint(), //
...popupShape.bottomPoints, // ...popupShape.bottomPoints, //
popupShape.getBottomLeftPoint(), // popupShape.getBottomLeftPoint(), //
...popupShape.leftPoints, // ...popupShape.leftPoints, //
popupShape.getTopLeftPoint(), // popupShape.getTopLeftPoint(), //
...popupShape.topPoints, // ...popupShape.topPoints, //
popupShape.getTopRightPoint(), // popupShape.getTopRightPoint(bgShape.spacing * (!popupBigger)), //
containerShape.getTopLeftPoint(-bgShape.spacing, 0, containerShape.radiusLimit), //
]), // ]), //
containerShape.getTopLeftPoint(), // containerShape.getTopLeftPoint(-bgShape.spacing * (popupBigger && bgShape.atBottom), 0, joinRadiusOverride), //
...containerShape.topPoints, // ...containerShape.topPoints, //
containerShape.getTopRightPoint(), // containerShape.getTopRightPoint(bgShape.spacing * (popupBigger && !bgShape.atBottom), 0, joinRadiusOverride), //
...(bgShape.atBottom ? containerShape.rightPoints : [ // ...(bgShape.atBottom ? containerShape.rightPoints : [ //
containerShape.getTopRightPoint(bgShape.spacing, 0, containerShape.radiusLimit), // popupShape.getTopLeftPoint(-bgShape.spacing * (!popupBigger), 0, joinRadiusOverride), //
popupShape.getTopLeftPoint(), //
...popupShape.topPoints, // ...popupShape.topPoints, //
popupShape.getTopRightPoint(), // popupShape.getTopRightPoint(), //
...popupShape.rightPoints, // ...popupShape.rightPoints, //
popupShape.getBottomRightPoint(), // popupShape.getBottomRightPoint(), //
...popupShape.bottomPoints, // ...popupShape.bottomPoints, //
popupShape.getBottomLeftPoint(), // popupShape.getBottomLeftPoint(-bgShape.spacing * (!popupBigger), 0, joinRadiusOverride), //
containerShape.getBottomRightPoint(bgShape.spacing, 0, containerShape.radiusLimit), //
]), // ]), //
containerShape.getBottomRightPoint(), // containerShape.getBottomRightPoint(bgShape.spacing * (popupBigger && !bgShape.atBottom), 0, joinRadiusOverride), //
...containerShape.getLastBottomPoints(), // ...containerShape.getLastBottomPoints(), //
]; ];
} }