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

Migrate core/utils/svg_paths.js to goog.module syntax #5062

Merged
merged 2 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
36 changes: 24 additions & 12 deletions core/utils/svg_paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* @name Blockly.utils.svgPaths
* @namespace
*/
goog.provide('Blockly.utils.svgPaths');
goog.module('Blockly.utils.svgPaths');
goog.module.declareLegacyNamespace();


/**
Expand All @@ -28,7 +29,7 @@ goog.provide('Blockly.utils.svgPaths');
* @return {string} A string of the format ' x,y '
* @public
*/
Blockly.utils.svgPaths.point = function(x, y) {
const point = function(x, y) {
return ' ' + x + ',' + y + ' ';
};

Expand All @@ -38,14 +39,14 @@ Blockly.utils.svgPaths.point = function(x, y) {
* These coordinates are unitless and hence in the user coordinate system.
* @param {string} command The command to use.
* Should be one of: c, C, s, S, q, Q.
* @param {!Array<string>} points An array containing all of the points to pass to the
* curve command, in order. The points are represented as strings of the
* format ' x, y '.
* @param {!Array<string>} points An array containing all of the points to pass
* to the curve command, in order. The points are represented as strings of
* the format ' x, y '.
* @return {string} A string defining one or more Bezier curves. See the MDN
* documentation for exact format.
* @public
*/
Blockly.utils.svgPaths.curve = function(command, points) {
const curve = function(command, points) {
return ' ' + command + points.join('');
};

Expand All @@ -59,7 +60,7 @@ Blockly.utils.svgPaths.curve = function(command, points) {
* @return {string} A string of the format ' M x,y '
* @public
*/
Blockly.utils.svgPaths.moveTo = function(x, y) {
const moveTo = function(x, y) {
return ' M ' + x + ',' + y + ' ';
};

Expand All @@ -73,7 +74,7 @@ Blockly.utils.svgPaths.moveTo = function(x, y) {
* @return {string} A string of the format ' m dx,dy '
* @public
*/
Blockly.utils.svgPaths.moveBy = function(dx, dy) {
const moveBy = function(dx, dy) {
return ' m ' + dx + ',' + dy + ' ';
};

Expand All @@ -87,7 +88,7 @@ Blockly.utils.svgPaths.moveBy = function(dx, dy) {
* @return {string} A string of the format ' l dx,dy '
* @public
*/
Blockly.utils.svgPaths.lineTo = function(dx, dy) {
const lineTo = function(dx, dy) {
return ' l ' + dx + ',' + dy + ' ';
};

Expand All @@ -102,7 +103,7 @@ Blockly.utils.svgPaths.lineTo = function(dx, dy) {
* @return {string} A string of the format ' l (dx,dy)+ '
* @public
*/
Blockly.utils.svgPaths.line = function(points) {
const line = function(points) {
return ' l' + points.join('');
};

Expand All @@ -119,7 +120,7 @@ Blockly.utils.svgPaths.line = function(points) {
* @return {string} A string of the format ' command val '
* @public
*/
Blockly.utils.svgPaths.lineOnAxis = function(command, val) {
const lineOnAxis = function(command, val) {
return ' ' + command + ' ' + val + ' ';
};

Expand All @@ -137,6 +138,17 @@ Blockly.utils.svgPaths.lineOnAxis = function(command, val) {
* @return {string} A string of the format 'command radius radius flags point'
* @public
*/
Blockly.utils.svgPaths.arc = function(command, flags, radius, point) {
const arc = function(command, flags, radius, point) {
return command + ' ' + radius + ' ' + radius + ' ' + flags + point;
};

exports = {
point,
curve,
moveTo,
moveBy,
lineTo,
line,
lineOnAxis,
arc,
};
2 changes: 1 addition & 1 deletion tests/deps.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.