Setting default options in workspace constructor. (#3592)

* Setting default options in workspace constructor.

* Changing logic for parsing workspace options.

* Adding gridPattern declaration to options and updating options handling for workspace.

* Addressing PR comments.

* Moving objects to constructor.

* Using constructor instead of casting for Blockly.Options.

* fix eslint

* Adding types.

* Change in type.

* eslint fix.

* Fix typings.
This commit is contained in:
Monica Kozbial
2020-01-17 15:16:20 -08:00
committed by alschmiedt
parent 1a2fb6ddf0
commit c84ee46a89
9 changed files with 97 additions and 75 deletions

View File

@@ -87,11 +87,7 @@ Blockly.Options = function(options) {
horizontalLayout = false;
}
var toolboxAtStart = options['toolboxPosition'];
if (toolboxAtStart === 'end') {
toolboxAtStart = false;
} else {
toolboxAtStart = true;
}
toolboxAtStart = toolboxAtStart !== 'end';
if (horizontalLayout) {
var toolboxPosition = toolboxAtStart ?
@@ -146,6 +142,20 @@ Blockly.Options = function(options) {
this.theme = Blockly.Options.parseThemeOptions_(options);
this.keyMap = keyMap;
this.renderer = renderer;
/**
* The SVG element for the grid pattern.
* Created during injection.
* @type {!SVGElement}
*/
this.gridPattern = undefined;
/**
* The parent of the current workspace, or null if there is no parent
* workspace.
* @type {Blockly.Workspace}
*/
this.parentWorkspace = null;
};
/**
@@ -155,12 +165,6 @@ Blockly.Options = function(options) {
*/
Blockly.BlocklyOptions = function() {};
/**
* The parent of the current workspace, or null if there is no parent workspace.
* @type {Blockly.Workspace}
*/
Blockly.Options.prototype.parentWorkspace = null;
/**
* If set, sets the translation of the workspace to match the scrollbars.
* @param {!Object} xyRatio Contains an x and/or y property which is a float