Complex custom field editors?

Is there anyone who can explain how to construct a complex custom field editor? Something like a simple pixel editor which requires mouse clicks etc to create an image within a field within the block. I can really find nothing that helps me get started and all the code that might help me (the image editor for Microbits or Adafruit’s ring of coloured LEDs) is simply not accessible in whatever form it may be in.

There is no way for extensions to contribute field editors. We disallow that as a security measure; we don’t want extensions to run untrusted code inside of the webapp.

Hmm, I see. In that case can I request that you somehow add an accessible parameter to the standard image editor (5x5 pixels or 10x5 for big images) such that it is a bit more useful for larger images using blocks and/or Javascript?

Peli has already put changes into the beta for Makecode such that it’s possible to use the createImage() pixel editor with a custom size - and that more or less works - by removing some of the fixed references to row/column sizes as multiples of 5 within various parts of the core code.

However, it would be handy if the dimensions of the createImage() pixel editor were configurable such that a Makecode block (e.g part of an Extension for use with an LED or LCD display attached to a Microbit) could use it easily for custom-sized image but also have it display smaller and thus not clumsily occupy almost the entire web browser view, which a 24x24 image would probably do!

Could there be an accessible parameter with which the user-created block could, say, double the density of the pixels in the field editor? I don’t see anything more sophisticated than that being necessary.

@mkilpatr could you create an issue with that request on GitHub? Sounds reasonable to me

Certainly I’ll do that. Would I do that in the “pxt-microbit” repository or is there a more precise or different place, please?

I have created an issue/feature request here. I hope the way I’ve presented it is good. Thank you for your help, Richard.

1 Like