if width/height don't evaluate to an integer, set to auto.

pull/3001/head
Isaac Connor 2020-07-04 08:58:09 -04:00
parent 697f117ecd
commit fd10f545bd
1 changed files with 8 additions and 12 deletions

View File

@ -285,8 +285,8 @@ function selectLayout(element) {
* called when the widthControl|heightControl select elements are changed * called when the widthControl|heightControl select elements are changed
*/ */
function changeSize() { function changeSize() {
var width = $('width').get('value'); var width = parseInt($('width').get('value'));
var height = $('height').get('value'); var height = parseInt($('height').get('value'));
for ( var i = 0, length = monitors.length; i < length; i++ ) { for ( var i = 0, length = monitors.length; i < length; i++ ) {
var monitor = monitors[i]; var monitor = monitors[i];
@ -297,12 +297,8 @@ function changeSize() {
console.log("Error finding frame for " + monitor.id); console.log("Error finding frame for " + monitor.id);
continue; continue;
} }
if ( width ) { monitor_frame.css('width', ( width ? width+'px' : 'auto') );
monitor_frame.css('width', width); monitor_frame.css('height', ( height ? height+'px' : 'auto') );
}
if ( height ) {
monitor_frame.css('height', height);
}
/*Stream could be an applet so can't use moo tools*/ /*Stream could be an applet so can't use moo tools*/
var streamImg = $('liveStream'+monitor.id); var streamImg = $('liveStream'+monitor.id);
@ -315,8 +311,8 @@ function changeSize() {
src = src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) )); src = src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
streamImg.src = src; streamImg.src = src;
} }
streamImg.style.width = width ? width : null; streamImg.style.width = width ? width+'px' : null;
streamImg.style.height = height ? height : null; streamImg.style.height = height ? height+'px' : null;
//streamImg.style.height = ''; //streamImg.style.height = '';
} }
} }
@ -383,8 +379,8 @@ function changeScale() {
streamImg.src = src; streamImg.src = src;
} }
if ( scale != '0' ) { if ( scale != '0' ) {
streamImg.style.width = newWidth + "px"; streamImg.style.width = newWidth + 'px';
streamImg.style.height = newHeight + "px"; streamImg.style.height = newHeight + 'px';
} else { } else {
streamImg.style.width = '100%'; streamImg.style.width = '100%';
streamImg.style.height = 'auto'; streamImg.style.height = 'auto';