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 ) {
@ -278,27 +278,25 @@ foreach ( $monitors as $monitor ) {
}
$zones = array();
foreach( dbFetchAll('SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($monitor->Id()) ) as $row ) {
$row['Points'] = coordsToPoints($row['Coords']);
foreach ( ZM\Zone::find(array('MonitorId'=>$monitor->Id()), array('order'=>'Area DESC')) as $row ) {
$points = $row->Points();
if ($scale) {
limitPoints($row['Points'], 0, 0, $monitor->Width(), $monitor->Height());
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'].'" />';
echo $zone->svg_polygon();
} // end foreach zone
?>
Sorry, your browser does not support inline SVG
@ -310,7 +308,12 @@ foreach ( array_reverse($zones) as $zone ) {
<?php
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
}
?>