Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
optimize canvas size on chroma keying and live keying
Browse files Browse the repository at this point in the history
Change-Id: I1ece90a1cebe0df45c53d78f4e0218494529daad
  • Loading branch information
andi34 committed Dec 19, 2020
1 parent cbf2f18 commit 0093ff5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion chromakeying.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<body data-main-image="<?=$mainimage?>">
<div class="chromawrapper">
<?php if ($keying_possible): ?>
<div class="canvasWrapper">
<div class="canvasWrapper initial">
<canvas id="mainCanvas"></canvas>
</div>

Expand Down
2 changes: 1 addition & 1 deletion livechroma.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

</div>

<div class="canvasWrapper">
<div class="canvasWrapper initial">
<canvas id="mainCanvas"></canvas>
</div>

Expand Down
1 change: 1 addition & 0 deletions src/js/chromakeying.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,5 @@ $(document).ready(function () {

$('#mainCanvas').css('height', canvasHeight - diff + 'px');
}
$('.canvasWrapper').removeClass('initial');
});
1 change: 1 addition & 0 deletions src/js/livechroma.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ function saveImage(cb) {
}

$('.backgroundPreview').on('click', function () {
$('.canvasWrapper').removeClass('initial');
if ($('.chroma-control-bar').is(':hidden')) {
$('.chroma-control-bar').show();
$('.chromaNote').empty();
Expand Down
5 changes: 4 additions & 1 deletion src/sass/chromakeying.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
}

.canvasWrapper {
width: 1000px;
display: inline-block;
max-width: 100%;
background-color: green;
border: 4px solid $borderColor;
&.initial {
width: 1000px;
}
}

#mainCanvas {
display: block;
max-height: 650px;
max-width: 100%;
}

Expand Down
20 changes: 16 additions & 4 deletions src/sass/live_chromakeying.scss
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@
position: absolute;
top: 40px;
right: 0;
width: 950px;
max-width: 100%;
max-width: 950px;
max-height: 100%;
border: 4px solid $borderColor;
&.initial {
width: 950px;
}
}

.takeChroma,
Expand Down Expand Up @@ -260,6 +262,10 @@
bottom: 0;
width: 250px;
}

#mainCanvas {
max-height: 100%;
}
}

@media (max-height: 740px) and (orientation: landscape) {
Expand All @@ -273,13 +279,19 @@
@media (max-width: 1200px) and (orientation: landscape) {
.canvasWrapper,
.chromaNote {
width: 750px;
max-width: 750px;
&.initial {
width: 750px;
}
}
}

@media (max-width: 1000px) and (orientation: landscape) {
.canvasWrapper,
.chromaNote {
width: 650px;
max-width: 650px;
&.initial {
width: 650px;
}
}
}

0 comments on commit 0093ff5

Please sign in to comment.