@@ -107,18 +107,21 @@ const availableArea = (
107107 PREVIEW_MINI_PLAYER_EDGE_GAP * 2 ,
108108} ) ;
109109
110+ const minimumPreviewMiniPlayerWidth = ( source : PreviewMiniPlayerSize ) =>
111+ Math . max (
112+ PREVIEW_MINI_PLAYER_MIN_SIZE . width ,
113+ ( PREVIEW_MINI_PLAYER_MIN_SIZE . height * source . width ) / source . height ,
114+ ) ;
115+
110116function fitPreviewMiniPlayerWidth (
111117 desiredWidth : number ,
112118 source : PreviewMiniPlayerSize ,
113119 max : PreviewMiniPlayerSize ,
120+ minimumWidth = minimumPreviewMiniPlayerWidth ( source ) ,
114121) : PreviewMiniPlayerSize {
115122 const aspectRatio = source . width / source . height ;
116123 const width = Math . min (
117- Math . max (
118- desiredWidth ,
119- PREVIEW_MINI_PLAYER_MIN_SIZE . width ,
120- PREVIEW_MINI_PLAYER_MIN_SIZE . height * aspectRatio ,
121- ) ,
124+ Math . max ( desiredWidth , minimumWidth ) ,
122125 Math . max ( 1 , max . width ) ,
123126 Math . max ( 1 , max . height * aspectRatio ) ,
124127 ) ;
@@ -244,6 +247,7 @@ export function resolvePreviewMiniPlayerFrame(input: {
244247 position && width ? { composer : obstacles . composer , detailsCard : null } : obstacles ,
245248 position && width ? spanOf ( position . x , width ) : null ,
246249 ) ,
250+ width ?? undefined ,
247251 ) ;
248252 const { detailsCard } = obstacles ;
249253 const anchored =
@@ -307,7 +311,12 @@ export function resizePreviewMiniPlayer(input: {
307311 : horizontal
308312 ? desiredWidth
309313 : desiredHeight * aspectRatio ;
310- const size = fitPreviewMiniPlayerWidth ( desired , source , max ) ;
314+ const size = fitPreviewMiniPlayerWidth (
315+ desired ,
316+ source ,
317+ max ,
318+ Math . min ( start . width , minimumPreviewMiniPlayerWidth ( source ) ) ,
319+ ) ;
311320 const position = clampPreviewMiniPlayerPosition (
312321 { x : west ? right - size . width : start . x , y : north ? bottom - size . height : start . y } ,
313322 container ,
0 commit comments