cleanup, spacing, use zone object methods to clean up svg zone layers

This commit is contained in:
Isaac Connor 2021-12-05 17:49:24 -05:00
parent 089c6044f1
commit 7b66d751d8
1 changed files with 23 additions and 20 deletions

View File

@ -24,6 +24,7 @@ if ( !canView('Stream') ) {
}
require_once('includes/MontageLayout.php');
require_once('includes/Zone.php');
$showControl = false;
$showZones = false;
@ -49,7 +50,6 @@ $heights = array(
'1080' => '1080px',
);
$layouts = ZM\MontageLayout::find(NULL, array('order'=>"lower('Name')"));
$layoutsById = array();
foreach ( $layouts as $l ) {
@ -149,7 +149,7 @@ echo getNavBarHTML();
$html .= '<div class="container-fluid" id="mfbpanel"'.( ( $flip == 'down' ) ? ' style="display:none;"' : '' ) .'>'.PHP_EOL;
echo $html;
?>
<div id="headerButtons">
<div id="headerButtons">
<?php
if ( $showControl ) {
echo makeLink('?view=control', translate('Control'));
@ -237,10 +237,10 @@ foreach ( $monitors as $monitor ) {
$monitor_options['width'] = '100%';
if ( 0 ) {
if ($monitor_options['width'] > 0)
$monitor_options['width'] = $monitor_options['width'].'px';
if ($monitor_options['height'] > 0)
$monitor_options['height'] = $monitor_options['height']?$monitor_options['height'].'px' : null;
if ($monitor_options['width'] > 0)
$monitor_options['width'] = $monitor_options['width'].'px';
if ($monitor_options['height'] > 0)
$monitor_options['height'] = $monitor_options['height']?$monitor_options['height'].'px' : null;
} # end if
$monitor_options['connkey'] = $monitor->connKey();
@ -275,30 +275,28 @@ foreach ( $monitors as $monitor ) {
} else if ( $scale ) {
$width = reScale($monitor->Width(), $scale);
$height = reScale($monitor->Height(), $scale);
}
}
$zones = array();
foreach( dbFetchAll('SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($monitor->Id()) ) as $row ) {
$row['Points'] = coordsToPoints($row['Coords']);
if ( $scale ) {
limitPoints($row['Points'], 0, 0, $monitor->Width(), $monitor->Height());
foreach ( ZM\Zone::find(array('MonitorId'=>$monitor->Id()), array('order'=>'Area DESC')) as $row ) {
$points = $row->Points();
if ($scale) {
limitPoints($points, 0, 0, $monitor->Width(), $monitor->Height());
} else {
limitPoints($row['Points'], 0, 0,
limitPoints($points, 0, 0,
( $width ? $width-1 : $monitor->ViewWidth()-1 ),
( $height ? $height-1 : $monitor->ViewHeight()-1 )
);
}
$row['Coords'] = pointsToCoords($row['Points']);
$row['AreaCoords'] = preg_replace('/\s+/', ',', $row['Coords']);
$row->Coords(pointsToCoords($points));
$zones[] = $row;
} // end foreach Zone
?>
<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->ViewWidth() ?> <?php echo $monitor->ViewHeight() ?>" preserveAspectRatio="none">
<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->ViewWidth().' '.$monitor->ViewHeight() ?>" preserveAspectRatio="none">
<?php
foreach ( array_reverse($zones) as $zone ) {
echo '<polygon points="'. $zone['AreaCoords'] .'" class="'. $zone['Type'].'" />';
foreach (array_reverse($zones) as $zone) {
echo $zone->svg_polygon();
} // end foreach zone
?>
Sorry, your browser does not support inline SVG
@ -308,9 +306,14 @@ foreach ( array_reverse($zones) as $zone ) {
?>
</div>
<?php
if ( (!ZM_WEB_COMPACT_MONTAGE) && ($monitor->Type() != 'WebSite') ) {
if ((!ZM_WEB_COMPACT_MONTAGE) && ($monitor->Type() != 'WebSite')) {
?>
<div id="monitorState<?php echo $monitor->Id() ?>" class="monitorState idle"><?php echo translate('State') ?>:&nbsp;<span id="stateValue<?php echo $monitor->Id() ?>"></span>&nbsp;-&nbsp;<span id="fpsValue<?php echo $monitor->Id() ?>"></span>&nbsp;fps</div>
<div id="monitorState<?php echo $monitor->Id() ?>" class="monitorState idle">
<?php echo translate('State') ?>:
<span id="stateValue<?php echo $monitor->Id() ?>"></span>
&nbsp;-&nbsp;
<span id="fpsValue<?php echo $monitor->Id() ?>"></span>&nbsp;fps
</div>
<?php
}
?>