Merge branch 'release-1.34'

This commit is contained in:
Isaac Connor 2020-07-07 18:58:32 -04:00
commit 880219bb0f
3 changed files with 35 additions and 47 deletions

View File

@ -44,7 +44,7 @@ std::string trimSet(std::string str, std::string trimset) {
size_t endpos = str.find_last_not_of(trimset); // Find the first character position from reverse af
// if all spaces or empty return an empty string
if ( ( std::string::npos == startpos ) || ( std::string::npos == endpos) ) {
if ( ( std::string::npos == startpos ) || ( std::string::npos == endpos ) )
return std::string("");
return str.substr(startpos, endpos-startpos+1);
}

View File

@ -244,12 +244,14 @@ function limitArea(field) {
limitRange(field, minValue, maxValue);
}
function highlightOn(index) {
function highlightOn(point) {
var index = point.getAttribute('data-index');
$('row'+index).addClass('highlight');
$('point'+index).addClass('highlight');
}
function highlightOff(index) {
function highlightOff(point) {
var index = point.getAttribute('data-index');
$('row'+index).removeClass('highlight');
$('point'+index).removeClass('highlight');
}
@ -310,9 +312,11 @@ function updateActivePoint(index) {
$('newZone[Points]['+index+'][y]').value = y;
zone['Points'][index].x = x;
zone['Points'][index].y = y;
console.log('hello');
var Point = $('zonePoly').points.getItem(index);
Point.x =x;
Point.y =y;
console.log('hello');
Point.x = x;
Point.y = y;
updateArea();
}
@ -353,15 +357,17 @@ function updateArea( ) {
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
form.elements['newZone[TempArea]'].value = area;
} else {
alert("Unknown units: " + form.elements['newZone[Units]'].value);
alert('Unknown units: ' + form.elements['newZone[Units]'].value);
}
}
function updateX(index) {
limitPointValue($('newZone[Points]['+index+'][x]'), 0, maxX);
function updateX(input) {
index = input.getAttribute('data-point-index');
limitPointValue(input, 0, maxX);
var point = $('point'+index);
var x = $('newZone[Points]['+index+'][x]').get('value');
var x = input.value;
point.setStyle('left', x+'px');
zone['Points'][index].x = x;
@ -370,11 +376,12 @@ function updateX(index) {
updateArea();
}
function updateY(index) {
limitPointValue($('newZone[Points]['+index+'][y]'), 0, maxY);
function updateY(input) {
index = input.getAttribute('data-point-index');
limitPointValue(input, 0, maxY);
var point = $('point'+index);
var y = $('newZone[Points]['+index+'][y]').get('value');
var y = input.value;
point.setStyle('top', y+'px');
zone['Points'][index].y = y;
@ -403,6 +410,7 @@ function drawZonePoints() {
for ( var i = 0; i < zone['Points'].length; i++ ) {
var div = new Element('div', {
'id': 'point'+i,
'data-index': i,
'class': 'zonePoint',
'title': 'Point '+(i+1),
'styles': {
@ -410,7 +418,9 @@ function drawZonePoints() {
'top': zone['Points'][i].y
}
});
div.addEvent('mouseover', highlightOn.pass(i));
//div.addEvent('mouseover', highlightOn.pass(i));
div.onmouseover = window['highlightOn'].bind(div, div);
div.onmouseout = window['highlightOff'].bind(div, div);
div.addEvent('mouseout', highlightOff.pass(i));
div.inject($('imageFrame'));
div.makeDraggable( {
@ -439,9 +449,12 @@ function drawZonePoints() {
'id': 'newZone[Points]['+i+'][x]',
'name': 'newZone[Points]['+i+'][x]',
'value': zone['Points'][i].x,
'size': 5
'type': 'number',
'min' : '0',
'max' : maxX,
'data-point-index' : i
});
input.addEvent('input', updateX.pass(i));
input.oninput = window['updateX'].bind(input, input);
input.inject(cell);
cell.inject(row);
@ -450,9 +463,12 @@ function drawZonePoints() {
'id': 'newZone[Points]['+i+'][y]',
'name': 'newZone[Points]['+i+'][y]',
'value': zone['Points'][i].y,
'size': 5
'type': 'number',
'min' : '0',
'max' : maxY,
'data-point-index' : i
} );
input.addEvent('input', updateY.pass(i));
input.oninput = window['updateY'].bind(input, input);
input.inject(cell);
cell.inject(row);
@ -499,34 +515,6 @@ function setAlarmState( currentAlarmState ) {
} else {
$('stateValue').removeProperty('class');
}
var isAlarmed = ( alarmState == STATE_ALARM || alarmState == STATE_ALERT );
var wasAlarmed = ( lastAlarmState == STATE_ALARM || lastAlarmState == STATE_ALERT );
var newAlarm = ( isAlarmed && !wasAlarmed );
var oldAlarm = ( !isAlarmed && wasAlarmed );
if ( newAlarm ) {
if ( SOUND_ON_ALARM ) {
// Enable the alarm sound
if ( !canPlayPauseAudio ) {
$('alarmSound').removeClass('hidden');
} else {
$('MediaPlayer').Play();
}
}
}
if ( SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
if ( !canPlayPauseAudio ) {
$('alarmSound').addClass('hidden');
} else {
$('MediaPlayer').Stop();
}
}
}
lastAlarmState = alarmState;
}
var streamCmdParms = "view=request&request=stream&connkey="+connKey;

View File

@ -212,8 +212,8 @@ xhtmlHeaders(__FILE__, translate('Zone'));
</tr>
<tr>
<th scope="row"><?php echo translate('ZoneMinMaxPixelThres') ?></th>
<td><input type="number" name="newZone[MinPixelThreshold]" value="<?php echo $newZone['MinPixelThreshold'] ?>"/></td>
<td><input type="number" name="newZone[MaxPixelThreshold]" value="<?php echo $newZone['MaxPixelThreshold'] ?>"/></td>
<td><input type="number" name="newZone[MinPixelThreshold]" value="<?php echo $newZone['MinPixelThreshold'] ?>" min="0" max="255"/></td>
<td><input type="number" name="newZone[MaxPixelThreshold]" value="<?php echo $newZone['MaxPixelThreshold'] ?>" min="0" max="255"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ZoneFilterSize') ?></th>