fixed position update bug and display horizontal and vertical bug

This commit is contained in:
make-ing 2015-09-23 16:42:49 +02:00
parent 563a85ac7e
commit c5aa726155
5 changed files with 17 additions and 13 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ OctoPrint.egg-info
/nbproject/
.directory
.project
out/

View file

@ -317,8 +317,8 @@ $(function(){
var endIdx = transform.local.indexOf(',', startIdx);
var rot = parseFloat(transform.local.substring(startIdx, endIdx)) || 0;
// if(!rot) rot = 0; // avoid NaN
var horizontal = self.px2mm(bbox.x2 - bbox.x);
var vertical = self.px2mm(bbox.y2 - bbox.y);
var horizontal = self.px2mm((bbox.x2 - bbox.x) * globalScale);
var vertical = self.px2mm((bbox.y2 - bbox.y) * globalScale);
var id = svg.attr('id');
var label_id = id.substr(0, id.indexOf('-'));
$('#'+label_id+' .translation').text(tx.toFixed(1) + ',' + ty.toFixed(1));

View file

@ -129,7 +129,7 @@ $(function() {
if (data == null) {
self.currentPos({x: 0, y: 0});
} else {
self.currentPos({x: data.workPosition[0], y: data.workPosition[1]});
self.currentPos({x: data[0], y: data[1]});
}
};
self._processStateData = function(data) {

View file

@ -216,13 +216,12 @@
<div class="local_transformation muted">
<i class="icon-move" title="{{ _('translation') }}"></i>
<span class="translation" >0,0</span>
<i class="icon-repeat" title="{{ _('rotation') }}"></i>
<span class="rotation" >0°</span></br>
<i class="icon-resize-horizontal" title="{{ _('horizontal') }}"></i>
<span class="horizontal" >0mm</span>
<i class="icon-resize-vertical" title="{{ _('vertical') }}"></i>
<span class="vertical" >0mm</span>
<i class="icon-repeat" title="{{ _('rotation') }}"></i>
<span class="rotation" >0°</span>
</div>
<div class="misfit_warning" >
<i class="icon-exclamation-sign" style="color:red;" title="{{ _('exceeds working area') }}"> Design exceeds the working area.</i>

View file

@ -2012,17 +2012,21 @@ class MachineCom(object):
#idx_laserstate_begin = line.index('laser ', idx_intensity_end) + 6
#idx_laserstate_end = line.index(':', idx_laserstate_begin)
payload = {
"mx": line[idx_mx_begin:idx_mx_end],
"my": line[idx_my_begin:idx_my_end],
#payload = {
#"mx": line[idx_mx_begin:idx_mx_end],
#"my": line[idx_my_begin:idx_my_end],
#"mz": line[idx_mz_begin:idx_mz_end],
"wx": line[idx_wx_begin:idx_wx_end],
"wy": line[idx_wy_begin:idx_wy_end],
#"wx": line[idx_wx_begin:idx_wx_end],
#"wy": line[idx_wy_begin:idx_wy_end],
#"wz": line[idx_wz_begin:idx_wz_end],
#"laser": line[idx_laserstate_begin:idx_laserstate_end],
#"intensity": line[idx_intensity_begin:idx_intensity_end]
}
self._callback.on_comm_pos_update([int(line[idx_mx_begin:idx_mx_end]), int(line[idx_my_begin:idx_my_end]), 0], [int(line[idx_wx_begin:idx_wx_end]), int(line[idx_wy_begin:idx_wy_end]), 0])
#}
mx = int(float(line[idx_mx_begin:idx_mx_end]))
my = int(float(line[idx_my_begin:idx_my_end]))
wx = int(float(line[idx_wx_begin:idx_wx_end]))
wy = int(float(line[idx_wy_begin:idx_wy_end]))
self._callback.on_comm_pos_update([mx, my, 0], [wx, wy, 0])
#eventManager().fire(Events.RT_STATE, payload)
except ValueError:
pass