Improve html roi disablement (#1825)

* Improve ROI-Problem

* Update

* Update common.js
This commit is contained in:
jomjol
2023-01-13 20:40:48 +01:00
committed by GitHub
parent c86cd905da
commit 4a462fb79a
4 changed files with 24 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
/* The UI can also be run locally, but you have to set the IP of your devide accordingly. /* The UI can also be run locally, but you have to set the IP of your devide accordingly.
* And you also might have to disable CORS in your webbrowser! */ * And you also might have to disable CORS in your webbrowser! */
var domainname_for_testing = "192.168.1.153"; var domainname_for_testing = "192.168.178.44";

View File

@@ -154,10 +154,13 @@ th, td {
drag = false, drag = false,
aktindex = 0, aktindex = 0,
ROIInfo, ROIInfo,
cofcat,
param,
enhanceCon = false; enhanceCon = false;
lockAR = true; lockAR = true;
lockSizes = true; lockSizes = true;
domainname = getDomainname(); domainname = getDomainname();
function doReboot() { function doReboot() {
if (confirm("Are you sure you want to reboot? Did you save the config?")) { if (confirm("Are you sure you want to reboot? Did you save the config?")) {
@@ -185,6 +188,10 @@ function EnDisableAnalog() {
} }
sah1(document.getElementById("div1"), !isEnabled); sah1(document.getElementById("div1"), !isEnabled);
cofcat["Analog"]["enabled"] = isEnabled;
if (isEnabled) if (isEnabled)
{ {
UpdateROIs(); UpdateROIs();
@@ -279,8 +286,8 @@ function ChangeSelection(){
} }
function SaveToConfig(){ function SaveToConfig(){
_zwcat = getConfigCategory(); // _zwcat = getConfigCategory();
_zwcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked; cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
WriteConfigININew(); WriteConfigININew();
SaveConfigToServer(domainname); SaveConfigToServer(domainname);
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000); firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
@@ -293,9 +300,9 @@ function UpdateROIs(_sel){
var _number = sel.options[sel.selectedIndex].text; var _number = sel.options[sel.selectedIndex].text;
ROIInfo = getROIInfo("analog", _number); ROIInfo = getROIInfo("analog", _number);
_catzw = getConfigCategory(); // _catzw = getConfigCategory();
if (_catzw["Analog"]["enabled"] == false) if (cofcat["Analog"]["enabled"] == false)
{ {
document.getElementById("Category_Analog_enabled").checked = false; document.getElementById("Category_Analog_enabled").checked = false;
EnDisableAnalog(); EnDisableAnalog();
@@ -408,6 +415,7 @@ function UpdateROIs(_sel){
loadConfig(domainname); loadConfig(domainname);
ParseConfig(); ParseConfig();
param = getConfigParameters(); param = getConfigParameters();
cofcat = getConfigCategory();
UpdateNUMBERS(); UpdateNUMBERS();
drawImage(); drawImage();
draw(); draw();

View File

@@ -146,6 +146,8 @@ th, td {
drag = false, drag = false,
aktindex = 0, aktindex = 0,
ROIInfo, ROIInfo,
cofcat,
param,
enhanceCon = false; enhanceCon = false;
lockAR = true; lockAR = true;
lockSizes = true; lockSizes = true;
@@ -179,6 +181,9 @@ function EnDisableDigits() {
} }
sah1(document.getElementById("div1"), !isEnabled); sah1(document.getElementById("div1"), !isEnabled);
cofcat["Digits"]["enabled"] = isEnabled;
if (isEnabled) if (isEnabled)
{ {
UpdateROIs(); UpdateROIs();
@@ -282,8 +287,8 @@ function ChangeSelection(){
} }
function SaveToConfig(){ function SaveToConfig(){
_zwcat = getConfigCategory(); // _zwcat = getConfigCategory();
_zwcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked; cofcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
WriteConfigININew(); WriteConfigININew();
SaveConfigToServer(domainname); SaveConfigToServer(domainname);
firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000); firework.launch('Configuration got updated. Please reboot to activate changes!', 'success', 5000);
@@ -296,9 +301,9 @@ function UpdateROIs(_sel){
var _number = sel.options[sel.selectedIndex].text; var _number = sel.options[sel.selectedIndex].text;
ROIInfo = getROIInfo("digit", _number); ROIInfo = getROIInfo("digit", _number);
_catzw = getConfigCategory(); // _catzw = getConfigCategory();
if (_catzw["Digits"]["enabled"] == false) if (cofcat["Digits"]["enabled"] == false)
{ {
document.getElementById("Category_Digits_enabled").checked = false; document.getElementById("Category_Digits_enabled").checked = false;
EnDisableDigits(); EnDisableDigits();
@@ -410,6 +415,7 @@ function UpdateROIs(_sel){
loadConfig(domainname); loadConfig(domainname);
ParseConfig(); ParseConfig();
param = getConfigParameters(); param = getConfigParameters();
cofcat = getConfigCategory();
UpdateNUMBERS(); UpdateNUMBERS();
space = ROIInfo[1].x - parseInt(ROIInfo[0].x) - parseInt(ROIInfo[0].dx); space = ROIInfo[1].x - parseInt(ROIInfo[0].x) - parseInt(ROIInfo[0].dx);

View File

@@ -13,7 +13,7 @@ function getbasepath(){
{ {
// host = "http://192.168.2.219"; // jomjol interner test // host = "http://192.168.2.219"; // jomjol interner test
// host = "http://192.168.178.46"; // jomjol interner test // host = "http://192.168.178.46"; // jomjol interner test
host = "http://192.168.178.44"; // jomjol interner Real host = "http://192.168.178.62"; // jomjol interner Real
// host = "http://192.168.43.191"; // host = "http://192.168.43.191";
// host = "."; // jomjol interner localhost // host = "."; // jomjol interner localhost