Merge branch 'remove-extra-px' of https://github.com/tolland/zoneminder into tolland-remove-extra-px

pull/2725/head
Isaac Connor 2019-06-20 13:28:24 -04:00
commit 71eadfc40e
2 changed files with 15 additions and 16 deletions

View File

@ -204,6 +204,11 @@ function Monitor(monitorData) {
} }
} // end function Monitor } // end function Monitor
/**
* called when the layoutControl select element is changed, or the page
* is rendered
* @return null
*/
function selectLayout(element) { function selectLayout(element) {
layout = $j(element).val(); layout = $j(element).val();
@ -266,14 +271,14 @@ function selectLayout(element) {
} }
streamImg.style.width = '100%'; streamImg.style.width = '100%';
} }
var zonesSVG = $('zones'+monitor.id);
if ( zonesSVG ) {
zonesSVG.style.width = '';
}
} // end foreach monitor } // end foreach monitor
} }
} // end function selectLayout(element) } // end function selectLayout(element)
/**
* called when the widthControl|heightControl select elements are changed
* @return null
*/
function changeSize() { function changeSize() {
var width = $('width').get('value'); var width = $('width').get('value');
var height = $('height').get('value'); var height = $('height').get('value');
@ -309,11 +314,6 @@ function changeSize() {
streamImg.style.height = height ? height : null; streamImg.style.height = height ? height : null;
//streamImg.style.height = ''; //streamImg.style.height = '';
} }
var zonesSVG = $('zones'+monitor.id);
if ( zonesSVG ) {
zonesSVG.style.width = width ? width : '100%';
zonesSVG.style.height = height;
}
} }
$('scale').set('value', ''); $('scale').set('value', '');
Cookie.write('zmMontageScale', '', {duration: 10*365}); Cookie.write('zmMontageScale', '', {duration: 10*365});
@ -322,6 +322,10 @@ function changeSize() {
selectLayout('#zmMontageLayout'); selectLayout('#zmMontageLayout');
} // end function changeSize() } // end function changeSize()
/**
* called when the scaleControl select element is changed
* @return null
*/
function changeScale() { function changeScale() {
var scale = $('scale').get('value'); var scale = $('scale').get('value');
$('width').set('value', 'auto'); $('width').set('value', 'auto');
@ -367,11 +371,6 @@ function changeScale() {
streamImg.style.width = newWidth + "px"; streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px"; streamImg.style.height = newHeight + "px";
} }
var zonesSVG = $('zones'+monitor.id);
if ( zonesSVG ) {
zonesSVG.style.width = newWidth + "px";
zonesSVG.style.height = newHeight + "px";
}
} }
} }

View File

@ -43,6 +43,7 @@ $widths = array(
$heights = array( $heights = array(
'auto' => 'auto', 'auto' => 'auto',
'240px' => '240px', '240px' => '240px',
'320px' => '320px',
'480px' => '480px', '480px' => '480px',
'720px' => '720px', '720px' => '720px',
'1080px' => '1080px', '1080px' => '1080px',
@ -256,7 +257,6 @@ foreach ( $monitors as $monitor ) {
if ( $scale ) { if ( $scale ) {
limitPoints($row['Points'], 0, 0, $monitor->Width(), $monitor->Height()); limitPoints($row['Points'], 0, 0, $monitor->Width(), $monitor->Height());
scalePoints($row['Points'], $scale);
} else { } else {
limitPoints($row['Points'], 0, 0, limitPoints($row['Points'], 0, 0,
( $width ? $width-1 : $monitor->Width()-1 ), ( $width ? $width-1 : $monitor->Width()-1 ),
@ -269,7 +269,7 @@ foreach ( $monitors as $monitor ) {
} // end foreach Zone } // end foreach Zone
?> ?>
<svg class="zones" id="zones<?php echo $monitor->Id() ?>" style="position:absolute; top: 0; left: 0; background: none; width: <?php echo $width ?>px; height: <?php echo $height ?>px;"> <svg class="zones" id="zones<?php echo $monitor->Id() ?>" style="position:absolute; top: 0; left: 0; background: none; width: 100%; height: 100%;" viewBox="0 0 <?php echo $monitor->Width() ?> <?php echo $monitor->Height() ?>" preserveAspectRatio="none">
<?php <?php
foreach( array_reverse($zones) as $zone ) { foreach( array_reverse($zones) as $zone ) {
echo '<polygon points="'. $zone['AreaCoords'] .'" class="'. $zone['Type'].'" />'; echo '<polygon points="'. $zone['AreaCoords'] .'" class="'. $zone['Type'].'" />';