mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-24 01:51:57 +03:00
Popup menus: update fixed margins to relative untis (#4279)
This commit is contained in:
parent
4acff2ba46
commit
c9f803fda3
@ -26,7 +26,6 @@
|
||||
}: Props = $props();
|
||||
|
||||
// LOCAL VARS
|
||||
let menuMargin = 4;
|
||||
|
||||
// STATES
|
||||
let item = $state<any>();
|
||||
@ -70,12 +69,10 @@
|
||||
|
||||
function setVerticalAlign(targetBoundingRect: DOMRect) {
|
||||
if (verticalAlign === 'top') {
|
||||
return targetBoundingRect?.top ? targetBoundingRect.top - contextMenuHeight - menuMargin : 0;
|
||||
return targetBoundingRect?.top ? targetBoundingRect.top - contextMenuHeight : 0;
|
||||
}
|
||||
|
||||
return targetBoundingRect?.top
|
||||
? targetBoundingRect.top + targetBoundingRect.height + menuMargin
|
||||
: 0;
|
||||
return targetBoundingRect?.top ? targetBoundingRect.top + targetBoundingRect.height : 0;
|
||||
}
|
||||
|
||||
function setHorizontalAlign(targetBoundingRect: DOMRect) {
|
||||
@ -130,6 +127,8 @@
|
||||
bind:offsetHeight={contextMenuHeight}
|
||||
bind:offsetWidth={contextMenuWidth}
|
||||
class="context-menu"
|
||||
class:top-oriented={verticalAlign === 'top'}
|
||||
class:bottom-oriented={verticalAlign === 'bottom'}
|
||||
style:top="{menuPosition.y}px"
|
||||
style:left="{menuPosition.x}px"
|
||||
style:transform-origin={setTransformOrigin()}
|
||||
@ -166,6 +165,14 @@
|
||||
/* background-color: rgba(0, 0, 0, 0.1); */
|
||||
}
|
||||
|
||||
.top-oriented {
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
.bottom-oriented {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.context-menu {
|
||||
z-index: var(--z-blocker);
|
||||
position: fixed;
|
||||
|
@ -151,7 +151,7 @@
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
z-index: var(--z-floating);
|
||||
margin-top: 6px;
|
||||
margin-top: 4px;
|
||||
border-radius: var(--m, 6px);
|
||||
border: 1px solid var(--clr-border-2);
|
||||
background: var(--clr-bg-1);
|
||||
|
Loading…
Reference in New Issue
Block a user