File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/utils/src/popper Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -703,17 +703,18 @@ export class PopperJS {
703
703
let center = reference [ side ] + ( arrowOffset || reference [ calcProp ] / 2 - arrowSize / 2 )
704
704
let sideValue = center - popper [ side ]
705
705
706
- // 猜测是上下边距留下8px的距离。 确保箭头不太靠顶靠底。
707
- // 此时sideValue为“popper的顶- 箭头 - 8px” 的位置。
708
- sideValue = Math . max ( Math . min ( popper [ calcProp ] - arrowSize - 8 , sideValue ) , 8 )
706
+ // 猜测是上下边距留下4px的距离。 确保箭头不太靠顶靠底。
707
+ // 此时sideValue为“popper的顶- 箭头 - 4px” 的位置。
708
+ const safeLeft = 4
709
+ sideValue = Math . max ( Math . min ( popper [ calcProp ] - arrowSize - safeLeft , sideValue ) , safeLeft )
709
710
arrowStyle [ side ] = sideValue
710
711
arrowStyle [ altSide ] = ''
711
712
712
713
// adjustArrow此处还要校正一下,但不明白为什么只校正left, 不校正top的位置?
713
714
const params = this . _options . placement . split ( '-' )
714
715
if ( this . _options . adjustArrow && ~ [ 'top' , 'bottom' ] . indexOf ( params [ 0 ] ) && side === 'left' ) {
715
716
if ( params [ 1 ] === 'start' ) {
716
- arrowStyle . left = 8
717
+ arrowStyle . left = safeLeft
717
718
} else if ( ! params [ 1 ] ) {
718
719
arrowStyle . left = ( popperRect . width - arrowRect . width ) / 2
719
720
}
You can’t perform that action at this time.
0 commit comments