Knockify the distance on the control tab
This commit is contained in:
parent
5e6a7ef605
commit
119f727c8d
2 changed files with 11 additions and 5 deletions
|
|
@ -26,6 +26,9 @@ $(function() {
|
|||
self.extrusionAmount = ko.observable(undefined);
|
||||
self.controls = ko.observableArray([]);
|
||||
|
||||
self.distances = ko.observableArray([0.1, 1, 10, 100]);
|
||||
self.distance = ko.observable(10);
|
||||
|
||||
self.tools = ko.observableArray([]);
|
||||
|
||||
self.feedRate = ko.observable(100);
|
||||
|
|
@ -249,7 +252,7 @@ $(function() {
|
|||
|
||||
self.sendJogCommand = function (axis, multiplier, distance) {
|
||||
if (typeof distance === "undefined")
|
||||
distance = $('#jog_distance button.active').data('distance');
|
||||
distance = self.distance();
|
||||
if (self.settings.printerProfiles.currentProfileData() && self.settings.printerProfiles.currentProfileData()["axes"] && self.settings.printerProfiles.currentProfileData()["axes"][axis] && self.settings.printerProfiles.currentProfileData()["axes"][axis]["inverted"]()) {
|
||||
multiplier *= -1;
|
||||
}
|
||||
|
|
@ -584,6 +587,10 @@ $(function() {
|
|||
}
|
||||
};
|
||||
|
||||
self.stripDistanceDecimal = function(distance) {
|
||||
return distance.toString().replace(".", "");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
|
|
|
|||
|
|
@ -57,10 +57,9 @@
|
|||
<!-- Jog distance -->
|
||||
<div class="distance">
|
||||
<div class="btn-group" data-toggle="buttons-radio" id="jog_distance">
|
||||
<button type="button" id="control-distance01" class="btn distance" data-distance="0.1" data-bind="enable: loginState.isUser()">0.1</button>
|
||||
<button type="button" id="control-distance1" class="btn distance" data-distance="1" data-bind="enable: loginState.isUser()">1</button>
|
||||
<button type="button" id="control-distance10" class="btn distance active" data-distance="10" data-bind="enable: loginState.isUser()">10</button>
|
||||
<button type="button" id="control-distance100" class="btn distance" data-distance="100" data-bind="enable: loginState.isUser()">100</button>
|
||||
<!-- ko foreach: distances -->
|
||||
<button type="button" class="btn distance" data-bind="enable: $root.loginState.isUser(), text: $data, click: function() { $root.distance($data) }, css: { active: $root.distance() === $data }, attr: { id: 'control-distance' + $root.stripDistanceDecimal($data) }"></button>
|
||||
<!-- /ko -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue