Skip to content

Commit

Permalink
added constants and changed the setting of the dimensions based on ob…
Browse files Browse the repository at this point in the history
…ject-fit
  • Loading branch information
fmiccolis committed Oct 1, 2022
1 parent 68b9507 commit 58eed50
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ const photoBooth = (function () {
DEVICE: 'device_cam',
URL: 'url'
},
PreviewStyle = {
FILL: 'fill',
CONTAIN: 'contain',
COVER: 'cover',
NONE: 'none',
SCALE_DOWN: 'scale-down'
},
CollageFrameMode = {
OFF: 'off',
ALWAYS: 'always',
Expand Down Expand Up @@ -1416,11 +1423,17 @@ const photoBooth = (function () {
}

idVideoView.on("loadedmetadata", function(ev) {
let videoEl = ev.target;
idPictureFrame.css("width", videoEl.videoWidth);
idPictureFrame.css("height", videoEl.videoHeight);
idCollageFrame.css("width", videoEl.videoWidth);
idCollageFrame.css("height", videoEl.videoHeight);
const videoEl = ev.target;
let newWidth = videoEl.offsetWidth;
let newHeight = videoEl.offsetHeight;
if(config.preview.style === PreviewStyle.SCALE_DOWN) {
newWidth = videoEl.videoWidth;
newHeight = videoEl.videoHeight;
}
idPictureFrame.css("width", newWidth);
idPictureFrame.css("height", newHeight);
idCollageFrame.css("width", newWidth);
idCollageFrame.css("height", newHeight);
});

return api;
Expand Down

0 comments on commit 58eed50

Please sign in to comment.