From 81b16abb92d4a89e0c40ecce8aa4cb7126e324a8 Mon Sep 17 00:00:00 2001 From: kozbial Date: Wed, 14 Jul 2021 16:54:21 -0700 Subject: [PATCH] Migrate core/utils/metrics.js to goog.module --- core/utils/metrics.js | 49 +++++++++++++++++++++++-------------------- tests/deps.js | 2 +- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/core/utils/metrics.js b/core/utils/metrics.js index 226ef0734..55cadfae9 100644 --- a/core/utils/metrics.js +++ b/core/utils/metrics.js @@ -14,139 +14,142 @@ * @name Blockly.utils.Metrics * @namespace */ -goog.provide('Blockly.utils.Metrics'); +goog.module('Blockly.utils.Metrics'); +goog.module.declareLegacyNamespace(); /** * @record */ -Blockly.utils.Metrics = function() {}; +const Metrics = function() {}; /** * Height of the visible portion of the workspace. * @type {number} */ -Blockly.utils.Metrics.prototype.viewHeight; +Metrics.prototype.viewHeight; /** * Width of the visible portion of the workspace. * @type {number} */ -Blockly.utils.Metrics.prototype.viewWidth; +Metrics.prototype.viewWidth; /** * Height of the content. * @type {number} */ -Blockly.utils.Metrics.prototype.contentHeight; +Metrics.prototype.contentHeight; /** * Width of the content. * @type {number} */ -Blockly.utils.Metrics.prototype.contentWidth; +Metrics.prototype.contentWidth; /** * Height of the scroll area. * @type {number} */ -Blockly.utils.Metrics.prototype.scrollHeight; +Metrics.prototype.scrollHeight; /** * Width of the scroll area. * @type {number} */ -Blockly.utils.Metrics.prototype.scrollWidth; +Metrics.prototype.scrollWidth; /** * Top-edge of the visible portion of the workspace, relative to the workspace * origin. * @type {number} */ -Blockly.utils.Metrics.prototype.viewTop; +Metrics.prototype.viewTop; /** * Left-edge of the visible portion of the workspace, relative to the workspace * origin. * @type {number} */ -Blockly.utils.Metrics.prototype.viewLeft; +Metrics.prototype.viewLeft; /** * Top-edge of the content, relative to the workspace origin. * @type {number} */ -Blockly.utils.Metrics.prototype.contentTop; +Metrics.prototype.contentTop; /** * Left-edge of the content relative to the workspace origin. * @type {number} */ -Blockly.utils.Metrics.prototype.contentLeft; +Metrics.prototype.contentLeft; /** * Top-edge of the scroll area, relative to the workspace origin. * @type {number} */ -Blockly.utils.Metrics.prototype.scrollTop; +Metrics.prototype.scrollTop; /** * Left-edge of the scroll area relative to the workspace origin. * @type {number} */ -Blockly.utils.Metrics.prototype.scrollLeft; +Metrics.prototype.scrollLeft; /** * Top-edge of the visible portion of the workspace, relative to the blocklyDiv. * @type {number} */ -Blockly.utils.Metrics.prototype.absoluteTop; +Metrics.prototype.absoluteTop; /** * Left-edge of the visible portion of the workspace, relative to the * blocklyDiv. * @type {number} */ -Blockly.utils.Metrics.prototype.absoluteLeft; +Metrics.prototype.absoluteLeft; /** * Height of the Blockly div (the view + the toolbox, simple of otherwise). * @type {number} */ -Blockly.utils.Metrics.prototype.svgHeight; +Metrics.prototype.svgHeight; /** * Width of the Blockly div (the view + the toolbox, simple or otherwise). * @type {number} */ -Blockly.utils.Metrics.prototype.svgWidth; +Metrics.prototype.svgWidth; /** * Width of the toolbox, if it exists. Otherwise zero. * @type {number} */ -Blockly.utils.Metrics.prototype.toolboxWidth; +Metrics.prototype.toolboxWidth; /** * Height of the toolbox, if it exists. Otherwise zero. * @type {number} */ -Blockly.utils.Metrics.prototype.toolboxHeight; +Metrics.prototype.toolboxHeight; /** * Top, bottom, left or right. Use TOOLBOX_AT constants to compare. * @type {number} */ -Blockly.utils.Metrics.prototype.toolboxPosition; +Metrics.prototype.toolboxPosition; /** * Width of the flyout if it is always open. Otherwise zero. * @type {number} */ -Blockly.utils.Metrics.prototype.flyoutWidth; +Metrics.prototype.flyoutWidth; /** * Height of the flyout if it is always open. Otherwise zero. * @type {number} */ -Blockly.utils.Metrics.prototype.flyoutHeight; +Metrics.prototype.flyoutHeight; + +exports = Metrics; diff --git a/tests/deps.js b/tests/deps.js index 2edd38475..d1a516942 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -178,7 +178,7 @@ goog.addDependency('../../core/utils/global.js', ['Blockly.utils.global'], []); goog.addDependency('../../core/utils/idgenerator.js', ['Blockly.utils.IdGenerator'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/keycodes.js', ['Blockly.utils.KeyCodes'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/math.js', ['Blockly.utils.math'], [], {'lang': 'es6', 'module': 'goog'}); -goog.addDependency('../../core/utils/metrics.js', ['Blockly.utils.Metrics'], []); +goog.addDependency('../../core/utils/metrics.js', ['Blockly.utils.Metrics'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/object.js', ['Blockly.utils.object'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/rect.js', ['Blockly.utils.Rect'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/utils/size.js', ['Blockly.utils.Size'], []);