yet-another-react-lightbox 3.5.2 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,16 +30,20 @@ export function VideoSlide({ slide, offset }) {
30
30
  }, [handleVideoRef]);
31
31
  const { width, height, poster, sources } = slide;
32
32
  const scaleWidthAndHeight = () => {
33
- if (!width || !height || !containerRect)
34
- return null;
35
- const widthBound = width / height > containerRect.width / containerRect.height;
36
- const elementWidth = widthBound ? containerRect.width : Math.round((containerRect.height / height) * width);
37
- const elementHeight = !widthBound ? containerRect.height : Math.round((containerRect.width / width) * height);
38
- return {
39
- width: elementWidth,
40
- height: elementHeight,
41
- style: { width: elementWidth, height: elementHeight, maxWidth: "100%", maxHeight: "100%" },
42
- };
33
+ const scalingProps = {};
34
+ scalingProps.style = { maxWidth: "100%", maxHeight: "100%" };
35
+ if (width && height && containerRect) {
36
+ const widthBound = width / height > containerRect.width / containerRect.height;
37
+ const elementWidth = widthBound ? containerRect.width : Math.round((containerRect.height / height) * width);
38
+ const elementHeight = !widthBound
39
+ ? containerRect.height
40
+ : Math.round((containerRect.width / width) * height);
41
+ scalingProps.width = elementWidth;
42
+ scalingProps.height = elementHeight;
43
+ scalingProps.style.width = elementWidth;
44
+ scalingProps.style.height = elementHeight;
45
+ }
46
+ return scalingProps;
43
47
  };
44
48
  const resolveBoolean = (attr) => {
45
49
  if (slide[attr] === false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",