Browse Source

feat(VideoContainer) add option to avoid cropping focused video

master
adam j hartz 3 years ago
parent
commit
70b369a1af
No account linked to committer's email address
2 changed files with 10 additions and 2 deletions
  1. 2
    1
      interface_config.js
  2. 8
    1
      modules/UI/videolayout/VideoContainer.js

+ 2
- 1
interface_config.js View File

224
     // Determines how the video would fit the screen. 'both' would fit the whole
224
     // Determines how the video would fit the screen. 'both' would fit the whole
225
     // screen, 'height' would fit the original video height to the height of the
225
     // screen, 'height' would fit the original video height to the height of the
226
     // screen, 'width' would fit the original video width to the width of the
226
     // screen, 'width' would fit the original video width to the width of the
227
-    // screen respecting ratio.
227
+    // screen respecting ratio, 'nocrop' would make the video as large as
228
+    // possible and preserve aspect ratio without cropping.
228
     VIDEO_LAYOUT_FIT: 'both',
229
     VIDEO_LAYOUT_FIT: 'both',
229
 
230
 
230
     /**
231
     /**

+ 8
- 1
modules/UI/videolayout/VideoContainer.js View File

98
     }
98
     }
99
 
99
 
100
     const aspectRatio = videoWidth / videoHeight;
100
     const aspectRatio = videoWidth / videoHeight;
101
+    const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
101
 
102
 
102
     switch (videoLayoutFit) {
103
     switch (videoLayoutFit) {
103
     case 'height':
104
     case 'height':
104
         return [ videoSpaceHeight * aspectRatio, videoSpaceHeight ];
105
         return [ videoSpaceHeight * aspectRatio, videoSpaceHeight ];
105
     case 'width':
106
     case 'width':
106
         return [ videoSpaceWidth, videoSpaceWidth / aspectRatio ];
107
         return [ videoSpaceWidth, videoSpaceWidth / aspectRatio ];
108
+    case 'nocrop':
109
+        return computeCameraVideoSize(
110
+            videoWidth,
111
+            videoHeight,
112
+            videoSpaceWidth,
113
+            videoSpaceHeight,
114
+            videoSpaceRatio < aspectRatio ? 'width' : 'height');
107
     case 'both': {
115
     case 'both': {
108
-        const videoSpaceRatio = videoSpaceWidth / videoSpaceHeight;
109
         const maxZoomCoefficient = interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT
116
         const maxZoomCoefficient = interfaceConfig.MAXIMUM_ZOOMING_COEFFICIENT
110
             || Infinity;
117
             || Infinity;
111
 
118
 

Loading…
Cancel
Save