0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 17:27:57 +01:00

Using onButtonClick only (preventing double print call) #174

This commit is contained in:
peteruithoven 2014-01-20 13:28:33 +01:00
parent 58eec424df
commit eef5307464

View File

@ -62,7 +62,7 @@ function initButtonBehavior() {
btnAdd.on("onButtonClick", onBtnAdd); btnAdd.on("onButtonClick", onBtnAdd);
btnWordArt.on("onButtonClick", onBtnWordArt); btnWordArt.on("onButtonClick", onBtnWordArt);
btnShape.on("onButtonClick", onBtnShape); btnShape.on("onButtonClick", onBtnShape);
btnPrint.on("onButtonClick", onBtnPrint); btnPrint.on("onButtonClick", print);
btnOops.on("onButtonHold", onBtnOops); btnOops.on("onButtonHold", onBtnOops);
// vertical shape buttons // vertical shape buttons
btnToggleVerticalShapes.on("onButtonClick", onBtnToggleVerticalShapes); btnToggleVerticalShapes.on("onButtonClick", onBtnToggleVerticalShapes);
@ -170,10 +170,6 @@ function initButtonBehavior() {
clearDoodle(); clearDoodle();
} }
function onBtnPrint(e) {
print();
}
function onBtnWordArt(e) { function onBtnWordArt(e) {
showWordArtDialog(); showWordArtDialog();
} }
@ -352,23 +348,17 @@ function setState(newState,newHasControl) {
// print button // print button
var printEnabled = (newState == Printer.IDLE_STATE && newHasControl); var printEnabled = (newState == Printer.IDLE_STATE && newHasControl);
if(printEnabled) { if(printEnabled) {
btnPrint.removeClass("disabled"); // enable print button enableButton(btnPrint,print);
btnPrint.unbind('touchstart mousedown');
btnPrint.bind('touchstart mousedown',print);
} else { } else {
btnPrint.addClass("disabled"); // disable print button disableButton(btnPrint);
btnPrint.unbind('touchstart mousedown');
} }
// stop button // stop button
var stopEnabled = ((newState == Printer.PRINTING_STATE || newState == Printer.BUFFERING_STATE) && newHasControl); var stopEnabled = ((newState == Printer.PRINTING_STATE || newState == Printer.BUFFERING_STATE) && newHasControl);
if(stopEnabled) { if(stopEnabled) {
btnStop.removeClass("disabled"); enableButton(btnStop,stopPrint);
btnStop.unbind('touchstart mousedown');
btnStop.bind('touchstart mousedown',stopPrint);
} else { } else {
btnStop.addClass("disabled"); disableButton(btnStop);
btnStop.unbind('touchstart mousedown');
} }
// thermometer // thermometer