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

refactor: convert renderer classes to es6 classes #5874

Merged
merged 7 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/renderers/common/marker_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ const MarkerSvg = function(workspace, constants, marker) {
* @type {string}
*/
this.colour_ = marker.colour || defaultColour;

/**
* The root SVG group containing the marker.
* @type {SVGGElement}
* @protected
*/
this.markerSvg_ = null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to satisfy compiler when I changed subclasses.

};

/**
Expand Down
74 changes: 37 additions & 37 deletions core/renderers/geras/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,57 @@
*/
goog.module('Blockly.geras.ConstantProvider');

const object = goog.require('Blockly.utils.object');
const {ConstantProvider: BaseConstantProvider} = goog.require('Blockly.blockRendering.ConstantProvider');


/**
* An object that provides constants for rendering blocks in Geras mode.
* @constructor
* @package
* @extends {BaseConstantProvider}
* @alias Blockly.geras.ConstantProvider
*/
const ConstantProvider = function() {
ConstantProvider.superClass_.constructor.call(this);

class ConstantProvider extends BaseConstantProvider {
/**
* @override
* @package
* @alias Blockly.geras.ConstantProvider
*/
this.FIELD_TEXT_BASELINE_CENTER = false;
constructor() {
super();

// The dark/shadow path in classic rendering is the same as the normal block
// path, but translated down one and right one.
this.DARK_PATH_OFFSET = 1;
/**
* @override
*/
this.FIELD_TEXT_BASELINE_CENTER = false;

/**
* The maximum width of a bottom row that follows a statement input and has
* inputs inline.
* @type {number}
*/
this.MAX_BOTTOM_WIDTH = 30;
// The dark/shadow path in classic rendering is the same as the normal block
// path, but translated down one and right one.
this.DARK_PATH_OFFSET = 1;

/**
* The maximum width of a bottom row that follows a statement input and has
* inputs inline.
* @type {number}
*/
this.MAX_BOTTOM_WIDTH = 30;

/**
* @override
*/
this.STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT / 2;
}

/**
* @override
*/
this.STATEMENT_BOTTOM_SPACER = -this.NOTCH_HEIGHT / 2;
};
object.inherits(ConstantProvider, BaseConstantProvider);


/**
* @override
*/
ConstantProvider.prototype.getCSS_ = function(selector) {
return ConstantProvider.superClass_.getCSS_.call(this, selector).concat([
/* eslint-disable indent */
// Insertion marker.
selector + ' .blocklyInsertionMarker>.blocklyPathLight,',
selector + ' .blocklyInsertionMarker>.blocklyPathDark {',
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;',
'}',
/* eslint-enable indent */
]);
};
getCSS_(selector) {
return super.getCSS_(selector).concat([
/* eslint-disable indent */
// Insertion marker.
selector + ' .blocklyInsertionMarker>.blocklyPathLight,',
selector + ' .blocklyInsertionMarker>.blocklyPathDark {',
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;',
'}',
/* eslint-enable indent */
]);
}
}

exports.ConstantProvider = ConstantProvider;
Loading