File tree Expand file tree Collapse file tree 6 files changed +22
-1
lines changed
Expand file tree Collapse file tree 6 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -142,4 +142,6 @@ export interface VideomailEvents {
142142 VALIDATING : ( params ?: ValidatingParams ) => void ;
143143 // document just became visible
144144 VISIBLE : ( ) => void ;
145+ // when window's inner width has changed
146+ WINDOW_RESIZE : ( ) => void ;
145147}
Original file line number Diff line number Diff line change 11import { Dimension } from "../../../types/dimension" ;
22
3- // TODO Implement event listener when viewport width has changed to reconfigure dimensions
43function useFullWidth ( mobileBreakPoint ?: number ) {
54 if ( mobileBreakPoint === undefined ) {
65 return undefined ;
Original file line number Diff line number Diff line change @@ -236,6 +236,10 @@ class Container extends Despot {
236236 private initEvents ( playerOnly = false ) {
237237 this . options . logger . debug ( `Container: initEvents (playerOnly = ${ playerOnly } )` ) ;
238238
239+ window . addEventListener ( "resize" , ( ) => {
240+ this . emit ( "WINDOW_RESIZE" ) ;
241+ } ) ;
242+
239243 if ( this . options . enableAutoUnload ) {
240244 window . addEventListener (
241245 "beforeunload" ,
@@ -319,6 +323,10 @@ class Container extends Despot {
319323 }
320324 } ) ;
321325
326+ this . on ( "WINDOW_RESIZE" , ( ) => {
327+ this . correctDimensions ( ) ;
328+ } ) ;
329+
322330 if ( ! playerOnly ) {
323331 this . on ( "LOADED_META_DATA" , ( ) => {
324332 this . correctDimensions ( ) ;
Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ class Visuals extends Despot {
108108 this . removeDimensions ( ) ;
109109 }
110110 } ) ;
111+
112+ this . on ( "WINDOW_RESIZE" , ( ) => {
113+ this . correctDimensions ( ) ;
114+ } ) ;
111115 }
112116 }
113117
Original file line number Diff line number Diff line change @@ -148,6 +148,10 @@ class Notifier extends Despot {
148148 this . hide ( ) ;
149149 }
150150 } ) ;
151+
152+ this . on ( "WINDOW_RESIZE" , ( ) => {
153+ this . correctNotifierDimensions ( ) ;
154+ } ) ;
151155 }
152156
153157 private correctNotifierDimensions ( ) {
Original file line number Diff line number Diff line change @@ -1414,6 +1414,10 @@ class Recorder extends Despot {
14141414 this . on ( "SWITCH_FACING_MODE" , ( ) => {
14151415 this . switchFacingMode ( ) ;
14161416 } ) ;
1417+
1418+ this . on ( "WINDOW_RESIZE" , ( ) => {
1419+ this . correctDimensions ( ) ;
1420+ } ) ;
14171421 }
14181422
14191423 private buildElement ( ) {
You can’t perform that action at this time.
0 commit comments