Consider adding get/setMetrics to the options struct when creating a workspace #4377
Labels
issue: feature request
Describes a new feature and why it should be added
Milestone
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.
The text was updated successfully, but these errors were encountered: