♻ Use length of tool array for visibility

No need for an additional variable to keep in sync.
This commit is contained in:
Gina Häußge committed 2019-03-12 13:56:53 +01:00
1 parent 1b5a654a2d
commit b4e7e73e29
2 files changed
+2 -4

No files matched your search

@@ -26,7 +26,6 @@ $(function() {
self.distances = ko.observableArray([0.1, 1, 10, 100]);
self.distance = ko.observable(10);
self.showTools = ko.observable(true);
self.tools = ko.observableArray([]);
self.feedRate = ko.observable(100);
@@ -73,14 +72,13 @@ $(function() {
tools[extruder]["name"](gettext("Tool") + " " + extruder);
tools[extruder]["key"]("tool" + extruder);
}
} else {
} else if (numExtruders === 1) {
// only one extruder, no need to add numbers
tools[0] = self._createToolEntry();
tools[0]["name"](gettext("Hotend"));
tools[0]["key"]("tool0");
}
self.showTools(numExtruders > 0);
self.tools(tools);
};
+1 -1
View File
@@ -85,7 +85,7 @@
</div>
</div>
<!-- Extrusion control panel -->
<div id="control-jog-extrusion" class="jog-panel" style="display: none;" data-bind="visible: loginState.isUser && showTools">
<div id="control-jog-extrusion" class="jog-panel" style="display: none;" data-bind="visible: loginState.isUser && tools().length > 0">
<h1>Tool (E)</h1>
<div>
<div class="btn-group control-box">