Commit e2c1be9 皆虚
committed
1 parent 090e88b commit e2c1be9 Copy full SHA for e2c1be9
File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -178,8 +178,15 @@ export default class Position {
178
178
if ( this . _isInViewport ( pinElement , align ) ) {
179
179
return align ;
180
180
} else if ( ! firstPositionResult ) {
181
- const { right, bottom } = this . _getViewportOffset ( pinElement , align ) ;
182
- firstPositionResult = { left : right < 0 ? left + right : left , top : top < 0 ? top + bottom : top } ;
181
+ if ( this . needAdjust && ! this . autoFit ) {
182
+ const { right, bottom } = this . _getViewportOffset ( pinElement , align ) ;
183
+ firstPositionResult = {
184
+ left : right < 0 ? left + right : left ,
185
+ top : bottom < 0 ? top + bottom : top ,
186
+ } ;
187
+ } else {
188
+ firstPositionResult = { left, top } ;
189
+ }
183
190
}
184
191
}
185
192
Original file line number Diff line number Diff line change @@ -600,6 +600,7 @@ describe('Overlay', () => {
600
600
< div
601
601
style = { {
602
602
width : '200px' ,
603
+ height : '100vh' ,
603
604
background : 'red' ,
604
605
} }
605
606
>
@@ -615,6 +616,7 @@ describe('Overlay', () => {
615
616
document . querySelector ( '.next-overlay-inner' ) . style . left ===
616
617
`${ parseFloat ( window . getComputedStyle ( document . body ) . width ) - 200 - 1 } px` // Reason to subtract 1, see: Overly._isInViewport
617
618
) ;
619
+ assert ( document . querySelector ( '.next-overlay-inner' ) . style . top === '0px' ) ;
618
620
container . remove ( ) ;
619
621
document . querySelector ( '.next-overlay-wrapper' ) . remove ( ) ;
620
622
} ) ;
You can’t perform that action at this time.
0 commit comments