diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ButtonViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ButtonViewDescriptor.swift
index d500f0e9..6ce1d129 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ButtonViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ButtonViewDescriptor.swift
@@ -77,7 +77,27 @@ struct ButtonViewDescriptor: ViewDescriptor, Equatable {
mappingCode + " else {v = \"\(localizedLabel)\";}" +
" var valueNumber = document.getElementById(\"element\(id)\").getElementsByClassName(\"valueNumber\")[0];" +
" valueNumber.textContent = v;" +
+ " \(setVisiblity(id))" +
"}"
}
+
+ func setVisiblity(_ id: Int) -> String {
+
+ guard let visibilityLabel = visibilityBuffer?.name else {
+ return ""
+ }
+
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {"
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var buttonElement = document.getElementById(\"element\(id)\");
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ buttonElement.style.display = \"none\";
+ } else {
+ buttonElement.style.display = \"block\";
+ }
+ }
+ """
+ }
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/CameraViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/CameraViewDescriptor.swift
index f425c13c..30c10d6c 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/CameraViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/CameraViewDescriptor.swift
@@ -34,4 +34,23 @@ struct CameraViewDescriptor: ViewDescriptor, Equatable {
let warningText = localize("remoteCameraWarning").replacingOccurrences(of: "\"", with: "\\\"")
return "
"
}
+
+ func setDataHTMLWithID(_ id: Int) -> String {
+ guard let visibilityLabel = visibilityBuffer?.name else {
+ return ""
+ }
+
+ return """
+ function (data) {
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var x = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var cameraElement = document.getElementById(\"element\(id)\");
+ if (x <= 0.0 || x.length == 0) {
+ cameraElement.style.display = \"none\";
+ } else {
+ cameraElement.style.display = \"block\";
+ }
+ }
+ """
+ }
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DepthGUIDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DepthGUIDescriptor.swift
index c7954ed5..ec02f87f 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DepthGUIDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DepthGUIDescriptor.swift
@@ -26,4 +26,23 @@ struct DepthGUIViewDescriptor: ViewDescriptor, Equatable {
let warningText = localize("remoteDepthGUIWarning").replacingOccurrences(of: "\"", with: "\\\"")
return ""
}
+
+ func setDataHTMLWithID(_ id: Int) -> String {
+ guard let visibilityLabel = visibilityBuffer?.name else {
+ return ""
+ }
+
+ return """
+ function (data) {
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var x = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var depthGuiElement = document.getElementById(\"element\(id)\");
+ if (x <= 0.0 || x.length == 0) {
+ depthGuiElement.style.display = \"none\";
+ } else {
+ depthGuiElement.style.display = \"block\";
+ }
+ }
+ """
+ }
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DropdownViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DropdownViewDescriptor.swift
index eb376d85..8903c0d1 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DropdownViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/DropdownViewDescriptor.swift
@@ -92,11 +92,31 @@ struct DropdownViewDescriptor: ViewDescriptor, Equatable {
dropdownElement.selectedIndex = 0
}
+ \(setVisiblity(id))
+
}
"""
}
+ func setVisiblity(_ id: Int) -> String {
+
+ guard let visibilityLabel = visibilityBuffer?.name else { return "" }
+
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var dropDownElement = document.getElementById(\"element\(id)\");
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ dropDownElement.style.display = \"none\";
+ } else {
+ dropDownElement.style.display = \"block\";
+ }
+ }
+
+ """
+ }
+
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/EditViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/EditViewDescriptor.swift
index 4de2220b..bf376184 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/EditViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/EditViewDescriptor.swift
@@ -73,15 +73,39 @@ struct EditViewDescriptor: ViewDescriptor, Equatable {
func setDataHTMLWithID(_ id: Int) -> String {
let bufferName = buffer.name.replacingOccurrences(of: "\"", with: "\\\"")
+
+
return "function (data) {" +
"var valueElement = document.getElementById(\"element\(id)\").getElementsByClassName(\"value\")[0];" +
"if (!data.hasOwnProperty(\"\(bufferName)\"))" +
" return;" +
"var x = data[\"\(bufferName)\"][\"data\"][data[\"\(bufferName)\"][\"data\"].length-1];" +
- "console.log(\"editElement buffer value is \" +x);" +
+
"if (valueElement !== document.activeElement)" +
" valueElement.value = (x*\(factor))" +
+
+ "\(setVisiblity(id))" +
"}"
}
+
+ func setVisiblity(_ id: Int) -> String {
+
+ guard let visibilityLabel = visibilityBuffer?.name else {
+ return ""
+ }
+
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var editElement = document.getElementById(\"element\(id)\");
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ editElement.style.display = \"none\";
+ } else {
+ editElement.style.display = \"block\";
+ }
+ }
+ """
+ }
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/GraphViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/GraphViewDescriptor.swift
index b56daa5c..d6c993a1 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/GraphViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/GraphViewDescriptor.swift
@@ -584,9 +584,32 @@ struct GraphViewDescriptor: ViewDescriptor, Equatable {
code += "elementData[\(id)][\"datasets\"][\(i)] = data[\"\(bufferName)\"];"
}
}
+
+ code += setVisiblity(id)
+
code += "}"
return code
}
+ func setVisiblity(_ id: Int) -> String {
+
+ guard let visibilityLabel = visibilityBuffer?.name else { return "" }
+
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var graphElement = document.getElementById(\"element\(id)\");
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ graphElement.style.display = \"none\";
+ if ((graphElement.classList && graphElement.classList.contains(\"exclusive\")) || (graphElement.className.indexOf(\"exclusive\") > -1)) {
+ leaveExclusive();
+ }
+ } else {
+ graphElement.style.display = \"block\";
+ }
+ }
+ """
+ }
+
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ImageViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ImageViewDescriptor.swift
index 6e3a8c32..df962b3d 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ImageViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ImageViewDescriptor.swift
@@ -34,4 +34,23 @@ struct ImageViewDescriptor: ResourceViewDescriptor, Equatable {
return ""
}
+ func setDataHTMLWithID(_ id: Int) -> String {
+ guard let visibilityLabel = visibilityBuffer?.name else {
+ return ""
+ }
+
+ return """
+ function (data) {
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var x = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var imageElement = document.getElementById(\"element\(id)\");
+ if (x <= 0.0 || x.length == 0) {
+ imageElement.style.display = \"none\";
+ } else {
+ imageElement.style.display = \"block\";
+ }
+ }
+ """
+ }
+
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/InfoViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/InfoViewDescriptor.swift
index c8419457..090bd35d 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/InfoViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/InfoViewDescriptor.swift
@@ -32,4 +32,24 @@ struct InfoViewDescriptor: ViewDescriptor, Equatable {
func generateViewHTMLWithID(_ id: Int) -> String {
return ""
}
+
+ func setDataHTMLWithID(_ id: Int) -> String {
+ guard let visibilityLabel = visibilityBuffer?.name else {
+ return ""
+ }
+
+ return """
+ function (data) {
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var x = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var infoElement = document.getElementById(\"element\(id)\");
+ if (x <= 0.0) {
+ infoElement.style.display = \"none\";
+ } else {
+ infoElement.style.display = \"block\";
+ }
+ }
+ }
+ """
+ }
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SliderViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SliderViewDescriptor.swift
index 802a603a..fdac5f88 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SliderViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SliderViewDescriptor.swift
@@ -59,7 +59,7 @@ struct SliderViewDescriptor: ViewDescriptor, Equatable {
let minValueFormatted = numberFormatter(for: minValue)
let maxValueFormatted = numberFormatter(for: maxValue)
- let defaultValueFormatted = numberFormatter(for: defaultValue ?? 0.0)
+ let defaultValueFormatted = numberFormatter(for: defaultValue)
let bufferName = outputBuffers[.Empty]?.name ?? ""
@@ -73,7 +73,7 @@ struct SliderViewDescriptor: ViewDescriptor, Equatable {
private func generateTwoSlidersHTML(_ id: Int) -> String{
let minValueFormatted = numberFormatter(for: minValue)
let maxValueFormatted = numberFormatter(for: maxValue)
- let defaultValueFormatted = numberFormatter(for: defaultValue ?? 0.0)
+ let defaultValueFormatted = numberFormatter(for: defaultValue)
let valueTag = showValue ? "\(localizedLabel)" +
"\(defaultValueFormatted)" : ""
@@ -160,6 +160,8 @@ struct SliderViewDescriptor: ViewDescriptor, Equatable {
sliderElement.classList.remove(\"isSliderUpdating\");
}
});
+
+ \(setVisiblity(id))
}
@@ -259,4 +261,22 @@ struct SliderViewDescriptor: ViewDescriptor, Equatable {
}
+ func setVisiblity(_ id: Int) -> String {
+
+ guard let visibilityLabel = visibilityBuffer?.name else { return "" }
+
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var sliderElement = document.getElementById(\"element\(visibilityLabel)\");
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ sliderElement.style.display = \"none\";
+ } else {
+ sliderElement.style.display = \"block\";
+ }
+ }
+
+ """
+ }
+
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SwitchViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SwitchViewDescriptor.swift
index 95d84b75..68473f2a 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SwitchViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/SwitchViewDescriptor.swift
@@ -58,10 +58,28 @@ struct SwitchViewDescriptor: ViewDescriptor, Equatable {
var value = radioButton.checked ? 1.0 : 0.0;
ajax('control?cmd=set&buffer=\(buffer.name)&value='+value);
};
- }
+ \(setVisiblity(id))
+ }
"""
}
+
+ func setVisiblity(_ id: Int) -> String {
+
+ guard let visibilityLabel = visibilityBuffer?.name else { return "" }
+
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {"
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var toggleElement = document.getElementById(\"element\(id)\");
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ toggleElement.style.display = \"none\";
+ } else {
+ toggleElement.style.display = \"block\";
+ }
+ }
+ """
+ }
}
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ValueViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ValueViewDescriptor.swift
index c1ef8ae1..7f5e760c 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ValueViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ValueViewDescriptor.swift
@@ -125,30 +125,36 @@ struct ValueViewDescriptor: ViewDescriptor, Equatable {
}
}
- return "function (data) {" +
- " if (!data.hasOwnProperty(\"\(bufferName)\"))" +
- " return;" +
- " var x = data[\"\(bufferName)\"][\"data\"][data[\"\(bufferName)\"][\"data\"].length-1];" +
- " var v = null;" +
- mappingCode +
+ let unitCode = setUnit()
+ let formatCode = setFormatedCoordinate()
+ let asciiCode = setAsciiFormat(bufferName: bufferName)
+ let visibilityCode = setVisibility(id, visibilityBuffer?.name ?? "")
- "\(setUnit())" +
-
- "\(setFormatedCoordinate())" +
+ let dataSetupFunction = """
+ function (data) {
+ if (!data.hasOwnProperty(\"\(bufferName)\"))
+ return;
+ var x = data[\"\(bufferName)\"][\"data\"][data[\"\(bufferName)\"][\"data\"].length-1];
+ var v = null;
+ \(mappingCode)
+ \(unitCode)
+ \(formatCode)
+ \(asciiCode)
+ var valueElement = document.getElementById(\"element\(id)\").getElementsByClassName(\"value\")[0];
+ var valueNumber = valueElement.getElementsByClassName(\"valueNumber\")[0];
+ var valueUnit = valueElement.getElementsByClassName(\"valueUnit\")[0];
+ if (v == null) {
+ v = x;
+ valueUnit.textContent = unitLabel;
+ } else {
+ valueUnit.textContent = \"\";
+ }
+ valueNumber.textContent = v;
+ \(visibilityCode)
+ }
+ """
- "\(setAsciiFormat(bufferName: bufferName))" +
-
- " var valueElement = document.getElementById(\"element\(id)\").getElementsByClassName(\"value\")[0];" +
- " var valueNumber = valueElement.getElementsByClassName(\"valueNumber\")[0];" +
- " var valueUnit = valueElement.getElementsByClassName(\"valueUnit\")[0];" +
- " if (v == null) {" +
- " v = x;" +
- " valueUnit.textContent = unitLabel;" +
- " } else { " +
- " valueUnit.textContent = \"\";" +
- " } " +
- " valueNumber.textContent = v;" +
- "}"
+ return dataSetupFunction
}
func setUnit() -> String {
@@ -208,4 +214,20 @@ struct ValueViewDescriptor: ViewDescriptor, Equatable {
}
"""
}
+
+ func setVisibility(_ id: Int, _ visibilityLabel: String) -> String {
+ if visibilityLabel.isEmpty { return "" }
+ return """
+ if (data.hasOwnProperty(\"\(visibilityLabel)\")) {
+ var elementVisibilityIndicator = data[\"\(visibilityLabel)\"][\"data\"][data[\"\(visibilityLabel)\"][\"data\"].length-1];
+ var valueMainElement = document.getElementById(\"element\(id)\");
+ if (elementVisibilityIndicator <= 0.0 || elementVisibilityIndicator.length == 0) {
+ valueMainElement.style.display = "none";
+ } else {
+ valueMainElement.style.display = "block";
+ }
+ }
+ """
+ }
}
+
diff --git a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ViewDescriptor.swift b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ViewDescriptor.swift
index 64b3c19d..faa88279 100644
--- a/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ViewDescriptor.swift
+++ b/phyphox-iOS/phyphox/Experiments/ViewDescriptors/ViewDescriptor.swift
@@ -21,6 +21,10 @@ extension ViewDescriptor {
var localizedLabel: String {
return translation?.localizeString(label) ?? label
}
+
+ func getVisibilityUpdateMode() -> String {
+ return "single"
+ }
func generateDataCompleteHTMLWithID(_ id: Int) -> String {
return "function() {}"
diff --git a/phyphox-iOS/phyphox/Info.plist b/phyphox-iOS/phyphox/Info.plist
index 89681c0a..114417a5 100644
--- a/phyphox-iOS/phyphox/Info.plist
+++ b/phyphox-iOS/phyphox/Info.plist
@@ -52,7 +52,7 @@
CFBundleVersion
- 17276
+ 17296
LSRequiresIPhoneOS
LSSupportsOpeningDocumentsInPlace
diff --git a/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/ExperimentWebServer.swift b/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/ExperimentWebServer.swift
index ae8e099e..8cf8f07a 100644
--- a/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/ExperimentWebServer.swift
+++ b/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/ExperimentWebServer.swift
@@ -225,6 +225,8 @@ final class ExperimentWebServer {
if value.count > 0 {
let raw = b.toArray()
+ dict["visibilityUpdateMode"] = "single" as AnyObject
+
if value == "full" || (value == "partial" && self.forceFullUpdate == true) {
dict["updateMode"] = "full" as AnyObject
dict["buffer"] = raw.map({$0.isFinite ? $0 as AnyObject : NSNull() as AnyObject}) as AnyObject //The array may contain NaN or Inf, which will throw an error in the JSON conversion.
diff --git a/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/WebServerUtilities.swift b/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/WebServerUtilities.swift
index 7efc917f..3809764b 100644
--- a/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/WebServerUtilities.swift
+++ b/phyphox-iOS/phyphox/UI/MainView/ExperimentView/WebServer/WebServerUtilities.swift
@@ -116,28 +116,53 @@ final class WebServerUtilities {
}
updateMode = "partial"
}
- viewLayout += ", \"updateMode\": \"\(graph.partialUpdate ? updateMode : "full")\", \"dataInput\": [\(dataInput)], \"dataInputFunction\":\n\(graph.setDataHTMLWithID(idx))\n"
+
+ var keyValuePairForVisibilityInput = ""
+ if let visibilityInput = graph.visibilityBuffer?.name {
+ keyValuePairForVisibilityInput += ", \"visibilityInput\": [\"\(visibilityInput)\"] "
+ }
+
+ viewLayout += ", \"updateMode\": \"\(graph.partialUpdate ? updateMode : "full")\", \"visibilityUpdateMode\": \"single\" \(keyValuePairForVisibilityInput), \"dataInput\": [\(dataInput)] ,\"dataInputFunction\":\n\(graph.setDataHTMLWithID(idx))\n"
}
- else if element is InfoViewDescriptor {
- viewLayout += ", \"updateMode\": \"none\""
+ else if let info = element as? InfoViewDescriptor {
+ var keyValuePairForVisibilityInput = ""
+ if let visibilityInput = info.visibilityBuffer?.name {
+ keyValuePairForVisibilityInput += ", \"visibilityInput\": [\"\(visibilityInput)\"] "
+ }
+
+ viewLayout += ", \"updateMode\": \"none\", \"visibilityUpdateMode\": \"single\" \(keyValuePairForVisibilityInput), \"dataInputFunction\":\n\(info.setDataHTMLWithID(idx))\n"
}
else if element is SeparatorViewDescriptor {
- viewLayout += ", \"updateMode\": \"none\""
+ viewLayout += ", \"updateMode\": \"none\", \"visibilityUpdateMode\": \"single\""
}
else if let value = element as? ValueViewDescriptor {
- viewLayout += ", \"updateMode\": \"\(value.updateMode())\", \"dataInput\":[\"\(value.buffer.name)\"], \"dataInputFunction\":\n\(value.setDataHTMLWithID(idx))\n"
+ var keyValuePairForVisibilityInput = ""
+ if let visibilityInput = value.visibilityBuffer?.name {
+ keyValuePairForVisibilityInput += ", \"visibilityInput\": [\"\(visibilityInput)\"] "
+ }
+
+ viewLayout += ", \"updateMode\": \"\(value.updateMode())\", \"visibilityUpdateMode\": \"single\" \(keyValuePairForVisibilityInput), \"dataInput\":[\"\(value.buffer.name)\"], \"dataInputFunction\":\n\(value.setDataHTMLWithID(idx))\n"
}
else if let edit = element as? EditViewDescriptor {
- viewLayout += ", \"updateMode\": \"input\", \"dataInput\":[\"\(edit.buffer.name)\"], \"dataInputFunction\":\n\(edit.setDataHTMLWithID(idx))\n"
+ var keyValuePairForVisibilityInput = ""
+ if let visibilityInput = edit.visibilityBuffer?.name {
+ keyValuePairForVisibilityInput += ", \"visibilityInput\": [\"\(visibilityInput)\"] "
+ }
+ viewLayout += ", \"updateMode\": \"input\", \"visibilityUpdateMode\": \"single\" \(keyValuePairForVisibilityInput), \"dataInput\":[\"\(edit.buffer.name)\"], \"dataInputFunction\":\n\(edit.setDataHTMLWithID(idx))\n"
}
else if let button = element as? ButtonViewDescriptor {
- viewLayout += ", \"updateMode\": \"single\", \"dataInput\": [\"\(button.buffer?.name ?? "")\"], \"dataInputFunction\":\n\(button.setDataHTMLWithID(idx))\n "
+ var keyValuePairForVisibilityInput = ""
+ if let visibilityInput = button.visibilityBuffer?.name {
+ keyValuePairForVisibilityInput += ", \"visibilityInput\": [\"\(visibilityInput)\"] "
+ }
+
+ viewLayout += ", \"updateMode\": \"single\", \"visibilityUpdateMode\": \"single\", \"visibilityInput\": [\"\(button.visibilityBuffer?.name ?? "")\"], \"dataInput\": [\"\(button.buffer?.name ?? "")\"], \"dataInputFunction\":\n\(button.setDataHTMLWithID(idx))\n "
}
else if let toggle = element as? SwitchViewDescriptor {
- viewLayout += ", \"updateMode\": \"single\", \"dataInput\": [\"\(toggle.buffer.name)\"], \"dataInputFunction\":\n\(toggle.setDataHTMLWithID(idx))\n "
+ viewLayout += ", \"updateMode\": \"single\", \"visibilityUpdateMode\": \"single\", \"visibilityInput\": [\"\(toggle.visibilityBuffer?.name ?? "")\"], \"dataInput\": [\"\(toggle.buffer.name)\"], \"dataInputFunction\":\n\(toggle.setDataHTMLWithID(idx))\n "
}
else if let dropdown = element as? DropdownViewDescriptor {
- viewLayout += ", \"updateMode\": \"single\", \"dataInput\": [\"\(dropdown.buffer.name)\"], \"dataInputFunction\":\n\(dropdown.setDataHTMLWithID(idx))\n "
+ viewLayout += ", \"updateMode\": \"single\", \"visibilityUpdateMode\": \"single\", \"visibilityInput\": [\"\(dropdown.visibilityBuffer?.name ?? "")\"], \"dataInput\": [\"\(dropdown.buffer.name)\"], \"dataInputFunction\":\n\(dropdown.setDataHTMLWithID(idx))\n "
} else if let slider = element as? SliderViewDescriptor {
var bufferName = ""
@@ -149,10 +174,10 @@ final class WebServerUtilities {
bufferName += "\"" + (slider.outputBuffers[.UpperValue]?.name ?? " ").replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\"", with: "\\\"") + "\""
}
- viewLayout += ", \"updateMode\": \"single\", \"dataInput\": [\(bufferName)], \"dataInputFunction\":\n\(slider.setDataHTMLWithID(idx))\n "
+ viewLayout += ", \"updateMode\": \"single\", \"visibilityUpdateMode\": \"single\", \"visibilityInput\": [\"\(slider.visibilityBuffer?.name ?? "")\"], \"dataInput\": [\(bufferName)], \"dataInputFunction\":\n\(slider.setDataHTMLWithID(idx))\n "
}
- else if element is ImageViewDescriptor {
- viewLayout += ", \"updateMode\": \"none\""
+ else if let image = element as? ImageViewDescriptor {
+ viewLayout += ", \"updateMode\": \"none\", \"visibilityUpdateMode\": \"single\", \"visibilityInput\": [\"\(image.visibilityBuffer?.name ?? "")\"], \"dataInputFunction\":\n\(image.setDataHTMLWithID(idx))\n"
}
viewLayout += "}"