mirror of
https://github.com/google/blockly.git
synced 2026-06-16 16:15:14 +02:00
Private/protected visibility cleanup (#3263)
* Fix a number of private visibility issues
This commit is contained in:
@@ -1076,6 +1076,7 @@ Blockly.BlockSvg.prototype.updateColour = function() {
|
||||
/**
|
||||
* Sets the colour of the border.
|
||||
* Removes the light and dark paths if a border colour is defined.
|
||||
* @private
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setBorderColour_ = function() {
|
||||
var borderColours = this.getColourBorder();
|
||||
@@ -1097,6 +1098,7 @@ Blockly.BlockSvg.prototype.setBorderColour_ = function() {
|
||||
/**
|
||||
* Sets the colour of shadow blocks.
|
||||
* @return {?string} The background colour of the block.
|
||||
* @private
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.setShadowColour_ = function() {
|
||||
var shadowColour = this.getColourShadow();
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
goog.provide('Blockly.Blocks');
|
||||
|
||||
/*
|
||||
/**
|
||||
* A mapping of block type names to block prototype objects.
|
||||
* @type {!Object.<string,Object>}
|
||||
*/
|
||||
|
||||
+4
-3
@@ -126,6 +126,7 @@ Blockly.Bubble.onMouseMoveWrapper_ = null;
|
||||
/**
|
||||
* Function to call on resize of bubble.
|
||||
* @type {Function}
|
||||
* @private
|
||||
*/
|
||||
Blockly.Bubble.prototype.resizeCallback_ = null;
|
||||
|
||||
@@ -144,12 +145,12 @@ Blockly.Bubble.unbindDragEvents_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Handle a mouse-up event while dragging a bubble's border or resize handle.
|
||||
* @param {!Event} e Mouse up event.
|
||||
* @param {!Event} _e Mouse up event.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Bubble.bubbleMouseUp_ = function(/* e */) {
|
||||
Blockly.Bubble.bubbleMouseUp_ = function(_e) {
|
||||
Blockly.Touch.clearTouchIdentifier();
|
||||
Blockly.Bubble.unbindDragEvents_();
|
||||
};
|
||||
|
||||
+4
-3
@@ -331,9 +331,9 @@ Blockly.FieldAngle.prototype.dropdownCreate_ = function() {
|
||||
// a click handler on the drag surface to update the value if the surface
|
||||
// is clicked.
|
||||
this.clickSurfaceWrapper_ =
|
||||
Blockly.bindEventWithChecks_(circle, 'click', this, this.onMouseMove, true, true);
|
||||
Blockly.bindEventWithChecks_(circle, 'click', this, this.onMouseMove_, true, true);
|
||||
this.moveSurfaceWrapper_ =
|
||||
Blockly.bindEventWithChecks_(circle, 'mousemove', this, this.onMouseMove, true, true);
|
||||
Blockly.bindEventWithChecks_(circle, 'mousemove', this, this.onMouseMove_, true, true);
|
||||
return svg;
|
||||
};
|
||||
|
||||
@@ -367,8 +367,9 @@ Blockly.FieldAngle.prototype.hide_ = function() {
|
||||
/**
|
||||
* Set the angle to match the mouse's position.
|
||||
* @param {!Event} e Mouse move event.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.FieldAngle.prototype.onMouseMove = function(e) {
|
||||
Blockly.FieldAngle.prototype.onMouseMove_ = function(e) {
|
||||
// Calculate angle.
|
||||
var bBox = this.gauge_.ownerSVGElement.getBoundingClientRect();
|
||||
var dx = e.clientX - bBox.left - Blockly.FieldAngle.HALF;
|
||||
|
||||
@@ -247,6 +247,7 @@ Blockly.FieldImage.prototype.setAlt = function(alt) {
|
||||
/**
|
||||
* If field click is called, and click handler defined,
|
||||
* call the handler.
|
||||
* @protected
|
||||
*/
|
||||
Blockly.FieldImage.prototype.showEditor_ = function() {
|
||||
if (this.clickHandler_) {
|
||||
|
||||
@@ -111,6 +111,7 @@ Blockly.Flyout = function(workspaceOptions) {
|
||||
/**
|
||||
* Width of output tab.
|
||||
* @type {number}
|
||||
* @protected
|
||||
* @const
|
||||
*/
|
||||
this.tabWidth_ = this.workspace_.getRenderer().getConstants().TAB_WIDTH;
|
||||
|
||||
+2
-1
@@ -38,7 +38,7 @@ goog.require('Blockly.utils.Coordinate');
|
||||
goog.require('Blockly.WorkspaceDragger');
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Note: In this file "start" refers to touchstart, mousedown, and pointerstart
|
||||
* events. "End" refers to touchend, mouseup, and pointerend events.
|
||||
*/
|
||||
@@ -57,6 +57,7 @@ Blockly.Gesture = function(e, creatorWorkspace) {
|
||||
* The position of the mouse when the gesture started. Units are CSS pixels,
|
||||
* with (0, 0) at the top left of the browser window (mouseEvent clientX/Y).
|
||||
* @type {Blockly.utils.Coordinate}
|
||||
* @private
|
||||
*/
|
||||
this.mouseDownXY_ = null;
|
||||
|
||||
|
||||
@@ -352,6 +352,7 @@ Blockly.InsertionMarkerManager.prototype.shouldUpdatePreviews_ = function(
|
||||
* in workspace units.
|
||||
* @return {!Object} An object containing a local connection, a closest
|
||||
* connection, and a radius.
|
||||
* @private
|
||||
*/
|
||||
Blockly.InsertionMarkerManager.prototype.getCandidate_ = function(dxy) {
|
||||
var radius = this.getStartRadius_();
|
||||
@@ -559,6 +560,7 @@ Blockly.InsertionMarkerManager.prototype.hidePreview_ = function() {
|
||||
|
||||
/**
|
||||
* Add highlighting showing which block will be replaced.
|
||||
* @private
|
||||
*/
|
||||
Blockly.InsertionMarkerManager.prototype.highlightBlock_ = function() {
|
||||
var closest = this.closestConnection_;
|
||||
@@ -576,6 +578,7 @@ Blockly.InsertionMarkerManager.prototype.highlightBlock_ = function() {
|
||||
|
||||
/**
|
||||
* Get rid of the highlighting marking the block that will be replaced.
|
||||
* @private
|
||||
*/
|
||||
Blockly.InsertionMarkerManager.prototype.unhighlightBlock_ = function() {
|
||||
var closest = this.closestConnection_;
|
||||
|
||||
@@ -352,6 +352,7 @@ Blockly.CursorSvg.prototype.showCurrent_ = function() {
|
||||
* @param {number} width The width of the block.
|
||||
* @param {number} cursorOffset The extra padding for around the block.
|
||||
* @param {number} cursorHeight The height of the cursor.
|
||||
* @private
|
||||
*/
|
||||
Blockly.CursorSvg.prototype.positionBlock_ = function(width, cursorOffset, cursorHeight) {
|
||||
var cursorPath = Blockly.utils.svgPaths.moveBy(-cursorOffset, cursorHeight) +
|
||||
|
||||
@@ -255,6 +255,7 @@ Blockly.Scrollbar.prototype.origin_ = new Blockly.utils.Coordinate(0, 0);
|
||||
* For a horizontal scrollbar this is the x coordinate of the mouse down event;
|
||||
* for a vertical scrollbar it's the y coordinate of the mouse down event.
|
||||
* @type {Blockly.utils.Coordinate}
|
||||
* @private
|
||||
*/
|
||||
Blockly.Scrollbar.prototype.startDragMouse_ = 0;
|
||||
|
||||
@@ -359,6 +360,7 @@ Blockly.Scrollbar.prototype.dispose = function() {
|
||||
* Set the length of the scrollbar's handle and change the SVG attribute
|
||||
* accordingly.
|
||||
* @param {number} newLength The new scrollbar handle length in CSS pixels.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Scrollbar.prototype.setHandleLength_ = function(newLength) {
|
||||
this.handleLength_ = newLength;
|
||||
|
||||
@@ -38,18 +38,21 @@ Blockly.Theme = function(blockStyles, categoryStyles, opt_componentStyles) {
|
||||
/**
|
||||
* The block styles map.
|
||||
* @type {!Object.<string, Blockly.Theme.BlockStyle>}
|
||||
* @private
|
||||
*/
|
||||
this.blockStyles_ = blockStyles;
|
||||
|
||||
/**
|
||||
* The category styles map.
|
||||
* @type {!Object.<string, Blockly.Theme.CategoryStyle>}
|
||||
* @private
|
||||
*/
|
||||
this.categoryStyles_ = categoryStyles;
|
||||
|
||||
/**
|
||||
* The UI components styles map.
|
||||
* @type {!Object.<string, *>}
|
||||
* @private
|
||||
*/
|
||||
this.componentStyles_ = opt_componentStyles || Object.create(null);
|
||||
};
|
||||
|
||||
@@ -531,6 +531,7 @@ Blockly.Toolbox.prototype.setColour_ = function(colourValue, childOut,
|
||||
* @param {string} styleName Name of the style.
|
||||
* @param {!Blockly.tree.TreeNode} childOut The child to set the hexColour on.
|
||||
* @param {string} categoryName Name of the toolbox category.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Toolbox.prototype.setColourFromStyle_ = function(
|
||||
styleName, childOut, categoryName) {
|
||||
|
||||
@@ -325,7 +325,7 @@ Blockly.WorkspaceCommentSvg.prototype.unbindDragEvents_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Handle a mouse-up event while dragging a comment's border or resize handle.
|
||||
* @param {!Event} e Mouse up event.
|
||||
* @private
|
||||
|
||||
@@ -143,6 +143,7 @@ Blockly.utils.object.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
|
||||
* A wrapper function called when a resize event occurs.
|
||||
* You can pass the result to `unbindEvent_`.
|
||||
* @type {Array.<!Array>}
|
||||
* @private
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null;
|
||||
|
||||
@@ -1175,6 +1176,7 @@ Blockly.WorkspaceSvg.prototype.paste = function(xmlBlock) {
|
||||
/**
|
||||
* Paste the provided block onto the workspace.
|
||||
* @param {!Element} xmlBlock XML block element.
|
||||
* @private
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.pasteBlock_ = function(xmlBlock) {
|
||||
Blockly.Events.disable();
|
||||
|
||||
@@ -71,7 +71,7 @@ BlockFactory.updateBlocksFlag = false;
|
||||
// TODO: Replace global state with parameter passed to functions.
|
||||
BlockFactory.updateBlocksFlagDelayed = false;
|
||||
|
||||
/*
|
||||
/**
|
||||
* The starting XML for the Block Factory main workspace. Contains the
|
||||
* unmovable, undeletable factory_base block.
|
||||
*/
|
||||
|
||||
@@ -988,7 +988,7 @@ FactoryUtils.cleanXml = function(xml) {
|
||||
return newXml;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Checks if a block has a variable field. Blocks with variable fields cannot
|
||||
* be shadow blocks.
|
||||
* @param {Blockly.Block} block The block to check if a variable field exists.
|
||||
|
||||
@@ -917,7 +917,7 @@ WorkspaceFactoryController.prototype.clearAll = function() {
|
||||
this.updatePreview();
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Makes the currently selected block a user-generated shadow block. These
|
||||
* blocks are not made into real shadow blocks, but recorded in the model
|
||||
* and visually marked as shadow blocks, allowing the user to move and edit
|
||||
@@ -1262,7 +1262,7 @@ WorkspaceFactoryController.prototype.importBlocks = function(file, format) {
|
||||
reader.readAsText(file);
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Updates the block library category in the toolbox workspace toolbox.
|
||||
* @param {!Element} categoryXml XML for the block library category.
|
||||
* @param {!Array.<string>} libBlockTypes Array of block types from the block
|
||||
@@ -1323,7 +1323,7 @@ WorkspaceFactoryController.prototype.warnForUndefinedBlocks_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Determines if a standard variable category is in the custom toolbox.
|
||||
* @return {boolean} True if a variables category is in use, false otherwise.
|
||||
*/
|
||||
|
||||
@@ -390,7 +390,7 @@ WorkspaceFactoryModel.prototype.setOptions = function(options) {
|
||||
this.options = options;
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns an array of all the block types currently being used in the toolbox
|
||||
* and the pre-loaded blocks. No duplicates.
|
||||
* TODO(evd2014): Move pushBlockTypesToList to FactoryUtils.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright 2017 The Closure Compiler Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* @author daarond@gmail.com (Daaron Dwyer)
|
||||
*/
|
||||
|
||||
/*
|
||||
/**
|
||||
* Lists in PHP are known to break when non-variables are passed into blocks
|
||||
* that require a list. PHP, unlike other languages, passes arrays as reference
|
||||
* value instead of value so we are unable to support it to the extent we can
|
||||
|
||||
@@ -91,7 +91,7 @@ function start() {
|
||||
changeIndex();
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Run this test to load all of the tests in the selected suites. The contents
|
||||
* will be loaded into the workspace in order. To test the generators:
|
||||
* - select your language from the buttons above the text area
|
||||
|
||||
Reference in New Issue
Block a user