bugfix. don't send move commands while printing state
This commit is contained in:
parent
73da6e57de
commit
3746ecd17b
2 changed files with 15 additions and 12 deletions
|
|
@ -89,16 +89,19 @@ $(function(){
|
|||
};
|
||||
|
||||
self.move_laser = function(el){
|
||||
var x = self.px2mm(event.offsetX);
|
||||
// var y = self.px2mm(event.toElement.offsetHeight - event.offsetY); // toElement.offsetHeight is always 0 on svg>* elements ???
|
||||
var y = self.px2mm(event.toElement.ownerSVGElement.offsetHeight - event.offsetY); // hopefully this works across browsers
|
||||
$.ajax({
|
||||
url: API_BASEURL + "printer/printhead",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
data: JSON.stringify({"command": "position", x:x, y:y})
|
||||
});
|
||||
console.log(self.state.isOperational(), self.state.isPrinting() , "OP");
|
||||
if(self.state.isOperational() && !self.state.isPrinting()){
|
||||
var x = self.px2mm(event.offsetX);
|
||||
// var y = self.px2mm(event.toElement.offsetHeight - event.offsetY); // toElement.offsetHeight is always 0 on svg>* elements ???
|
||||
var y = self.px2mm(event.toElement.ownerSVGElement.offsetHeight - event.offsetY); // hopefully this works across browsers
|
||||
$.ajax({
|
||||
url: API_BASEURL + "printer/printhead",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
data: JSON.stringify({"command": "position", x:x, y:y})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -288,8 +288,7 @@
|
|||
|
||||
<div class="span8">
|
||||
<svg id="area_preview" class="workingarea"
|
||||
data-bind="xclick: move_laser,
|
||||
style: {
|
||||
data-bind="style: {
|
||||
backgroundPosition: crosshairX()+'px'+' '+crosshairY()+'px',
|
||||
width: workingAreaWidthPx()+'px',
|
||||
height: workingAreaHeightPx()+'px'
|
||||
|
|
@ -300,6 +299,7 @@
|
|||
id="coordGrid" x="0" y="0" width="0" height="0"
|
||||
stroke="none" fill="none"></rect>
|
||||
<g id="userContent"></g>
|
||||
<g id="gCodePreview"></g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue