Skip to content

Conversation

@microbit-robert
Copy link
Collaborator

@microbit-robert microbit-robert commented Jan 23, 2025

A potential (low effort?) alternative to #8

The grid items look a bit odd due to a mixture of CSS that could be easily tweaked and the img attributes that MakeCode supply being taken seriously. The image data provided to the field editor is with height and width at 36px which is not straight forward to fix with CSS overrides as MakeCode normally uses 80% for this value rather than a hardcoded value in pixels.

Some things might be broken. I guess the proper way to do this is to have an internal FieldGridDropdown that extends Blockly.FieldGridDropdown, following the pattern for the FieldDropdown.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 23, 2025

Deploying review-pxt with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8ae7359
Status: ✅  Deploy successful!
Preview URL: https://40cd5760.review-pxt.pages.dev
Branch Preview URL: https://blockly-grid.review-pxt.pages.dev

View logs

Comment on lines +18 to +21
if (options.sort) {
options.data.sort()
}
super(text, {...options, columns: "4"}, validator);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very nice. Also not sure why columns isn't already on the options object?

const div = el as HTMLDivElement;
div.classList.add("blocklyDropDownButton");

// We need to find where this occurs and handle it.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And for the field_images.ts file as well.

@microbit-robert
Copy link
Collaborator Author

This is all rather horrible. The icon grid appears to be pixel perfect compared with the original. The gesture images are less so. There's something about the inherent browser styling of the button element that I can't completely match. The border colour is also wrong, but could be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants