mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Normalize comments
This commit is contained in:
@@ -263,13 +263,13 @@ Blockly.Block = function(workspace, prototypeName, opt_id) {
|
||||
Blockly.Block.CommentModel;
|
||||
|
||||
/**
|
||||
* The language-neutral id given to the collapsed input.
|
||||
* The language-neutral ID given to the collapsed input.
|
||||
* @const {string}
|
||||
*/
|
||||
Blockly.Block.COLLAPSED_INPUT_NAME = Blockly.constants.COLLAPSED_INPUT_NAME;
|
||||
|
||||
/**
|
||||
* The language-neutral id given to the collapsed field.
|
||||
* The language-neutral ID given to the collapsed field.
|
||||
* @const {string}
|
||||
*/
|
||||
Blockly.Block.COLLAPSED_FIELD_NAME = Blockly.constants.COLLAPSED_FIELD_NAME;
|
||||
|
||||
@@ -1709,9 +1709,9 @@ Blockly.BlockSvg.prototype.updateConnectionLocations_ = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this block's svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* block svg group.
|
||||
* Add the cursor SVG to this block's SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* block SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setCursorSvg = function(cursorSvg) {
|
||||
@@ -1719,9 +1719,9 @@ Blockly.BlockSvg.prototype.setCursorSvg = function(cursorSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the marker svg to this block's svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* block svg group.
|
||||
* Add the marker SVG to this block's SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* block SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setMarkerSvg = function(markerSvg) {
|
||||
|
||||
@@ -221,13 +221,13 @@ Blockly.RENAME_VARIABLE_ID = 'RENAME_VARIABLE_ID';
|
||||
Blockly.DELETE_VARIABLE_ID = 'DELETE_VARIABLE_ID';
|
||||
|
||||
/**
|
||||
* The language-neutral id given to the collapsed input.
|
||||
* The language-neutral ID given to the collapsed input.
|
||||
* @const {string}
|
||||
*/
|
||||
Blockly.constants.COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT';
|
||||
|
||||
/**
|
||||
* The language-neutral id given to the collapsed field.
|
||||
* The language-neutral ID given to the collapsed field.
|
||||
* @const {string}
|
||||
*/
|
||||
Blockly.constants.COLLAPSED_FIELD_NAME = '_TEMP_COLLAPSED_FIELD';
|
||||
|
||||
@@ -215,7 +215,7 @@ Blockly.ContextMenuItems.getDeletableBlocks_ = function(workspace) {
|
||||
|
||||
/** Deletes the given blocks. Used to delete all blocks in the workspace.
|
||||
* @param {!Array.<!Blockly.BlockSvg>} deleteList list of blocks to delete.
|
||||
* @param {string} eventGroup event group id with which all delete events should be associated.
|
||||
* @param {string} eventGroup event group ID with which all delete events should be associated.
|
||||
* @private
|
||||
*/
|
||||
Blockly.ContextMenuItems.deleteNext_ = function(deleteList, eventGroup) {
|
||||
|
||||
@@ -93,7 +93,7 @@ Blockly.ContextMenuRegistry.registry = null;
|
||||
/**
|
||||
* Registers a RegistryItem.
|
||||
* @param {!Blockly.ContextMenuRegistry.RegistryItem} item Context menu item to register.
|
||||
* @throws {Error} if an item with the given id already exists.
|
||||
* @throws {Error} if an item with the given ID already exists.
|
||||
*/
|
||||
Blockly.ContextMenuRegistry.prototype.register = function(item) {
|
||||
if (this.registry_[item.id]) {
|
||||
@@ -103,9 +103,9 @@ Blockly.ContextMenuRegistry.prototype.register = function(item) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Unregisters a RegistryItem with the given id.
|
||||
* @param {string} id The id of the RegistryItem to remove.
|
||||
* @throws {Error} if an item with the given id does not exist.
|
||||
* Unregisters a RegistryItem with the given ID.
|
||||
* @param {string} id The ID of the RegistryItem to remove.
|
||||
* @throws {Error} if an item with the given ID does not exist.
|
||||
*/
|
||||
Blockly.ContextMenuRegistry.prototype.unregister = function(id) {
|
||||
if (this.registry_[id]) {
|
||||
@@ -116,7 +116,7 @@ Blockly.ContextMenuRegistry.prototype.unregister = function(id) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} id The id of the RegistryItem to get.
|
||||
* @param {string} id The ID of the RegistryItem to get.
|
||||
* @returns {?Blockly.ContextMenuRegistry.RegistryItem} RegistryItem or null if not found
|
||||
*/
|
||||
Blockly.ContextMenuRegistry.prototype.getItem = function(id) {
|
||||
|
||||
@@ -52,7 +52,7 @@ Blockly.Events.Abstract = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether or not the event is a ui event.
|
||||
* Whether or not the event is a UI event.
|
||||
* @type {boolean}
|
||||
*/
|
||||
Blockly.Events.Abstract.prototype.isUiEvent = false;
|
||||
|
||||
@@ -20,9 +20,9 @@ goog.require('Blockly.utils.object');
|
||||
|
||||
/**
|
||||
* Class for a selected event.
|
||||
* @param {?string=} opt_oldElementId The id of the previously selected
|
||||
* @param {?string=} opt_oldElementId The ID of the previously selected
|
||||
* element. Null if no element last selected. Undefined for a blank event.
|
||||
* @param {?string=} opt_newElementId The id of the selected element. Null if no
|
||||
* @param {?string=} opt_newElementId The ID of the selected element. Null if no
|
||||
* element currently selected (deselect). Undefined for a blank event.
|
||||
* @param {string=} opt_workspaceId The workspace identifier for this event.
|
||||
* Null if no element previously selected. Undefined for a blank event.
|
||||
|
||||
@@ -1044,8 +1044,8 @@ Blockly.Field.prototype.onShortcut = function(_shortcut) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this fields svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* Add the cursor SVG to this fields SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* field group.
|
||||
* @package
|
||||
*/
|
||||
@@ -1060,8 +1060,8 @@ Blockly.Field.prototype.setCursorSvg = function(cursorSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the marker svg to this fields svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* Add the marker SVG to this fields SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* field group.
|
||||
* @package
|
||||
*/
|
||||
|
||||
@@ -347,7 +347,7 @@ Blockly.FieldAngle.prototype.dropdownCreate_ = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Disposes of events and dom-references belonging to the angle editor.
|
||||
* Disposes of events and DOM-references belonging to the angle editor.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldAngle.prototype.dropdownDispose_ = function() {
|
||||
|
||||
@@ -572,7 +572,7 @@ Blockly.FieldColour.prototype.dropdownCreate_ = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Disposes of events and dom-references belonging to the colour editor.
|
||||
* Disposes of events and DOM-references belonging to the colour editor.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldColour.prototype.dropdownDispose_ = function() {
|
||||
|
||||
@@ -362,7 +362,7 @@ Blockly.FieldDropdown.prototype.dropdownCreate_ = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Disposes of events and dom-references belonging to the dropdown editor.
|
||||
* Disposes of events and DOM-references belonging to the dropdown editor.
|
||||
* @private
|
||||
*/
|
||||
Blockly.FieldDropdown.prototype.dropdownDispose_ = function() {
|
||||
|
||||
@@ -109,8 +109,8 @@ Blockly.FieldLabel.prototype.doClassValidation_ = function(opt_newValue) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the css class applied to the field's textElement_.
|
||||
* @param {?string} cssClass The new css class name, or null to remove.
|
||||
* Set the CSS class applied to the field's textElement_.
|
||||
* @param {?string} cssClass The new CSS class name, or null to remove.
|
||||
*/
|
||||
Blockly.FieldLabel.prototype.setClass = function(cssClass) {
|
||||
if (this.textElement_) {
|
||||
|
||||
@@ -389,7 +389,7 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() {
|
||||
|
||||
/**
|
||||
* Closes the editor, saves the results, and disposes of any events or
|
||||
* dom-references belonging to the editor.
|
||||
* DOM-references belonging to the editor.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.FieldTextInput.prototype.widgetDispose_ = function() {
|
||||
@@ -490,8 +490,8 @@ Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function(_e) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the html input value and the field's internal value. The difference
|
||||
* between this and ``setValue`` is that this also updates the html input
|
||||
* Set the HTML input value and the field's internal value. The difference
|
||||
* between this and ``setValue`` is that this also updates the HTML input
|
||||
* value whilst editing.
|
||||
* @param {*} newValue New value.
|
||||
* @protected
|
||||
@@ -538,10 +538,10 @@ Blockly.FieldTextInput.prototype.isTabNavigable = function() {
|
||||
|
||||
/**
|
||||
* Use the `getText_` developer hook to override the field's text representation.
|
||||
* When we're currently editing, return the current html value instead.
|
||||
* When we're currently editing, return the current HTML value instead.
|
||||
* Otherwise, return null which tells the field to use the default behaviour
|
||||
* (which is a string cast of the field's value).
|
||||
* @return {?string} The html value if we're editing, otherwise null.
|
||||
* @return {?string} The HTML value if we're editing, otherwise null.
|
||||
* @protected
|
||||
* @override
|
||||
*/
|
||||
@@ -554,12 +554,12 @@ Blockly.FieldTextInput.prototype.getText_ = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Transform the provided value into a text to show in the html input.
|
||||
* Override this method if the field's html input representation is different
|
||||
* Transform the provided value into a text to show in the HTML input.
|
||||
* Override this method if the field's HTML input representation is different
|
||||
* than the field's value. This should be coupled with an override of
|
||||
* `getValueFromEditorText_`.
|
||||
* @param {*} value The value stored in this field.
|
||||
* @return {string} The text to show on the html input.
|
||||
* @return {string} The text to show on the HTML input.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.FieldTextInput.prototype.getEditorText_ = function(value) {
|
||||
@@ -567,12 +567,12 @@ Blockly.FieldTextInput.prototype.getEditorText_ = function(value) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Transform the text received from the html input into a value to store
|
||||
* Transform the text received from the HTML input into a value to store
|
||||
* in this field.
|
||||
* Override this method if the field's html input representation is different
|
||||
* Override this method if the field's HTML input representation is different
|
||||
* than the field's value. This should be coupled with an override of
|
||||
* `getEditorText_`.
|
||||
* @param {string} text Text received from the html input.
|
||||
* @param {string} text Text received from the HTML input.
|
||||
* @return {*} The value to store.
|
||||
* @protected
|
||||
*/
|
||||
|
||||
@@ -251,9 +251,9 @@ Blockly.FieldVariable.prototype.getValidator = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensure that the id belongs to a valid variable of an allowed type.
|
||||
* @param {*=} opt_newValue The id of the new variable to set.
|
||||
* @return {?string} The validated id, or null if invalid.
|
||||
* Ensure that the ID belongs to a valid variable of an allowed type.
|
||||
* @param {*=} opt_newValue The ID of the new variable to set.
|
||||
* @return {?string} The validated ID, or null if invalid.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.FieldVariable.prototype.doClassValidation_ = function(opt_newValue) {
|
||||
|
||||
@@ -232,8 +232,8 @@ Blockly.Flyout.prototype.dragAngleRange_ = 70;
|
||||
|
||||
/**
|
||||
* Creates the flyout's DOM. Only needs to be called once. The flyout can
|
||||
* either exist as its own svg element or be a g element nested inside a
|
||||
* separate svg element.
|
||||
* either exist as its own SVG element or be a g element nested inside a
|
||||
* separate SVG element.
|
||||
* @param {string|
|
||||
* !Blockly.utils.Svg<!SVGSVGElement>|
|
||||
* !Blockly.utils.Svg<!SVGGElement>} tagName The type of tag to
|
||||
|
||||
@@ -108,7 +108,7 @@ Blockly.Grid.prototype.getSpacing = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the id of the pattern element, which should be randomized to avoid
|
||||
* Get the ID of the pattern element, which should be randomized to avoid
|
||||
* conflicts with other Blockly instances on the page.
|
||||
* @return {string} The pattern ID.
|
||||
* @package
|
||||
|
||||
@@ -34,16 +34,16 @@ Blockly.IASTNodeLocation = function() {};
|
||||
Blockly.IASTNodeLocationSvg = function() {};
|
||||
|
||||
/**
|
||||
* Add the marker svg to this node's svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* svg group.
|
||||
* Add the marker SVG to this node's SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* SVG group.
|
||||
*/
|
||||
Blockly.IASTNodeLocationSvg.prototype.setMarkerSvg;
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this node's svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* svg group.
|
||||
* Add the cursor SVG to this node's SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* SVG group.
|
||||
*/
|
||||
Blockly.IASTNodeLocationSvg.prototype.setCursorSvg;
|
||||
|
||||
|
||||
@@ -69,17 +69,17 @@ Blockly.IMetricsManager.prototype.getFlyoutMetrics;
|
||||
Blockly.IMetricsManager.prototype.getToolboxMetrics;
|
||||
|
||||
/**
|
||||
* Gets the width and height of the workspace's parent svg element in pixel
|
||||
* Gets the width and height of the workspace's parent SVG element in pixel
|
||||
* coordinates. This area includes the toolbox and the visible workspace area.
|
||||
* @return {!Blockly.utils.Size} The width and height of the workspace's parent
|
||||
* svg element.
|
||||
* SVG element.
|
||||
* @public
|
||||
*/
|
||||
Blockly.IMetricsManager.prototype.getSvgMetrics;
|
||||
|
||||
/**
|
||||
* Gets the absolute left and absolute top in pixel coordinates.
|
||||
* This is where the visible workspace starts in relation to the svg container.
|
||||
* This is where the visible workspace starts in relation to the SVG container.
|
||||
* @return {!Blockly.MetricsManager.AbsoluteMetrics} The absolute metrics for
|
||||
* the workspace.
|
||||
* @public
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview The interface for a positionable ui element.
|
||||
* @fileoverview The interface for a positionable UI element.
|
||||
* @author kozbial@google.com (Monica Kozbial)
|
||||
*/
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Blockly.IToolboxItem = function() {};
|
||||
|
||||
/**
|
||||
* Initializes the toolbox item.
|
||||
* This includes creating the dom and updating the state of any items based
|
||||
* This includes creating the DOM and updating the state of any items based
|
||||
* on the info object.
|
||||
* @return {void}
|
||||
* @public
|
||||
@@ -42,7 +42,7 @@ Blockly.IToolboxItem.prototype.getDiv;
|
||||
|
||||
/**
|
||||
* Gets a unique identifier for this toolbox item.
|
||||
* @return {string} The id for the toolbox item.
|
||||
* @return {string} The ID for the toolbox item.
|
||||
* @public
|
||||
*/
|
||||
Blockly.IToolboxItem.prototype.getId;
|
||||
@@ -114,10 +114,10 @@ Blockly.ISelectableToolboxItem.prototype.getContents;
|
||||
Blockly.ISelectableToolboxItem.prototype.setSelected;
|
||||
|
||||
/**
|
||||
* Gets the html element that is clickable.
|
||||
* The parent toolbox element receives clicks. The parent toolbox will add an id to this element so
|
||||
* it can pass the onClick event to the correct toolboxItem.
|
||||
* @return {!Element} The html element that receives clicks.
|
||||
* Gets the HTML element that is clickable.
|
||||
* The parent toolbox element receives clicks. The parent toolbox will add an ID
|
||||
* to this element so it can pass the onClick event to the correct toolboxItem.
|
||||
* @return {!Element} The HTML element that receives clicks.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ISelectableToolboxItem.prototype.getClickTarget;
|
||||
|
||||
@@ -78,7 +78,7 @@ Blockly.MarkerManager.prototype.registerMarker = function(id, marker) {
|
||||
|
||||
/**
|
||||
* Unregister the marker by removing it from the map of markers.
|
||||
* @param {string} id The id of the marker to unregister.
|
||||
* @param {string} id The ID of the marker to unregister.
|
||||
*/
|
||||
Blockly.MarkerManager.prototype.unregisterMarker = function(id) {
|
||||
var marker = this.markers_[id];
|
||||
@@ -100,9 +100,9 @@ Blockly.MarkerManager.prototype.getCursor = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a single marker that corresponds to the given id.
|
||||
* Get a single marker that corresponds to the given ID.
|
||||
* @param {string} id A unique identifier for the marker.
|
||||
* @return {Blockly.Marker} The marker that corresponds to the given id, or null
|
||||
* @return {Blockly.Marker} The marker that corresponds to the given ID, or null
|
||||
* if none exists.
|
||||
*/
|
||||
Blockly.MarkerManager.prototype.getMarker = function(id) {
|
||||
@@ -127,9 +127,9 @@ Blockly.MarkerManager.prototype.setCursor = function(cursor) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this workspace svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* workspace svg group.
|
||||
* Add the cursor SVG to this workspace SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* workspace SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.MarkerManager.prototype.setCursorSvg = function(cursorSvg) {
|
||||
@@ -143,9 +143,9 @@ Blockly.MarkerManager.prototype.setCursorSvg = function(cursorSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the marker svg to this workspaces svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* workspace svg group.
|
||||
* Add the marker SVG to this workspaces SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* workspace SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.MarkerManager.prototype.setMarkerSvg = function(markerSvg) {
|
||||
@@ -164,7 +164,7 @@ Blockly.MarkerManager.prototype.setMarkerSvg = function(markerSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Redraw the attached cursor svg if needed.
|
||||
* Redraw the attached cursor SVG if needed.
|
||||
* @package
|
||||
*/
|
||||
Blockly.MarkerManager.prototype.updateMarkers = function() {
|
||||
|
||||
@@ -52,7 +52,7 @@ Blockly.MetricsManager = function(workspace) {
|
||||
Blockly.MetricsManager.ToolboxMetrics;
|
||||
|
||||
/**
|
||||
* Describes where the viewport starts in relation to the workspace svg.
|
||||
* Describes where the viewport starts in relation to the workspace SVG.
|
||||
* @typedef {{
|
||||
* left: number,
|
||||
* top: number
|
||||
@@ -84,7 +84,7 @@ Blockly.MetricsManager.ContainerRegion;
|
||||
Blockly.MetricsManager.FixedEdges;
|
||||
|
||||
/**
|
||||
* Common metrics used for ui elements.
|
||||
* Common metrics used for UI elements.
|
||||
* @typedef {{
|
||||
* viewMetrics: !Blockly.MetricsManager.ContainerRegion,
|
||||
* absoluteMetrics: !Blockly.MetricsManager.AbsoluteMetrics,
|
||||
@@ -151,10 +151,10 @@ Blockly.MetricsManager.prototype.getToolboxMetrics = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the width and height of the workspace's parent svg element in pixel
|
||||
* Gets the width and height of the workspace's parent SVG element in pixel
|
||||
* coordinates. This area includes the toolbox and the visible workspace area.
|
||||
* @return {!Blockly.utils.Size} The width and height of the workspace's parent
|
||||
* svg element.
|
||||
* SVG element.
|
||||
* @public
|
||||
*/
|
||||
Blockly.MetricsManager.prototype.getSvgMetrics = function() {
|
||||
@@ -163,7 +163,7 @@ Blockly.MetricsManager.prototype.getSvgMetrics = function() {
|
||||
|
||||
/**
|
||||
* Gets the absolute left and absolute top in pixel coordinates.
|
||||
* This is where the visible workspace starts in relation to the svg container.
|
||||
* This is where the visible workspace starts in relation to the SVG container.
|
||||
* @return {!Blockly.MetricsManager.AbsoluteMetrics} The absolute metrics for
|
||||
* the workspace.
|
||||
* @public
|
||||
@@ -356,7 +356,7 @@ Blockly.MetricsManager.prototype.getPaddedContent_ = function(
|
||||
* content metrics if they have been previously computed. Passing in null
|
||||
* may cause the content metrics to be computed again, if it is needed.
|
||||
* @return {!Blockly.MetricsManager.ContainerRegion} The metrics for the scroll
|
||||
* container
|
||||
* container.
|
||||
*/
|
||||
Blockly.MetricsManager.prototype.getScrollMetrics = function(
|
||||
opt_getWorkspaceCoordinates, opt_viewMetrics, opt_contentMetrics) {
|
||||
@@ -365,7 +365,7 @@ Blockly.MetricsManager.prototype.getScrollMetrics = function(
|
||||
var contentMetrics = opt_contentMetrics || this.getContentMetrics();
|
||||
var fixedEdges = this.getComputedFixedEdges_(viewMetrics);
|
||||
|
||||
// Add padding around content
|
||||
// Add padding around content.
|
||||
var paddedContent = this.getPaddedContent_(viewMetrics, contentMetrics);
|
||||
|
||||
// Use combination of fixed bounds and padded content to make scroll area.
|
||||
@@ -387,8 +387,8 @@ Blockly.MetricsManager.prototype.getScrollMetrics = function(
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns common metrics used by ui elements.
|
||||
* @return {!Blockly.MetricsManager.UiMetrics} The ui metrics.
|
||||
* Returns common metrics used by UI elements.
|
||||
* @return {!Blockly.MetricsManager.UiMetrics} The UI metrics.
|
||||
*/
|
||||
Blockly.MetricsManager.prototype.getUiMetrics = function() {
|
||||
return {
|
||||
|
||||
@@ -275,7 +275,7 @@ Blockly.Options.parseMoveOptions_ = function(options, hasCategories) {
|
||||
} else {
|
||||
moveOptions.scrollbars = !!move['scrollbars'] || !!options['scrollbars'];
|
||||
}
|
||||
|
||||
|
||||
if (!moveOptions.scrollbars || move['wheel'] === undefined) {
|
||||
// Defaults to true if single-direction scroll is enabled.
|
||||
moveOptions.wheel = typeof moveOptions.scrollbars == 'object';
|
||||
|
||||
@@ -63,8 +63,8 @@ Blockly.PluginManager.prototype.addPlugin = function(pluginDataObject) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the plugin with the given id and the given type.
|
||||
* @param {string} id The id of the plugin to get.
|
||||
* Gets the plugin with the given ID and the given type.
|
||||
* @param {string} id The ID of the plugin to get.
|
||||
* @return {!Blockly.IPlugin|undefined} The plugin with the given name
|
||||
* or undefined if not found.
|
||||
*/
|
||||
@@ -134,4 +134,3 @@ Blockly.PluginManager.Type.prototype.toString = function() {
|
||||
/** @type {!Blockly.PluginManager.Type<!Blockly.IPositionable>} */
|
||||
Blockly.PluginManager.Type.POSITIONABLE =
|
||||
new Blockly.PluginManager.Type('positionable');
|
||||
|
||||
|
||||
@@ -61,17 +61,17 @@ Blockly.uiPosition.bumpDirection = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a rectangle representing reasonable position for where to place a ui
|
||||
* Returns a rectangle representing reasonable position for where to place a UI
|
||||
* element of the specified size given the restraints and locations of the
|
||||
* scrollbars. This method does not take into account any already placed ui
|
||||
* scrollbars. This method does not take into account any already placed UI
|
||||
* elements.
|
||||
* @param {!Blockly.uiPosition.Position} position The starting
|
||||
* horizontal and vertical position.
|
||||
* @param {!Blockly.utils.Size} size the size of the ui element to get a start
|
||||
* @param {!Blockly.utils.Size} size the size of the UI element to get a start
|
||||
* position for.
|
||||
* @param {number} horizontalPadding The horizontal padding to use.
|
||||
* @param {number} verticalPadding The vertical padding to use.
|
||||
* @param {!Blockly.MetricsManager.UiMetrics} metrics The workspace ui metrics.
|
||||
* @param {!Blockly.MetricsManager.UiMetrics} metrics The workspace UI metrics.
|
||||
* @param {!Blockly.WorkspaceSvg} workspace The workspace.
|
||||
* @return {!Blockly.utils.Rect} The suggested start position.
|
||||
* @package
|
||||
@@ -148,9 +148,9 @@ Blockly.uiPosition.getCornerOppositeToolbox = function(workspace, metrics) {
|
||||
* @param {!Blockly.utils.Rect} startRect The starting position to use.
|
||||
* @param {number} margin The margin to use between elements when bumping.
|
||||
* @param {!Blockly.uiPosition.bumpDirection} bumpDirection The direction
|
||||
* to bump if there is a collision with an existing ui element.
|
||||
* to bump if there is a collision with an existing UI element.
|
||||
* @param {!Array<!Blockly.utils.Rect>} savedPositions List of rectangles that
|
||||
* represent the positions of ui elements already placed.
|
||||
* represent the positions of UI elements already placed.
|
||||
* @return {!Blockly.utils.Rect} The suggested position rectangle.
|
||||
* @package
|
||||
*/
|
||||
|
||||
@@ -420,7 +420,7 @@ Blockly.blockRendering.Debug.prototype.drawDebug = function(block, info) {
|
||||
|
||||
/**
|
||||
* Show a debug filter to highlight that a block has been rendered.
|
||||
* @param {!SVGElement} svgPath The block's svg path.
|
||||
* @param {!SVGElement} svgPath The block's SVG path.
|
||||
* @package
|
||||
*/
|
||||
Blockly.blockRendering.Debug.prototype.drawRender = function(svgPath) {
|
||||
|
||||
@@ -47,14 +47,14 @@ Blockly.blockRendering.IPathObject.prototype.constants;
|
||||
Blockly.blockRendering.IPathObject.prototype.style;
|
||||
|
||||
/**
|
||||
* Holds the cursors svg element when the cursor is attached to the block.
|
||||
* Holds the cursors SVG element when the cursor is attached to the block.
|
||||
* This is null if there is no cursor on the block.
|
||||
* @type {SVGElement}
|
||||
*/
|
||||
Blockly.blockRendering.IPathObject.prototype.cursorSvg;
|
||||
|
||||
/**
|
||||
* Holds the markers svg element when the marker is attached to the block.
|
||||
* Holds the markers SVG element when the marker is attached to the block.
|
||||
* This is null if there is no marker on the block.
|
||||
* @type {SVGElement}
|
||||
*/
|
||||
@@ -89,17 +89,17 @@ Blockly.blockRendering.IPathObject.prototype.setStyle;
|
||||
Blockly.blockRendering.IPathObject.prototype.flipRTL;
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this block's svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* block svg group.
|
||||
* Add the cursor SVG to this block's SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* block SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.blockRendering.IPathObject.prototype.setCursorSvg;
|
||||
|
||||
/**
|
||||
* Add the marker svg to this block's svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* block svg group.
|
||||
* Add the marker SVG to this block's SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* block SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.blockRendering.IPathObject.prototype.setMarkerSvg;
|
||||
|
||||
@@ -97,9 +97,9 @@ Blockly.blockRendering.PathObject.prototype.flipRTL = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this block's svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* block svg group.
|
||||
* Add the cursor SVG to this block's SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* block SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.blockRendering.PathObject.prototype.setCursorSvg = function(cursorSvg) {
|
||||
@@ -113,9 +113,9 @@ Blockly.blockRendering.PathObject.prototype.setCursorSvg = function(cursorSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the marker svg to this block's svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* block svg group.
|
||||
* Add the marker SVG to this block's SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* block SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.blockRendering.PathObject.prototype.setMarkerSvg = function(markerSvg) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/**
|
||||
* @fileoverview Tritanopia theme.
|
||||
* A color palette for people that have tritanopia (the inability to perceive
|
||||
* A colour palette for people that have tritanopia (the inability to perceive
|
||||
* blue light).
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@@ -126,7 +126,7 @@ Blockly.ToolboxCategory = function(categoryDef, toolbox, opt_parent) {
|
||||
Blockly.utils.object.inherits(Blockly.ToolboxCategory, Blockly.ToolboxItem);
|
||||
|
||||
/**
|
||||
* All the css class names that are used to create a category.
|
||||
* All the CSS class names that are used to create a category.
|
||||
* @typedef {{
|
||||
* container:(string|undefined),
|
||||
* row:(string|undefined),
|
||||
@@ -216,7 +216,7 @@ Blockly.ToolboxCategory.prototype.init = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the dom for the category.
|
||||
* Creates the DOM for the category.
|
||||
* @return {!Element} The parent element for the category.
|
||||
* @protected
|
||||
*/
|
||||
@@ -306,7 +306,7 @@ Blockly.ToolboxCategory.prototype.createIconDom_ = function() {
|
||||
|
||||
/**
|
||||
* Creates the span that holds the category label.
|
||||
* This should have an id for accessibility purposes.
|
||||
* This should have an ID for accessibility purposes.
|
||||
* @param {string} name The name of the category.
|
||||
* @return {!Element} The span that holds the category label.
|
||||
* @protected
|
||||
@@ -390,10 +390,10 @@ Blockly.ToolboxCategory.prototype.getColourfromStyle_ = function(styleName) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the html element that is clickable.
|
||||
* The parent toolbox element receives clicks. The parent toolbox will add an id to this element so
|
||||
* it can pass the onClick event to the correct toolboxItem.
|
||||
* @return {!Element} The html element that receives clicks.
|
||||
* Gets the HTML element that is clickable.
|
||||
* The parent toolbox element receives clicks. The parent toolbox will add an ID
|
||||
* to this element so it can pass the onClick event to the correct toolboxItem.
|
||||
* @return {!Element} The HTML element that receives clicks.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ToolboxCategory.prototype.getClickTarget = function() {
|
||||
|
||||
@@ -66,7 +66,7 @@ Blockly.CollapsibleToolboxCategory = function(categoryDef, toolbox, opt_parent)
|
||||
Blockly.utils.object.inherits(Blockly.CollapsibleToolboxCategory, Blockly.ToolboxCategory);
|
||||
|
||||
/**
|
||||
* All the css class names that are used to create a collapsible
|
||||
* All the CSS class names that are used to create a collapsible
|
||||
* category. This is all the properties from the regular category plus contents.
|
||||
* @typedef {{
|
||||
* container:?string,
|
||||
@@ -186,7 +186,7 @@ Blockly.CollapsibleToolboxCategory.prototype.createIconDom_ = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the dom for all subcategories.
|
||||
* Create the DOM for all subcategories.
|
||||
* @param {!Array<!Blockly.ToolboxItem>} subcategories The subcategories.
|
||||
* @return {!Element} The div holding all the subcategories.
|
||||
* @protected
|
||||
|
||||
@@ -37,7 +37,7 @@ Blockly.ToolboxSeparator = function(separatorDef, toolbox) {
|
||||
Blockly.ToolboxSeparator.superClass_.constructor.call(
|
||||
this, separatorDef, toolbox);
|
||||
/**
|
||||
* All the css class names that are used to create a separator.
|
||||
* All the CSS class names that are used to create a separator.
|
||||
* @type {!Blockly.ToolboxSeparator.CssConfig}
|
||||
* @protected
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ Blockly.ToolboxSeparator = function(separatorDef, toolbox) {
|
||||
Blockly.utils.object.inherits(Blockly.ToolboxSeparator, Blockly.ToolboxItem);
|
||||
|
||||
/**
|
||||
* All the css class names that are used to create a separator.
|
||||
* All the CSS class names that are used to create a separator.
|
||||
* @typedef {{
|
||||
* container:(string|undefined)
|
||||
* }}
|
||||
@@ -72,7 +72,7 @@ Blockly.ToolboxSeparator.prototype.init = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the dom for a separator.
|
||||
* Creates the DOM for a separator.
|
||||
* @return {!Element} The parent element for the separator.
|
||||
* @protected
|
||||
*/
|
||||
|
||||
@@ -190,9 +190,9 @@ Blockly.Toolbox.prototype.init = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the dom for the toolbox.
|
||||
* Creates the DOM for the toolbox.
|
||||
* @param {!Blockly.WorkspaceSvg} workspace The workspace this toolbox is on.
|
||||
* @return {!Element} The html container for the toolbox.
|
||||
* @return {!Element} The HTML container for the toolbox.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.Toolbox.prototype.createDom_ = function(workspace) {
|
||||
@@ -213,7 +213,7 @@ Blockly.Toolbox.prototype.createDom_ = function(workspace) {
|
||||
|
||||
/**
|
||||
* Creates the container div for the toolbox.
|
||||
* @return {!Element} The html container for the toolbox.
|
||||
* @return {!Element} The HTML container for the toolbox.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.Toolbox.prototype.createContainer_ = function() {
|
||||
@@ -227,7 +227,7 @@ Blockly.Toolbox.prototype.createContainer_ = function() {
|
||||
|
||||
/**
|
||||
* Creates the container for all the contents in the toolbox.
|
||||
* @return {!Element} The html container for the toolbox contents.
|
||||
* @return {!Element} The HTML container for the toolbox contents.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.Toolbox.prototype.createContentsContainer_ = function() {
|
||||
@@ -241,8 +241,8 @@ Blockly.Toolbox.prototype.createContentsContainer_ = function() {
|
||||
|
||||
/**
|
||||
* Adds event listeners to the toolbox container div.
|
||||
* @param {!Element} container The html container for the toolbox.
|
||||
* @param {!Element} contentsContainer The html container for the contents
|
||||
* @param {!Element} container The HTML container for the toolbox.
|
||||
* @param {!Element} contentsContainer The HTML container for the contents
|
||||
* of the toolbox.
|
||||
* @protected
|
||||
*/
|
||||
@@ -519,10 +519,10 @@ Blockly.Toolbox.prototype.getClientRect = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the toolbox item with the given id.
|
||||
* @param {string} id The id of the toolbox item.
|
||||
* @return {?Blockly.IToolboxItem} The toolbox item with the given id, or null if
|
||||
* no item exists.
|
||||
* Gets the toolbox item with the given ID.
|
||||
* @param {string} id The ID of the toolbox item.
|
||||
* @return {?Blockly.IToolboxItem} The toolbox item with the given ID, or null
|
||||
* if no item exists.
|
||||
* @public
|
||||
*/
|
||||
Blockly.Toolbox.prototype.getToolboxItemById = function(id) {
|
||||
|
||||
@@ -77,7 +77,7 @@ Blockly.ToolboxItem = function(toolboxItemDef, toolbox, opt_parent) {
|
||||
|
||||
/**
|
||||
* Initializes the toolbox item.
|
||||
* This includes creating the dom and updating the state of any items based
|
||||
* This includes creating the DOM and updating the state of any items based
|
||||
* on the info object.
|
||||
* @public
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ Blockly.ToolboxItem.prototype.getDiv = function() {
|
||||
|
||||
/**
|
||||
* Gets a unique identifier for this toolbox item.
|
||||
* @return {string} The id for the toolbox item.
|
||||
* @return {string} The ID for the toolbox item.
|
||||
* @public
|
||||
*/
|
||||
Blockly.ToolboxItem.prototype.getId = function() {
|
||||
|
||||
@@ -587,7 +587,7 @@ Blockly.Trashcan.prototype.click = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires a ui event for trashcan flyout open or close.
|
||||
* Fires a UI event for trashcan flyout open or close.
|
||||
* @param {boolean} trashcanOpen Whether the flyout is opening.
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -75,7 +75,7 @@ Blockly.utils.style.getSizeWithDisplay_ = function(element) {
|
||||
* Copied from Closure's goog.style.getStyle_
|
||||
*
|
||||
* @param {!Element} element Element to get style of.
|
||||
* @param {string} style Property to get (must be camelCase, not css-style.).
|
||||
* @param {string} style Property to get (must be camelCase, not CSS-style).
|
||||
* @return {string} Style value.
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ Blockly.VariableModel = function(workspace, name, opt_type, opt_id) {
|
||||
this.type = opt_type || '';
|
||||
|
||||
/**
|
||||
* A unique id for the variable. This should be defined at creation and
|
||||
* A unique ID for the variable. This should be defined at creation and
|
||||
* not change, even if the name changes. In most cases this should be a
|
||||
* UUID.
|
||||
* @type {string}
|
||||
|
||||
@@ -551,9 +551,9 @@ Blockly.WorkspaceSvg.prototype.getPluginManager = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the cursor svg to this workspaces svg group.
|
||||
* @param {SVGElement} cursorSvg The svg root of the cursor to be added to the
|
||||
* workspace svg group.
|
||||
* Add the cursor SVG to this workspaces SVG group.
|
||||
* @param {SVGElement} cursorSvg The SVG root of the cursor to be added to the
|
||||
* workspace SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.setCursorSvg = function(cursorSvg) {
|
||||
@@ -561,9 +561,9 @@ Blockly.WorkspaceSvg.prototype.setCursorSvg = function(cursorSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the marker svg to this workspaces svg group.
|
||||
* @param {SVGElement} markerSvg The svg root of the marker to be added to the
|
||||
* workspace svg group.
|
||||
* Add the marker SVG to this workspaces SVG group.
|
||||
* @param {SVGElement} markerSvg The SVG root of the marker to be added to the
|
||||
* workspace SVG group.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.setMarkerSvg = function(markerSvg) {
|
||||
@@ -571,9 +571,9 @@ Blockly.WorkspaceSvg.prototype.setMarkerSvg = function(markerSvg) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the marker with the given id.
|
||||
* @param {string} id The id of the marker.
|
||||
* @return {Blockly.Marker} The marker with the given id or null if no marker
|
||||
* Get the marker with the given ID.
|
||||
* @param {string} id The ID of the marker.
|
||||
* @return {Blockly.Marker} The marker with the given ID or null if no marker
|
||||
* with the given id exists.
|
||||
* @package
|
||||
*/
|
||||
@@ -749,9 +749,9 @@ Blockly.WorkspaceSvg.prototype.getSvgXY = function(element) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the size of the workspace's parent svg element.
|
||||
* Gets the size of the workspace's parent SVG element.
|
||||
* @return {!Blockly.utils.Size} The cached width and height of the workspace's
|
||||
* parent svg element.
|
||||
* parent SVG element.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.getCachedParentSvgSize = function() {
|
||||
@@ -797,8 +797,8 @@ Blockly.WorkspaceSvg.prototype.getInjectionDiv = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the svg block canvas for the workspace.
|
||||
* @return {SVGElement} The svg group for the workspace.
|
||||
* Get the SVG block canvas for the workspace.
|
||||
* @return {SVGElement} The SVG group for the workspace.
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.getBlockCanvas = function() {
|
||||
@@ -977,7 +977,7 @@ Blockly.WorkspaceSvg.prototype.dispose = function() {
|
||||
/**
|
||||
* Obtain a newly created block.
|
||||
*
|
||||
* This block's svg must still be initialized
|
||||
* This block's SVG must still be initialized
|
||||
* ([initSvg]{@link Blockly.BlockSvg#initSvg}) and it must be rendered
|
||||
* ([render]{@link Blockly.BlockSvg#render}) before the block will be visible.
|
||||
* @param {!string} prototypeName Name of the language object containing
|
||||
@@ -1181,10 +1181,10 @@ Blockly.WorkspaceSvg.prototype.getCanvas = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Caches the width and height of the workspace's parent svg element for use
|
||||
* Caches the width and height of the workspace's parent SVG element for use
|
||||
* with getSvgMetrics.
|
||||
* @param {?number} width The width of the parent svg element.
|
||||
* @param {?number} height The height of the parent svg element
|
||||
* @param {?number} width The width of the parent SVG element.
|
||||
* @param {?number} height The height of the parent SVG element
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.setCachedParentSvgSize = function(width, height) {
|
||||
|
||||
@@ -486,7 +486,7 @@ Blockly.ZoomControls.prototype.resetZoom_ = function(e) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires a zoom control ui event.
|
||||
* Fires a zoom control UI event.
|
||||
* @private
|
||||
*/
|
||||
Blockly.ZoomControls.prototype.fireZoomEvent_ = function() {
|
||||
|
||||
@@ -707,7 +707,7 @@ BlockDefinitionExtractor.typeOther_ = function(type) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a block Element for the color_hue block, with the given hue.
|
||||
* Creates a block Element for the colour_hue block, with the given hue.
|
||||
* @param hue {number} The hue value, from 0 to 360.
|
||||
* @return {Element} The <block> Element representing a colour_hue block
|
||||
* with the given hue.
|
||||
|
||||
@@ -170,7 +170,7 @@ BlockExporterTools.prototype.generateCategoryFromBlockLib =
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate selector dom from block library storage. For each block in the
|
||||
* Generate selector DOM from block library storage. For each block in the
|
||||
* library, it has a block option, which consists of a checkbox, a label,
|
||||
* and a fixed size preview workspace.
|
||||
* @param {!BlockLibraryStorage} blockLibStorage Block Library Storage object.
|
||||
|
||||
@@ -46,9 +46,9 @@ var BlockOption = function(blockSelector, blockType, previewBlockXml) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the dom for a single block option. Includes checkbox, label, and div
|
||||
* Creates the DOM for a single block option. Includes checkbox, label, and div
|
||||
* in which to inject the preview block.
|
||||
* @return {!Element} Root node of the selector dom which consists of a
|
||||
* @return {!Element} Root node of the selector DOM which consists of a
|
||||
* checkbox, a label, and a fixed size preview workspace per block.
|
||||
*/
|
||||
BlockOption.prototype.createDom = function() {
|
||||
|
||||
@@ -526,12 +526,12 @@ td.taboff:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Change color of dropdown links on hover. */
|
||||
/* Change colour of dropdown links on hover. */
|
||||
.dropdown-content a:hover, .dropdown-content label:hover {
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
/* Change color of dropdown links on selected. */
|
||||
/* Change colour of dropdown links on selected. */
|
||||
.dropdown-content-selected {
|
||||
background-color: #DDD;
|
||||
}
|
||||
|
||||
@@ -490,8 +490,8 @@ WorkspaceFactoryController.prototype.changeSelectedCategory = function(name,
|
||||
return;
|
||||
}
|
||||
// Change colour of selected category.
|
||||
selected.changeColor(colour);
|
||||
this.view.setBorderColor(this.model.getSelectedId(), colour);
|
||||
selected.changeColour(colour);
|
||||
this.view.setBorderColour(this.model.getSelectedId(), colour);
|
||||
// Change category name.
|
||||
selected.changeName(name);
|
||||
this.view.updateCategoryName(name, this.model.getSelectedId());
|
||||
@@ -588,9 +588,9 @@ WorkspaceFactoryController.prototype.loadCategoryByName = function(name) {
|
||||
+ '. Rename your category and try again.');
|
||||
return;
|
||||
}
|
||||
if (!standardCategory.color && standardCategory.hue !== undefined) {
|
||||
if (!standardCategory.colour && standardCategory.hue !== undefined) {
|
||||
// Calculate the hex colour based on the hue.
|
||||
standardCategory.color = Blockly.hueToHex(standardCategory.hue);
|
||||
standardCategory.colour = Blockly.hueToHex(standardCategory.hue);
|
||||
}
|
||||
// Transfers current flyout blocks to a category if it's the first category
|
||||
// created.
|
||||
@@ -607,8 +607,8 @@ WorkspaceFactoryController.prototype.loadCategoryByName = function(name) {
|
||||
var tab = this.view.addCategoryRow(copy.name, copy.id);
|
||||
this.addClickToSwitch(tab, copy.id);
|
||||
// Color the category tab in the view.
|
||||
if (copy.color) {
|
||||
this.view.setBorderColor(copy.id, copy.color);
|
||||
if (copy.colour) {
|
||||
this.view.setBorderColour(copy.id, copy.colour);
|
||||
}
|
||||
// Switch to loaded category.
|
||||
this.switchElement(copy.id);
|
||||
@@ -805,10 +805,10 @@ WorkspaceFactoryController.prototype.importToolboxFromTree_ = function(tree) {
|
||||
// Convert actual shadow blocks to user-generated shadow blocks.
|
||||
this.convertShadowBlocks();
|
||||
|
||||
// Set category color.
|
||||
// Set category colour.
|
||||
if (item.getAttribute('colour')) {
|
||||
category.changeColor(item.getAttribute('colour'));
|
||||
this.view.setBorderColor(category.id, category.color);
|
||||
category.changeColour(item.getAttribute('colour'));
|
||||
this.view.setBorderColour(category.id, category.colour);
|
||||
}
|
||||
// Set any custom tags.
|
||||
if (item.getAttribute('custom')) {
|
||||
@@ -1222,8 +1222,8 @@ WorkspaceFactoryController.prototype.importBlocks = function(file, format) {
|
||||
var blocks = controller.generator.getDefinedBlocks(blockTypes);
|
||||
// Generate category XML and append to toolbox.
|
||||
var categoryXml = FactoryUtils.generateCategoryXml(blocks, categoryName);
|
||||
// Get random color for category between 0 and 360. Gives each imported
|
||||
// category a different color.
|
||||
// Get random colour for category between 0 and 360. Gives each imported
|
||||
// category a different colour.
|
||||
var randomColor = Math.floor(Math.random() * 360);
|
||||
categoryXml.setAttribute('colour', randomColor);
|
||||
controller.toolbox.appendChild(categoryXml);
|
||||
@@ -1259,7 +1259,7 @@ WorkspaceFactoryController.prototype.setBlockLibCategory =
|
||||
var blockLibCategory = document.getElementById('blockLibCategory');
|
||||
|
||||
// Set category ID so that it can be easily replaced, and set a standard,
|
||||
// arbitrary block library color.
|
||||
// arbitrary block library colour.
|
||||
categoryXml.id = 'blockLibCategory';
|
||||
categoryXml.setAttribute('colour', 260);
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ WorkspaceFactoryGenerator.prototype.generateToolboxXml = function() {
|
||||
var nextElement = Blockly.utils.xml.createElement('category');
|
||||
nextElement.setAttribute('name', element.name);
|
||||
// Add a colour attribute if one exists.
|
||||
if (element.color != null) {
|
||||
nextElement.setAttribute('colour', element.color);
|
||||
if (element.colour != null) {
|
||||
nextElement.setAttribute('colour', element.colour);
|
||||
}
|
||||
// Add a custom attribute if one exists.
|
||||
if (element.custom != null) {
|
||||
|
||||
@@ -239,8 +239,8 @@ WorkspaceFactoryInit.assignWorkspaceFactoryClickHandlers_ =
|
||||
return;
|
||||
}
|
||||
document.getElementById('categoryName').value = selected.name;
|
||||
document.getElementById('categoryColour').value = selected.color ?
|
||||
selected.color.substring(1).toLowerCase() : '';
|
||||
document.getElementById('categoryColour').value = selected.colour ?
|
||||
selected.colour.substring(1).toLowerCase() : '';
|
||||
console.log(document.getElementById('categoryColour').value);
|
||||
// Link the colour picker to the field.
|
||||
cp_init('categoryColour');
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/**
|
||||
* @fileoverview Stores and updates information about state and categories
|
||||
* in workspace factory. Each list element is either a separator or a category,
|
||||
* and each category stores its name, XML to load that category, color,
|
||||
* and each category stores its name, XML to load that category, colour,
|
||||
* custom tags, and a unique ID making it possible to change category names and
|
||||
* move categories easily. Keeps track of the currently selected list
|
||||
* element. Also keeps track of all the user-created shadow blocks and
|
||||
@@ -479,8 +479,8 @@ ListElement = function(type, opt_name) {
|
||||
this.name = opt_name ? opt_name : null;
|
||||
// Unique ID of element. Does not change.
|
||||
this.id = Blockly.utils.genUid();
|
||||
// Color of category. Default is no color. Null if separator.
|
||||
this.color = null;
|
||||
// Colour of category. Default is no colour. Null if separator.
|
||||
this.colour = null;
|
||||
// Stores a custom tag, if necessary. Null if no custom tag or separator.
|
||||
this.custom = null;
|
||||
};
|
||||
@@ -510,7 +510,7 @@ ListElement.prototype.saveFromWorkspace = function(workspace) {
|
||||
* not a category.
|
||||
* @param {string} name New name of category.
|
||||
*/
|
||||
ListElement.prototype.changeName = function (name) {
|
||||
ListElement.prototype.changeName = function(name) {
|
||||
// Only update list elements that are categories.
|
||||
if (this.type != ListElement.TYPE_CATEGORY) {
|
||||
return;
|
||||
@@ -519,16 +519,16 @@ ListElement.prototype.changeName = function (name) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the color of a category. If tries to set the color of something other
|
||||
* Sets the colour of a category. If tries to set the colour of something other
|
||||
* than a category, returns.
|
||||
* @param {?string} color The color that should be used for that category,
|
||||
* @param {?string} colour The colour that should be used for that category,
|
||||
* or null if none.
|
||||
*/
|
||||
ListElement.prototype.changeColor = function (color) {
|
||||
ListElement.prototype.changeColour = function(colour) {
|
||||
if (this.type != ListElement.TYPE_CATEGORY) {
|
||||
return;
|
||||
}
|
||||
this.color = color;
|
||||
this.colour = colour;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -543,7 +543,7 @@ ListElement.prototype.copy = function() {
|
||||
// Copy all attributes except ID.
|
||||
copy.name = this.name;
|
||||
copy.xml = this.xml;
|
||||
copy.color = this.color;
|
||||
copy.colour = this.colour;
|
||||
copy.custom = this.custom;
|
||||
// Return copy.
|
||||
return copy;
|
||||
|
||||
@@ -204,13 +204,13 @@ WorkspaceFactoryView.prototype.moveTabToIndex =
|
||||
};
|
||||
|
||||
/**
|
||||
* Given a category ID and color, use that color to color the left border of the
|
||||
* tab for that category.
|
||||
* @param {string} id The ID of the category to color.
|
||||
* Given a category ID and colour, use that colour to colour the left border of
|
||||
* the tab for that category.
|
||||
* @param {string} id The ID of the category to colour.
|
||||
* @param {?string} colour The colour for to be used for the border of the tab,
|
||||
* or null if none. Must be a valid CSS string.
|
||||
*/
|
||||
WorkspaceFactoryView.prototype.setBorderColor = function(id, colour) {
|
||||
WorkspaceFactoryView.prototype.setBorderColour = function(id, colour) {
|
||||
var style = this.tabMap[id].style;
|
||||
if (colour) {
|
||||
style.borderLeftWidth = '8px';
|
||||
|
||||
Reference in New Issue
Block a user