Commit ca6eb43a authored by Jennie Yoder's avatar Jennie Yoder

the cylinder block with lockable radii where you can lock an aspect ratio

for your cone (is that useful?) seems mostly functional.  Needs testing.
I deliberately left the code long (there are several edge cases that can
be combined) in case testing reveals that the edge cases actually do need
different code.
parent dd2d56d6
This diff is collapsed.
...@@ -35,6 +35,8 @@ Blockly.Blocks['cylinder'] = { ...@@ -35,6 +35,8 @@ Blockly.Blocks['cylinder'] = {
this.prevR1 = null; this.prevR1 = null;
this.prevR2 = null; this.prevR2 = null;
this.pRatio = null; this.pRatio = null;
this.pR1id = null;
this.pR2id = null;
this.setHelpUrl('http://www.example.com/'); this.setHelpUrl('http://www.example.com/');
this.setColourHex(Blockscad.Toolbox.HEX_3D_PRIMITIVE); this.setColourHex(Blockscad.Toolbox.HEX_3D_PRIMITIVE);
this.appendDummyInput() this.appendDummyInput()
...@@ -82,24 +84,27 @@ Blockly.Blocks['cylinder'] = { ...@@ -82,24 +84,27 @@ Blockly.Blocks['cylinder'] = {
var R1 = null; var R1 = null;
var R2 = null; var R2 = null;
var R1id = null;
var R2id = null;
// get the values (if any) attached to the two radius inputs. // get the values (if any) attached to the two radius inputs.
if (this.getInput('RAD1').connection.targetConnection && if (this.getInput('RAD1').connection.targetConnection &&
this.getInput('RAD1').connection.targetConnection.sourceBlock_.type == "math_number") this.getInput('RAD1').connection.targetConnection.sourceBlock_.type == "math_number") {
R1 = this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').getValue(); R1 = this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').getValue();
R1id = this.getInput('RAD1').connection.targetConnection.sourceBlock_.id;
}
if (this.getInput('RAD2').connection.targetConnection && if (this.getInput('RAD2').connection.targetConnection &&
this.getInput('RAD2').connection.targetConnection.sourceBlock_.type == "math_number") this.getInput('RAD2').connection.targetConnection.sourceBlock_.type == "math_number") {
R2 = this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').getValue(); R2 = this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').getValue();
R2id = this.getInput('RAD2').connection.targetConnection.sourceBlock_.id;
}
console.log("pRatio:" + this.pRatio + " R1:" + R1 + " R2:" + R2 + " pR1:" + this.prevR1 + " pR2:" + this.prevR2); console.log("pRatio:" + this.pRatio + " R1:" + R1 + " R2:" + R2 + " pR1:" + this.prevR1 + " pR2:" + this.prevR2);
// start diagnosing a change // start diagnosing a change
if (this.prevR1 == null && this.prevR2 == null) { if (this.prevR1 == null && this.prevR2 == null) {
// both previous blocks are null. This should only happen on brand new or reloaded blocks. // both previous blocks are null.
// there should be a workspace change that will trigger this code before
// anyone tries to type into the field.
console.log("initializing cylinder lock previous states");
this.prevR1 = R1; this.prevR1 = R1;
this.prevR2 = R2; this.prevR2 = R2;
this.pRatio = R1 / R2; this.updateRatio(R1,R2,R1id,R2id);
return; return;
} }
if (locked == 'FALSE') { if (locked == 'FALSE') {
...@@ -107,6 +112,7 @@ Blockly.Blocks['cylinder'] = { ...@@ -107,6 +112,7 @@ Blockly.Blocks['cylinder'] = {
console.log("cylinder is not locked"); console.log("cylinder is not locked");
this.prevR1 = R1; this.prevR1 = R1;
this.prevR2 = R2; this.prevR2 = R2;
this.updateRatio(R1,R2,R1id,R2id);
return; return;
} }
// past here, we know that locking is turned on and at least one block has a pState. // past here, we know that locking is turned on and at least one block has a pState.
...@@ -114,6 +120,7 @@ Blockly.Blocks['cylinder'] = { ...@@ -114,6 +120,7 @@ Blockly.Blocks['cylinder'] = {
// at least one of the blocks is null. no locking necessary, but update pStates. // at least one of the blocks is null. no locking necessary, but update pStates.
this.prevR1 = R1; this.prevR1 = R1;
this.prevR2 = R2; this.prevR2 = R2;
this.updateRatio(R1,R2,R1id,R2id);
return; return;
} }
...@@ -121,15 +128,24 @@ Blockly.Blocks['cylinder'] = { ...@@ -121,15 +128,24 @@ Blockly.Blocks['cylinder'] = {
if (this.prevR1 == null && R1) { if (this.prevR1 == null && R1) {
// R1 has a new block. Give it the value in block 2. This counts as a change? // R1 has a new block. Give it the value in block 2. This counts as a change?
this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').setValue(R2,true); // I changed my mind. Don't update the value, but if the two blocks have different values,
this.prevR1 = R2; // UNLOCK the lock. Can I do that?
made_change = true; // also, update the ratio.
//this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').setValue(R2,true);
this.prevR1 = R1;
this.updateRatio(R1,R2,R1id,R2id);
if (R1 != R2)
this.getField('LOCKED').setValue("FALSE");
//made_change = true;
} }
else if (this.prevR2 == null && R2) { else if (this.prevR2 == null && R2) {
// R2 has a new block. Give it the value in block 1. This counts as a change? // R2 has a new block. Give it the value in block 1. This counts as a change?
this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').setValue(R1,true); //this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').setValue(R1,true);
this.prevR2 = R1; this.prevR2 = R2;
made_change = true; this.updateRatio(R1,R2,R1id,R2id);
if (R1 != R2)
this.getField('LOCKED').setValue("FALSE");
//made_change = true;
} }
// I don't care about zeroes if using pRatio? // I don't care about zeroes if using pRatio?
// else if (R1 == 0 || R2 == 0 || this.prevR1 == 0 || this.prevR2 == 0) { // else if (R1 == 0 || R2 == 0 || this.prevR1 == 0 || this.prevR2 == 0) {
...@@ -139,10 +155,21 @@ Blockly.Blocks['cylinder'] = { ...@@ -139,10 +155,21 @@ Blockly.Blocks['cylinder'] = {
// this.prevR2 = R2; // this.prevR2 = R2;
// } // }
else if (R1 != this.prevR1) { else if (R1 != this.prevR1) {
if (this.pRatio != null) { // finally, I have two number blocks! One has a change! They are supposed to be locked!
// however, if one of the blocks has changed id, can I detect that?
if (R1id != this.pR1id) {
console.log("ids for R1 don't match - block swap?", R1id, this.pR1id);
// since I'm swapping blocks, I'll not change the numbers.
// however, if the numbers don't match, unlock the blocks.
this.prevR1 = R1;
this.updateRatio(R1,R2,R1id,R2id);
if (R1 != R2)
this.getField('LOCKED').setValue("FALSE");
}
else if (this.pRatio != null && !isNaN(R1) && isFinite(R1)) {
var newValue = Math.round(100 * R1 / this.pRatio) / 100; var newValue = Math.round(100 * R1 / this.pRatio) / 100;
this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').setValue(newValue,true); this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').setValue(newValue,true);
this.prevR2 = R1 / this.pRatio ; this.prevR2 = newValue;
this.prevR1 = R1; this.prevR1 = R1;
made_change = true; made_change = true;
console.log("making a change to 2"); console.log("making a change to 2");
...@@ -155,10 +182,21 @@ Blockly.Blocks['cylinder'] = { ...@@ -155,10 +182,21 @@ Blockly.Blocks['cylinder'] = {
} }
else if (R2 != this.prevR2) { else if (R2 != this.prevR2) {
if (this.pRatio != null) { // finally, I have two number blocks! One has a change! They are supposed to be locked!
// however, if one of the blocks has changed id, can I detect that?
if (R2id != this.pR2id) {
console.log("ids for R2 don't match - block swap?");
// since I'm swapping blocks, I'll not change the numbers.
// however, if the numbers don't match, unlock the blocks.
this.prevR2 = R2;
this.updateRatio(R1,R2,R1id,R2id);
if (R1 != R2)
this.getField('LOCKED').setValue("FALSE");
}
else if (this.pRatio != null && !isNaN(R2) && isFinite(R2)) {
var newValue = Math.round(100 * R2 * this.pRatio) / 100; var newValue = Math.round(100 * R2 * this.pRatio) / 100;
this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').setValue(newValue,true); this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').setValue(newValue,true);
this.prevR1 = R2 * this.pRatio; this.prevR1 = newValue;
this.prevR2 = R2; this.prevR2 = R2;
made_change = true; made_change = true;
console.log("making a change to 1"); console.log("making a change to 1");
...@@ -179,24 +217,36 @@ Blockly.Blocks['cylinder'] = { ...@@ -179,24 +217,36 @@ Blockly.Blocks['cylinder'] = {
console.log("calling cylinder onEditorClose()"); console.log("calling cylinder onEditorClose()");
var R1 = null; var R1 = null;
var R2 = null; var R2 = null;
// get the values (if any) attached to the two radius inputs.
if (this.getInput('RAD1').connection.targetConnection && if (this.getInput('RAD1').connection.targetConnection &&
this.getInput('RAD1').connection.targetConnection.sourceBlock_.type == "math_number") this.getInput('RAD1').connection.targetConnection.sourceBlock_.type == "math_number") {
R1 = this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').getValue(); R1 = this.getInput('RAD1').connection.targetConnection.sourceBlock_.getField('NUM').getValue();
R1id = this.getInput('RAD1').connection.targetConnection.sourceBlock_.id;
}
if (this.getInput('RAD2').connection.targetConnection && if (this.getInput('RAD2').connection.targetConnection &&
this.getInput('RAD2').connection.targetConnection.sourceBlock_.type == "math_number") this.getInput('RAD2').connection.targetConnection.sourceBlock_.type == "math_number") {
R2 = this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').getValue(); R2 = this.getInput('RAD2').connection.targetConnection.sourceBlock_.getField('NUM').getValue();
R2id = this.getInput('RAD2').connection.targetConnection.sourceBlock_.id;
}
this.updateRatio(R1,R2,R1id,R2id);
if (R1 == R2) },
updateRatio: function(R1,R2,R1id,R2id) {
this.pR1id = R1id;
this.pR2id = R2id;
if (R1 == null || R2 == null) // one of the blocks is missing (or is a variable).
this.pRatio = null;
else if (R1 == R2)
this.pRatio = 1; this.pRatio = 1;
else if (R1 != 0 && R2 != 0) else if (R1 != 0 && R2 != 0)
this.pRatio = R1 / R2; this.pRatio = R1 / R2;
else { else
// one of R1 or R2 is zero. Have a special ratio for that. // one of R1 or R2 is zero. Have a special ratio for that.
this.pRatio = null; this.pRatio = null;
}
console.log("changing pRatio");
console.log("pRatio:" + this.pRatio + " R1:" + R1 + " R2:" + R2 + " pR1:" + this.prevR1 + " pR2:" + this.prevR2); console.log("pRatio:" + this.pRatio + " R1:" + R1 + " R2:" + R2 + " pR1:" + this.prevR1 + " pR2:" + this.prevR2);
console.log("reset block ids:", this.pR1id, this.pR2id);
} }
}; };
......
This diff is collapsed.
...@@ -33,11 +33,11 @@ Blockly.OpenSCAD['cylinder'] = function(block) { ...@@ -33,11 +33,11 @@ Blockly.OpenSCAD['cylinder'] = function(block) {
if (value_rad1 && value_rad1 <= 0) { if (value_rad1 && value_rad1 <= 0) {
if (value_rad2 && value_rad2 <= 0) { if (value_rad2 && value_rad2 <= 0) {
Blockscad.illegalValue.push(block.inputList[1].connection.targetBlock().id); Blockscad.illegalValue.push(block.inputList[1].connection.targetBlock().id);
Blockscad.illegalValue.push(block.inputList[2].connection.targetBlock().id); Blockscad.illegalValue.push(block.inputList[3].connection.targetBlock().id);
} }
} }
if (value_height && value_height <= 0) if (value_height && value_height <= 0)
Blockscad.illegalValue.push(block.inputList[3].connection.targetBlock().id); Blockscad.illegalValue.push(block.inputList[4].connection.targetBlock().id);
var code = 'cylinder(' + 'r1=' + value_rad1 + ', r2=' + value_rad2 + ', h=' + value_height +', center=' + dropdown_center + ');'; var code = 'cylinder(' + 'r1=' + value_rad1 + ', r2=' + value_rad2 + ', h=' + value_height +', center=' + dropdown_center + ');';
return code; return code;
......
...@@ -65,8 +65,8 @@ Blockly.OpenSCAD.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){ ...@@ -65,8 +65,8 @@ Blockly.OpenSCAD.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){
b;}return a.getParent()?[b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//"+b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};Blockly.OpenSCAD.math_modulo=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"DIVIDEND",Blockly.OpenSCAD.ORDER_MODULUS)||"0",c=Blockly.OpenSCAD.valueToCode(a,"DIVISOR",Blockly.OpenSCAD.ORDER_MODULUS)||"0",b=b+" % "+c;return a.getParent()?[b,Blockly.OpenSCAD.ORDER_MODULUS]:["//"+b,Blockly.OpenSCAD.ORDER_MODULUS]}; b;}return a.getParent()?[b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//"+b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};Blockly.OpenSCAD.math_modulo=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"DIVIDEND",Blockly.OpenSCAD.ORDER_MODULUS)||"0",c=Blockly.OpenSCAD.valueToCode(a,"DIVISOR",Blockly.OpenSCAD.ORDER_MODULUS)||"0",b=b+" % "+c;return a.getParent()?[b,Blockly.OpenSCAD.ORDER_MODULUS]:["//"+b,Blockly.OpenSCAD.ORDER_MODULUS]};
Blockly.OpenSCAD.math_constrain=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"VALUE",Blockly.OpenSCAD.ORDER_COMMA)||"0",c=Blockly.OpenSCAD.valueToCode(a,"LOW",Blockly.OpenSCAD.ORDER_COMMA)||"0",d=Blockly.OpenSCAD.valueToCode(a,"HIGH",Blockly.OpenSCAD.ORDER_COMMA)||"Infinity",b="min(max("+b+", "+c+"), "+d+")";return a.getParent()?[b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//"+b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]}; Blockly.OpenSCAD.math_constrain=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"VALUE",Blockly.OpenSCAD.ORDER_COMMA)||"0",c=Blockly.OpenSCAD.valueToCode(a,"LOW",Blockly.OpenSCAD.ORDER_COMMA)||"0",d=Blockly.OpenSCAD.valueToCode(a,"HIGH",Blockly.OpenSCAD.ORDER_COMMA)||"Infinity",b="min(max("+b+", "+c+"), "+d+")";return a.getParent()?[b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//"+b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};
Blockly.OpenSCAD.math_random_int=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"FROM",Blockly.OpenSCAD.ORDER_COMMA)||"0",c=Blockly.OpenSCAD.valueToCode(a,"TO",Blockly.OpenSCAD.ORDER_COMMA)||"0",b="round(rands("+b+","+c+",1)[0])";return a.getParent()?[b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//"+b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};Blockly.OpenSCAD.math_random_float=function(a){return a.getParent()?["rands(0,1,1)[0]",Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//rands(0,1,1)[0]",Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};Blockly.OpenSCAD.primitives={};Blockly.OpenSCAD.sphere=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"RAD",Blockly.OpenSCAD.ORDER_ATOMIC);b||Blockscad.missingFields.push(a.id);b&&0>=b&&Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id);return"sphere(r="+b+");"}; Blockly.OpenSCAD.math_random_int=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"FROM",Blockly.OpenSCAD.ORDER_COMMA)||"0",c=Blockly.OpenSCAD.valueToCode(a,"TO",Blockly.OpenSCAD.ORDER_COMMA)||"0",b="round(rands("+b+","+c+",1)[0])";return a.getParent()?[b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//"+b,Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};Blockly.OpenSCAD.math_random_float=function(a){return a.getParent()?["rands(0,1,1)[0]",Blockly.OpenSCAD.ORDER_FUNCTION_CALL]:["//rands(0,1,1)[0]",Blockly.OpenSCAD.ORDER_FUNCTION_CALL]};Blockly.OpenSCAD.primitives={};Blockly.OpenSCAD.sphere=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"RAD",Blockly.OpenSCAD.ORDER_ATOMIC);b||Blockscad.missingFields.push(a.id);b&&0>=b&&Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id);return"sphere(r="+b+");"};
Blockly.OpenSCAD.cylinder=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"RAD1",Blockly.OpenSCAD.ORDER_ATOMIC),c=Blockly.OpenSCAD.valueToCode(a,"RAD2",Blockly.OpenSCAD.ORDER_ATOMIC),d=Blockly.OpenSCAD.valueToCode(a,"HEIGHT",Blockly.OpenSCAD.ORDER_ATOMIC),e=a.getFieldValue("CENTERDROPDOWN");b&&c&&d||Blockscad.missingFields.push(a.id);b&&0>=b&&c&&0>=c&&(Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id),Blockscad.illegalValue.push(a.inputList[2].connection.targetBlock().id)); Blockly.OpenSCAD.cylinder=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"RAD1",Blockly.OpenSCAD.ORDER_ATOMIC),c=Blockly.OpenSCAD.valueToCode(a,"RAD2",Blockly.OpenSCAD.ORDER_ATOMIC),d=Blockly.OpenSCAD.valueToCode(a,"HEIGHT",Blockly.OpenSCAD.ORDER_ATOMIC),e=a.getFieldValue("CENTERDROPDOWN");b&&c&&d||Blockscad.missingFields.push(a.id);b&&0>=b&&c&&0>=c&&(Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id),Blockscad.illegalValue.push(a.inputList[3].connection.targetBlock().id));
d&&0>=d&&Blockscad.illegalValue.push(a.inputList[3].connection.targetBlock().id);return"cylinder(r1="+b+", r2="+c+", h="+d+", center="+e+");"}; d&&0>=d&&Blockscad.illegalValue.push(a.inputList[4].connection.targetBlock().id);return"cylinder(r1="+b+", r2="+c+", h="+d+", center="+e+");"};
Blockly.OpenSCAD.simple_cylinder=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"RAD1",Blockly.OpenSCAD.ORDER_ATOMIC),c=Blockly.OpenSCAD.valueToCode(a,"HEIGHT",Blockly.OpenSCAD.ORDER_ATOMIC),d=a.getFieldValue("CENTERDROPDOWN");b&&c||Blockscad.missingFields.push(a.id);b&&0>=b&&Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id);c&&0>=c&&Blockscad.illegalValue.push(a.inputList[3].connection.targetBlock().id);return"cylinder(r="+b+", h="+c+", center="+d+");"}; Blockly.OpenSCAD.simple_cylinder=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"RAD1",Blockly.OpenSCAD.ORDER_ATOMIC),c=Blockly.OpenSCAD.valueToCode(a,"HEIGHT",Blockly.OpenSCAD.ORDER_ATOMIC),d=a.getFieldValue("CENTERDROPDOWN");b&&c||Blockscad.missingFields.push(a.id);b&&0>=b&&Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id);c&&0>=c&&Blockscad.illegalValue.push(a.inputList[3].connection.targetBlock().id);return"cylinder(r="+b+", h="+c+", center="+d+");"};
Blockly.OpenSCAD.cube=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"XVAL",Blockly.OpenSCAD.ORDER_ATOMIC),c=Blockly.OpenSCAD.valueToCode(a,"YVAL",Blockly.OpenSCAD.ORDER_ATOMIC),d=Blockly.OpenSCAD.valueToCode(a,"ZVAL",Blockly.OpenSCAD.ORDER_ATOMIC),e=a.getFieldValue("CENTERDROPDOWN");b&&c&&d||Blockscad.missingFields.push(a.id);b&&0>=b&&Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id);c&&0>=c&&Blockscad.illegalValue.push(a.inputList[2].connection.targetBlock().id);d&&0>=d&& Blockly.OpenSCAD.cube=function(a){var b=Blockly.OpenSCAD.valueToCode(a,"XVAL",Blockly.OpenSCAD.ORDER_ATOMIC),c=Blockly.OpenSCAD.valueToCode(a,"YVAL",Blockly.OpenSCAD.ORDER_ATOMIC),d=Blockly.OpenSCAD.valueToCode(a,"ZVAL",Blockly.OpenSCAD.ORDER_ATOMIC),e=a.getFieldValue("CENTERDROPDOWN");b&&c&&d||Blockscad.missingFields.push(a.id);b&&0>=b&&Blockscad.illegalValue.push(a.inputList[1].connection.targetBlock().id);c&&0>=c&&Blockscad.illegalValue.push(a.inputList[2].connection.targetBlock().id);d&&0>=d&&
Blockscad.illegalValue.push(a.inputList[3].connection.targetBlock().id);return"cube(["+b+", "+c+", "+d+"], center="+e+");"}; Blockscad.illegalValue.push(a.inputList[3].connection.targetBlock().id);return"cube(["+b+", "+c+", "+d+"], center="+e+");"};
......
...@@ -923,7 +923,7 @@ Blockscad.isRealChange = function() { ...@@ -923,7 +923,7 @@ Blockscad.isRealChange = function() {
Blockscad.workspaceChanged = function () { Blockscad.workspaceChanged = function () {
Blockscad.undo.yesthis = 0; // I don't know if this is a real change yet. Blockscad.undo.yesthis = 0; // I don't know if this is a real change yet.
console.log("workspace has changed from Undo calls\n"); //console.log("workspace has changed\n");
// important - check to see if the change is one we want to make undoable! // important - check to see if the change is one we want to make undoable!
Blockscad.undo.blockList = Blockly.mainWorkspace.getAllBlocks(); Blockscad.undo.blockList = Blockly.mainWorkspace.getAllBlocks();
//console.log("here's the current blocks in the workspace:",Blockscad.undo.blockList); //console.log("here's the current blocks in the workspace:",Blockscad.undo.blockList);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment