allow manual input of intensity and feedrate.
This commit is contained in:
parent
7f7d1f7229
commit
d307719044
3 changed files with 15 additions and 11 deletions
|
|
@ -1 +1,2 @@
|
|||
table th.settings_plugin_svgtogcode_profiles_key,table td.settings_plugin_svgtogcode_profiles_key{text-overflow:ellipsis;text-align:left;width:200px}table th.settings_plugin_svgtogcode_profiles_name,table td.settings_plugin_svgtogcode_profiles_name{text-overflow:ellipsis;text-align:left}table th.settings_plugin_svgtogcode_profiles_actions,table td.settings_plugin_svgtogcode_profiles_actions{text-align:center;width:100px}table th.settings_plugin_svgtogcode_profiles_actions a,table td.settings_plugin_svgtogcode_profiles_actions a{text-decoration:none;color:#000}table th.settings_plugin_svgtogcode_profiles_actions a.disabled,table td.settings_plugin_svgtogcode_profiles_actions a.disabled{color:#ccc;cursor:default}
|
||||
table th.settings_plugin_svgtogcode_profiles_key,table td.settings_plugin_svgtogcode_profiles_key{text-overflow:ellipsis;text-align:left;width:200px}table th.settings_plugin_svgtogcode_profiles_name,table td.settings_plugin_svgtogcode_profiles_name{text-overflow:ellipsis;text-align:left}table th.settings_plugin_svgtogcode_profiles_actions,table td.settings_plugin_svgtogcode_profiles_actions{text-align:center;width:100px}table th.settings_plugin_svgtogcode_profiles_actions a,table td.settings_plugin_svgtogcode_profiles_actions a{text-decoration:none;color:#000}table th.settings_plugin_svgtogcode_profiles_actions a.disabled,table td.settings_plugin_svgtogcode_profiles_actions a.disabled{color:#ccc;cursor:default}
|
||||
.slider_manual_input {margin-left: 1.5em; width: 2.5em;}
|
||||
|
|
@ -249,8 +249,8 @@ $(function(){
|
|||
};
|
||||
|
||||
self._configureIntensitySlider = function() {
|
||||
self.intensitySlider = $("#svgtogcode_intensity").slider({
|
||||
id: "svgtogcode_intensity_slider",
|
||||
self.intensitySlider = $("#svgtogcode_intensity_slider").slider({
|
||||
id: "svgtogcode_intensity_slider_impl",
|
||||
reversed: false,
|
||||
selection: "after",
|
||||
orientation: "horizontal",
|
||||
|
|
@ -270,8 +270,8 @@ $(function(){
|
|||
};
|
||||
|
||||
self._configureFeedrateSlider = function() {
|
||||
self.feedrateSlider = $("#svgtogcode_feedrate").slider({
|
||||
id: "svgtogcode_feedrate_slider",
|
||||
self.feedrateSlider = $("#svgtogcode_feedrate_slider").slider({
|
||||
id: "svgtogcode_feedrate_slider_impl",
|
||||
reversed: false,
|
||||
selection: "after",
|
||||
orientation: "horizontal",
|
||||
|
|
@ -284,23 +284,24 @@ $(function(){
|
|||
});
|
||||
|
||||
// use the class as a flag to avoid double binding of the slideStop event
|
||||
if($("#svgtogcode_feedrate").attr('class') === 'uninitialized'){ // somehow hasClass(...) did not work ???
|
||||
if($("#svgtogcode_feedrate_slider").attr('class') === 'uninitialized'){ // somehow hasClass(...) did not work ???
|
||||
self.feedrateSlider.on("slideStop", function(ev){
|
||||
$('#svgtogcode_feedrate').val(self._calcRealSpeed(ev.value));
|
||||
self.laserSpeed(self._calcRealSpeed(ev.value));
|
||||
});
|
||||
$("#svgtogcode_feedrate").removeClass('uninitialized');
|
||||
$("#svgtogcode_feedrate_slider").removeClass('uninitialized');
|
||||
}
|
||||
|
||||
var speedSubscription = self.laserSpeed.subscribe(function(fromSettings){
|
||||
var realVal = parseInt(fromSettings);
|
||||
var val = 100*(realVal - self.minSpeed()) / (self.maxSpeed() - self.minSpeed());
|
||||
self.feedrateSlider.slider('setValue', val);
|
||||
speedSubscription.dispose(); // only do it once
|
||||
//speedSubscription.dispose(); // only do it once
|
||||
});
|
||||
};
|
||||
|
||||
self._calcRealSpeed = function(sliderVal){
|
||||
return self.minSpeed() + sliderVal/100 * (self.maxSpeed() - self.minSpeed());
|
||||
return Math.round(self.minSpeed() + sliderVal/100 * (self.maxSpeed() - self.minSpeed()));
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
<label class="control-label">{{ _('Laser intensity') }} (1-1000)</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input id="svgtogcode_intensity" type="text" data-bind="slicerValue: laserIntensity">
|
||||
<input id="svgtogcode_intensity_slider" type="text" data-bind="slicerValue: laserIntensity">
|
||||
<input id="svgtogcode_intensity" class="slider_manual_input" type="text" data-bind="value: laserIntensity, valueUpdate: 'keyup'">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -18,7 +19,8 @@
|
|||
<label class="control-label">{{ _('Speed') }} (<span data-bind="text: minSpeed">30</span> - <span data-bind="text: maxSpeed">3000</span>)</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input id="svgtogcode_feedrate" class="uninitialized" type="text" data-bind="value: laserSpeed">
|
||||
<input id="svgtogcode_feedrate_slider" class="uninitialized" type="text" data-bind="value: laserSpeed">
|
||||
<input id="svgtogcode_feedrate" class="slider_manual_input" type="text" data-bind="value: laserSpeed, valueUpdate: 'keyup'">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue