Render

75 views
Skip to first unread message

STeEL

unread,
Feb 11, 2021, 12:53:01 PM2/11/21
to Blockly
Hi all,

How to update renderer dynamically? for instance, from minimalist to geras (like in playground). I tried update workspace render property but it did nothing :(. 


~STeEL~

Beka Westberg

unread,
Feb 11, 2021, 6:08:13 PM2/11/21
to blo...@googlegroups.com
Hello,

Because the render is part of the inject options, changing the renderer requires you to re-inject the workspace with a new set of options :/ This is what the playground does as well.

So when you want to change your renderer you'll have to do something like:
```
myWorkspace.dispose();
myWorkspace = Blockly.inject('blocklyDiv', {
  renderer: getRendererOption(),
  // etc...
});
```

I hope that helps! If you have any further questions please reply :D
--Beka

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/fdee9071-64ff-4fc6-a724-40feb10b4a14n%40googlegroups.com.

STeEL

unread,
Feb 16, 2021, 2:58:47 AM2/16/21
to Blockly
Thanks Beka,
It works :)

~STeEL~

Beka Westberg

unread,
Feb 16, 2021, 6:08:28 PM2/16/21
to blo...@googlegroups.com
My pleasure! I'm glad it's working for ya :D

Seb Seb

unread,
Sep 10, 2023, 6:10:38 AM9/10/23
to Blockly
Hello,
sorry to relaunch this discussion, this kind of solution  breaks plugins, because qwith this 'new' injection we need to reload any plugins (example with backpack).
Is it the method you use with advanced playground ?
For the theme, event if it's part of the inject options, there's the setTheme function. Is it possible to have a setRenderer for accessibility choice ? Something as simple as setTheme, without detrying things nor relaunch/reload.
Thanks a lot.

Beka Westberg

unread,
Sep 11, 2023, 12:21:20 PM9/11/23
to Blockly
Hello!

> Is it the method you use with advanced playground ?

For the advanced playground we do indeed destory and reinject the workspace every time =)

> Is it possible to have a setRenderer for accessibility choice ? Something as simple as setTheme, without detrying things nor relaunch/reload.

Yeah that may be possible! In the general case it's not possible to provide setters for every inject option (e.g. making the workspace readOnly requires removing a lot of event listeners, which makes it much more reasonable to just destory and reinject the workspace). But for a renderer it could work! I would recommend filing a feature request. Please mention specifically that this is for accessiblity reasons! Because that will help us prioritize.

Best wishes,
--Beka

Seb Seb

unread,
Sep 11, 2023, 4:42:33 PM9/11/23
to Blockly
Hello Beka,
Thank you very much for your reply and your availability.
So I have to use the same workspace destruction/injection method...but several plugins don't really support it... Hence my other questions on the forum (minimap and toolbox search).
I work with a lot of children and beginners, from 7 to 77 years old, I'm a teacher and workshop leader, so I come across a lot of cases. So I've tried to put all the answers to all the questions I've had in Studio4Education (https://github.com/A-S-T-U-C-E/STudio4Education).
Basically, what's useful for answering a lot of requests:
  • language, easily modifiable text to adapt to everyone's language
  • icons and/or text in the application
  • no drop-down menus
  • font
  • theme: font colour, background colour, icon colour
  • shape (renderer)
  • easy way to identify the category from which the block comes (icon, colour but to be avoided, special shape, plug-in like fustyle)
  • the size of each of the above elements can be modified as required
  • spacing between characters and lines (much more difficult to implement)
  • keyboard navigation
  • mouse-over and screen-reading capabilities
  • automatic variable typing (otherwise the logic is too complex)
Many of the plugins already available help to make Blockly easier to navigate.
Any help everybody can give on these issues is most welcome!
Reply all
Reply to author
Forward
0 new messages