--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
My block.js code section for the cursor x/y position block is:
Blockly.Language.draw_getcursorpos = {
// Block for getting the cursors x or y position
helpUrl: '',
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendTitle(new Blockly.FieldDropdown(this.STATE), 'POS');
this.setOutput(true, "Number");
this.setTooltip(BlocklyApps.getMsg('Shape_cursorPosTooltip'));
}
};
Blockly.Language.draw_getcursorpos.STATE =
[[BlocklyApps.getMsg('Shape_getCursorXPos'), 'getCursorXPos'],
[BlocklyApps.getMsg('Shape_getCursorYPos'), 'getCursorYPos']];
Blockly.JavaScript.draw_getcursorpos = function() {
// Generate JavaScript for returning the cursor x or y pos
return 'Shape.' + this.getTitleValue('POS') +
'(\'block_id_' + this.id + '\')';
};
It appears to generate the code accordingly. I want it to call one of the following JavaScript calls within the shape.js:
Shape.getCursorXPos = function(id) {
return Shape.x;
};
Shape.getCursorYPos = function(id) {
return Shape.y;
};