--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I defined my block here, with two value inputs, then a statement input named HIDE_ME, then two more value inputs. I changed renderCompute_ in block_render_svg to check the name of each input and 1) not render an input named HIDE_ME and 2) make a new row if the previous input was named HIDE_ME. Here's the diff:
diff --git a/core/block_render_svg.js b/core/block_render_svg.js
index 14c42b0..07f3d0c 100644
--- a/core/block_render_svg.js
+++ b/core/block_render_svg.js
@@ -354,17 +354,20 @@ Blockly.BlockSvg.prototype.renderCompute_ = function(iconWidth) {
var hasStatement = false;
var hasDummy = false;
var lastType = undefined;
+ var lastName = '';
var isInline = this.getInputsInline() && !this.isCollapsed();
for (var i = 0, input; input = inputList[i]; i++) {
- if (!input.isVisible()) {
+ if (!input.isVisible() || input.name == 'HIDE_ME') {
+ lastName = input.name;
continue;
}
var row;
if (!isInline || !lastType ||
lastType == Blockly.NEXT_STATEMENT ||
- input.type == Blockly.NEXT_STATEMENT) {
+ input.type == Blockly.NEXT_STATEMENT || lastName == 'HIDE_ME') {
// Create new row.
lastType = input.type;
+ lastName = input.name;
row = [];
if (isInline && input.type != Blockly.NEXT_STATEMENT) {
row.type = Blockly.BlockSvg.INLINE;
Okay, messing around with this didn't work like I thought I did. I expected the dummy input to start a new line even when inlineInputs is set to true. Here is what I expected to work:https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#5g8sfzSeems like a valid case to cover, though in talking with Rachel, its probably not something we can add to our priority list.
On Thu, Nov 3, 2016 at 3:20 AM, Neil Fraser <ro...@neil.fraser.name> wrote:
Andrew, can you demonstrate what you mean in the Block Factory and provide an example? Thanks.
On 2 November 2016 at 23:36, Andrew n marshall <a...@anm.me> wrote:
This can be achieved by following each inlined input with an empty dummy input. If you're using JSON, its probably even easier to use multiple message/arg pairs, described here. Effectively, this inserts the dummy input automatically.
On Wed, Nov 2, 2016 at 6:50 PM, Daaron Dwyer <daa...@gmail.com> wrote:
Hello All,I'd like to create a block to inline a group of key-value pairs, somewhat like the text join block, but each line with 2 inputs.In effect, I'd like to inline every other field. Optimistically, I'd like to inline some inputs and inject a "newline" as a field in the block definition.Any thoughts?Cheers,Daaron
--
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/d/optout.
--
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.
--Neil Fraser
https://neil.fraser.name
--
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.