Change the width of all blocks

582 views
Skip to first unread message

Nimeshka Srimal

unread,
Aug 16, 2017, 7:14:56 AM8/16/17
to Blockly
Can someone guide me on how I can change the width of all blocks? I checked the block_svg.js and noticed that it has a width property. But changing that doesn't make any difference to me. Is there any other place I have to change? With the current size of the blocks, I feel there's too much whitespace around.

thanks,

Andrew n marshall

unread,
Aug 16, 2017, 1:00:43 PM8/16/17
to blo...@googlegroups.com
There are numerous constants related to block rendering. Several of them are found in block_render_svg.js. I don't know which specifically are related to width/padding, but I suspect it is several of them.

We recommend testing using playground.html in the test directory. The playground loads the raw, uncompressed sources, which should speed up your test and iterate loop, and isolate build related issues from actual code problems.
On Wed, Aug 16, 2017 at 4:14 AM, Nimeshka Srimal <nime...@gmail.com> wrote:
Can someone guide me on how I can change the width of all blocks? I checked the block_svg.js and noticed that it has a width property. But changing that doesn't make any difference to me. Is there any other place I have to change? With the current size of the blocks, I feel there's too much whitespace around.

thanks,

--
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.

Rachel Fenichel

unread,
Aug 16, 2017, 1:14:27 PM8/16/17
to Blockly
If you want to decrease whitespace/padding around everything, try changing Blockly.BlockSvg.SEP_SPACE_X and Blockly.BlockSvg.SEP_SPACE_Y.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

Nimeshka Srimal

unread,
Aug 17, 2017, 3:23:28 AM8/17/17
to Blockly
Hi Rachel,

Thanks for the tip. It indeed increase the block width. But the problem is it doesn't uniformly apply to all blocks, ie, it increases the spacing between the block's elements along the x coordinate. Also it makes issues with alignments etc.

Nimeshka Srimal

unread,
Aug 17, 2017, 3:27:30 AM8/17/17
to Blockly
Hi Andrew,

Thanks for the hint. It was in that file you mentioned and I managed to solve my issue by increasing the Blockly.BlockSvg.NOTCH_WIDTH and tweaking a few values inside the
Blockly.BlockSvg.prototype.renderCompute_ function.


To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages