Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding get/setMetrics to the options struct when creating a workspace #4377

Closed
maribethb opened this issue Oct 16, 2020 · 0 comments
Labels
issue: feature request Describes a new feature and why it should be added

Comments

@maribethb
Copy link
Contributor

In options.js, the setting for changing the getMetrics and setMetrics functions are set directly on the prototype and there is no parsing code that can read it from the json you pass to Blockly.inject. You can set them once you have a Blockly.Options object, but since inject handles both creating the Options object and creating the workspace with said object, you have no chance to set it before it is used.

This would be helpful for situations like the workaround to #4376. Right now you have to reach into your already-created workspace and change the getMetrics function after initialization. Even though it's a setting in the Blockly.Options object, there is no way to set it there before the workspace consumes it.

We should consider adding parsing logic to Blockly.Options. I think the reason this isn't done is to keep the options object you pass to inject as pure json, but maybe the tradeoff is worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: feature request Describes a new feature and why it should be added
Projects
None yet
Development

No branches or pull requests

3 participants