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