Skip to content

Commit 013704c

Browse files
committed
fix(popup): fixed avoidRepositioning prop not working
1 parent ccb4de7 commit 013704c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/LibPopup/LibPopup.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@mousedown.self="handleMouseup"
2121
>
2222
<div v-if="useBackdrop || modelValue"
23-
:class="`fixed ${props.onlyShiftIfOpen ? 'transition-position' : ''}`"
23+
:class="`fixed ${props.avoidRepositioning ? 'transition-[top,left]' : ''}`"
2424
:style="`
2525
top:${pos.y}px;
2626
left:${pos.x}px;
@@ -55,7 +55,7 @@ const props = withDefaults(defineProps<Props>(), {
5555
// vue is getting confused when the prop type can also be a function
5656
preferredHorizontal: () => ["center", "right", "left", "either"] as any as ["center", "right", "left", "either"],
5757
preferredVertical: () => ["top", "bottom", "either"] as any as ["top", "bottom", "either"],
58-
onlyShiftIfOpen: false,
58+
avoidRepositioning: false,
5959
})
6060
const $attrs = useAttrs()
6161
defineOptions({ name: "lib-popup" })
@@ -113,7 +113,7 @@ const recompute = (force: boolean = false): void => {
113113
let finalPos: { x: number, y: number, maxWidth?: number, maxHeight?: number } = {} as any
114114
115115
116-
if (!force && modelValue.value && props.onlyShiftIfOpen && buttonEl.value && lastButtonElPos) {
116+
if (!force && modelValue.value && props.avoidRepositioning && buttonEl.value && lastButtonElPos) {
117117
const shiftX = buttonEl.value.getBoundingClientRect().x - lastButtonElPos.x
118118
const shiftY = buttonEl.value.getBoundingClientRect().y - lastButtonElPos.y
119119

0 commit comments

Comments
 (0)