Fixes to function converting from pixels to percent. Adjust to 100 if > 100.
This commit is contained in:
parent
25426d5fdd
commit
ec707acdd1
|
@ -178,14 +178,20 @@ function applyPreset() {
|
||||||
function toPixels(field, maxValue) {
|
function toPixels(field, maxValue) {
|
||||||
if ( field.value != '' ) {
|
if ( field.value != '' ) {
|
||||||
field.value = Math.round((field.value*maxValue)/100);
|
field.value = Math.round((field.value*maxValue)/100);
|
||||||
|
if ( field.value > maxValue )
|
||||||
|
field.value = maxValue;
|
||||||
}
|
}
|
||||||
field.setAttribute('step', 1);
|
field.setAttribute('step', 1);
|
||||||
field.setAttribute('max', monitorArea);
|
field.setAttribute('max', maxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maxValue is the max Pixels value which is normally the max area
|
||||||
function toPercent(field, maxValue) {
|
function toPercent(field, maxValue) {
|
||||||
if ( field.value != '' ) {
|
if ( field.value != '' ) {
|
||||||
field.value = Math.round((100*100*field.value)/maxValue)/100;
|
field.value = Math.round((100*100*field.value)/maxValue)/100;
|
||||||
|
if ( field.value > 100 ) {
|
||||||
|
field.value = 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
field.setAttribute('step', 0.01);
|
field.setAttribute('step', 0.01);
|
||||||
field.setAttribute('max', 100);
|
field.setAttribute('max', 100);
|
||||||
|
@ -312,9 +318,7 @@ function updateActivePoint(index) {
|
||||||
$('newZone[Points]['+index+'][y]').value = y;
|
$('newZone[Points]['+index+'][y]').value = y;
|
||||||
zone['Points'][index].x = x;
|
zone['Points'][index].x = x;
|
||||||
zone['Points'][index].y = y;
|
zone['Points'][index].y = y;
|
||||||
console.log('hello');
|
|
||||||
var Point = $('zonePoly').points.getItem(index);
|
var Point = $('zonePoly').points.getItem(index);
|
||||||
console.log('hello');
|
|
||||||
Point.x = x;
|
Point.x = x;
|
||||||
Point.y = y;
|
Point.y = y;
|
||||||
updateArea();
|
updateArea();
|
||||||
|
@ -678,7 +682,6 @@ var watchdogFunctions = {
|
||||||
//Make sure the various refreshes are still taking effect
|
//Make sure the various refreshes are still taking effect
|
||||||
function watchdogCheck(type) {
|
function watchdogCheck(type) {
|
||||||
if ( watchdogInactive[type] ) {
|
if ( watchdogInactive[type] ) {
|
||||||
console.log("Detected streamWatch of type: " + type + " stopped, restarting");
|
|
||||||
watchdogFunctions[type]();
|
watchdogFunctions[type]();
|
||||||
watchdogInactive[type] = false;
|
watchdogInactive[type] = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue