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

Commit fc6cdeb

Browse files
committed
optimize canvas size on chroma keying and live keying
Change-Id: I1ece90a1cebe0df45c53d78f4e0218494529daad
1 parent afdf6da commit fc6cdeb

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

chromakeying.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<body data-main-image="<?=$mainimage?>">
5454
<div class="chromawrapper">
5555
<?php if ($keying_possible): ?>
56-
<div class="canvasWrapper">
56+
<div class="canvasWrapper initial">
5757
<canvas id="mainCanvas"></canvas>
5858
</div>
5959

livechroma.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
</div>
5151

52-
<div class="canvasWrapper">
52+
<div class="canvasWrapper initial">
5353
<canvas id="mainCanvas"></canvas>
5454
</div>
5555

src/js/chromakeying.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,5 @@ $(document).ready(function () {
323323

324324
$('#mainCanvas').css('height', canvasHeight - diff + 'px');
325325
}
326+
$('.canvasWrapper').removeClass('initial');
326327
});

src/js/livechroma.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ function saveImage(cb) {
250250
}
251251

252252
$('.backgroundPreview').on('click', function () {
253+
$('.canvasWrapper').removeClass('initial');
253254
if ($('.chroma-control-bar').is(':hidden')) {
254255
$('.chroma-control-bar').show();
255256
$('.chromaNote').empty();

src/sass/chromakeying.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@
2121
}
2222

2323
.canvasWrapper {
24-
width: 1000px;
2524
display: inline-block;
2625
max-width: 100%;
2726
background-color: green;
2827
border: 4px solid $borderColor;
28+
&.initial {
29+
width: 1000px;
30+
}
2931
}
3032

3133
#mainCanvas {
3234
display: block;
35+
max-height: 650px;
3336
max-width: 100%;
3437
}
3538

src/sass/live_chromakeying.scss

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,12 @@
196196
position: absolute;
197197
top: 40px;
198198
right: 0;
199-
width: 950px;
200-
max-width: 100%;
199+
max-width: 950px;
201200
max-height: 100%;
202201
border: 4px solid $borderColor;
202+
&.initial {
203+
width: 950px;
204+
}
203205
}
204206

205207
.takeChroma,
@@ -260,6 +262,10 @@
260262
bottom: 0;
261263
width: 250px;
262264
}
265+
266+
#mainCanvas {
267+
max-height: 100%;
268+
}
263269
}
264270

265271
@media (max-height: 740px) and (orientation: landscape) {
@@ -273,13 +279,19 @@
273279
@media (max-width: 1200px) and (orientation: landscape) {
274280
.canvasWrapper,
275281
.chromaNote {
276-
width: 750px;
282+
max-width: 750px;
283+
&.initial {
284+
width: 750px;
285+
}
277286
}
278287
}
279288

280289
@media (max-width: 1000px) and (orientation: landscape) {
281290
.canvasWrapper,
282291
.chromaNote {
283-
width: 650px;
292+
max-width: 650px;
293+
&.initial {
294+
width: 650px;
295+
}
284296
}
285297
}

0 commit comments

Comments
 (0)