Skip to content

Commit

Permalink
refactor: convert renderer classes to es6 classes (#5874)
Browse files Browse the repository at this point in the history
* refactor: convert zelos renderer classes to es6 classes

* refactor: convert zelos measurables to es6 classes

* refactor: convert thrasos classes to es6 classes

* refactor: convert minimalist classes to es6 classes

* refactor: update geras classes to es6 classes

* chore: rebuild and format

* chore: fix indentation in comments
  • Loading branch information
rachel-fenichel authored Jan 14, 2022
1 parent 29fb7b7 commit f5caf96
Show file tree
Hide file tree
Showing 27 changed files with 3,615 additions and 3,492 deletions.
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;
};

/**
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

0 comments on commit f5caf96

Please sign in to comment.