How to change all blocks' size (make them bigger)

1,217 views
Skip to first unread message

Dmitriy Sherbina

unread,
Jul 14, 2014, 10:24:59 AM7/14/14
to blo...@googlegroups.com
Hi there.
For touch devices it's not so easy to control blocks with a finger, even on tablets.
Is there good way to enlarge all blocks, to make them bigger by setting some scale factor?
As I found there are few functions responsible for setting sizes

Blockly.BlockSvg.prototype.renderDraw_ , renderFields_

and as example with Blockly.RTL, by changing  this.svgPath_.setAttribute('transform', 'scale(2 2)') it's changes some parts of block but not all of them, need to change others, such as input connections.

Will be glad to receive some tips how to implement this currently.



Dmitriy Sherbina

unread,
Jul 15, 2014, 9:24:12 AM7/15/14
to blo...@googlegroups.com
I think I found a solution. It seems that modifying sources aren't best idea :)
So an easy way to scale it with using viewport 
<meta name="viewport" content="width=device-width; initial-scale=2; maximum-scale=2; user-scalable=0;" /> 
Picture seems pretty sharp, cause other methods gave not so clear picture. (iPad iOS 7, UIWebView with Safari)

phil cleaver

unread,
Jul 18, 2014, 4:43:31 AM7/18/14
to blo...@googlegroups.com
Hi,

use your zoom feature on your browser (keyboard shortcut for chrome it is ctrl and = )

phil
Message has been deleted

phil cleaver

unread,
Jul 30, 2014, 10:07:16 AM7/30/14
to blo...@googlegroups.com
Hi Dmitriy,

Did you get viewport to work correctly for you?  I'm trying in Chrome on windows it doesn't seem to change anything for me.  Does it just work on iThings???

Phil

Dmitriy Sherbina

unread,
Jul 30, 2014, 10:27:37 AM7/30/14
to blo...@googlegroups.com

Hi Phil

I'm using mobile browser Safari at iOS, so it's better to show it already scaled for user, without any additional interaction. 
Yep it works fine with viewport initial-scale. All blocks scaled smoothly as they are svg, except resource images as they are raster. 

11562...@qq.com

unread,
Feb 15, 2017, 9:26:35 PM2/15/17
to Blockly
modify Blockly.BlockSvg.INLINE_PADDING_Y and Blockly.BlockSvg.MIN_BLOCK_Y in block_render_svg, you could change the size of blocks, best wishes!

在 2014年7月14日星期一 UTC+8下午10:24:59,Dmitriy Sh写道:

Neil Fraser

unread,
Feb 16, 2017, 12:24:31 AM2/16/17
to blo...@googlegroups.com
This thread was started back in 2014, before there was support for zoom.  Today, the best way is to set startScale in the configuration:
https://developers.google.com/blockly/guides/configure/web/zoom

One of the tricks we use in Blockly Games is to make level 1 zoomed to 150%, then each level after gets slightly smaller until level 10 is at 100%.  This helps new users get accustomed to the blocks.

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



--

Sethuraman

unread,
Feb 16, 2017, 12:33:36 AM2/16/17
to Blockly
Hi you can use -- Workspace.zoomToFit() this will fit allblocks to fit in workspace frame 
Reply all
Reply to author
Forward
0 new messages