|
20 | 20 | @mousedown.self="handleMouseup" |
21 | 21 | > |
22 | 22 | <div v-if="useBackdrop || modelValue" |
23 | | - :class="`fixed ${props.onlyShiftIfOpen ? 'transition-position' : ''}`" |
| 23 | + :class="`fixed ${props.avoidRepositioning ? 'transition-[top,left]' : ''}`" |
24 | 24 | :style="` |
25 | 25 | top:${pos.y}px; |
26 | 26 | left:${pos.x}px; |
@@ -55,7 +55,7 @@ const props = withDefaults(defineProps<Props>(), { |
55 | 55 | // vue is getting confused when the prop type can also be a function |
56 | 56 | preferredHorizontal: () => ["center", "right", "left", "either"] as any as ["center", "right", "left", "either"], |
57 | 57 | preferredVertical: () => ["top", "bottom", "either"] as any as ["top", "bottom", "either"], |
58 | | - onlyShiftIfOpen: false, |
| 58 | + avoidRepositioning: false, |
59 | 59 | }) |
60 | 60 | const $attrs = useAttrs() |
61 | 61 | defineOptions({ name: "lib-popup" }) |
@@ -113,7 +113,7 @@ const recompute = (force: boolean = false): void => { |
113 | 113 | let finalPos: { x: number, y: number, maxWidth?: number, maxHeight?: number } = {} as any |
114 | 114 |
|
115 | 115 |
|
116 | | - if (!force && modelValue.value && props.onlyShiftIfOpen && buttonEl.value && lastButtonElPos) { |
| 116 | + if (!force && modelValue.value && props.avoidRepositioning && buttonEl.value && lastButtonElPos) { |
117 | 117 | const shiftX = buttonEl.value.getBoundingClientRect().x - lastButtonElPos.x |
118 | 118 | const shiftY = buttonEl.value.getBoundingClientRect().y - lastButtonElPos.y |
119 | 119 |
|
|
0 commit comments