Migrate core/keyboard_nav/marker.js to goog.module

This commit is contained in:
kozbial
2021-07-19 11:28:11 -07:00
committed by Monica Kozbial
parent 3837440564
commit 014316431e
2 changed files with 13 additions and 10 deletions

View File

@@ -11,7 +11,8 @@
*/
'use strict';
goog.provide('Blockly.Marker');
goog.module('Blockly.Marker');
goog.module.declareLegacyNamespace();
goog.require('Blockly.ASTNode');
@@ -23,7 +24,7 @@ goog.requireType('Blockly.blockRendering.MarkerSvg');
* This is used in keyboard navigation to save a location in the Blockly AST.
* @constructor
*/
Blockly.Marker = function() {
const Marker = function() {
/**
* The colour of the marker.
* @type {?string}
@@ -56,7 +57,7 @@ Blockly.Marker = function() {
* @param {Blockly.blockRendering.MarkerSvg} drawer The object in charge of
* drawing the marker.
*/
Blockly.Marker.prototype.setDrawer = function(drawer) {
Marker.prototype.setDrawer = function(drawer) {
this.drawer_ = drawer;
};
@@ -65,7 +66,7 @@ Blockly.Marker.prototype.setDrawer = function(drawer) {
* @return {Blockly.blockRendering.MarkerSvg} The object in charge of drawing
* the marker.
*/
Blockly.Marker.prototype.getDrawer = function() {
Marker.prototype.getDrawer = function() {
return this.drawer_;
};
@@ -74,7 +75,7 @@ Blockly.Marker.prototype.getDrawer = function() {
* @return {Blockly.ASTNode} The current field, connection, or block the marker
* is on.
*/
Blockly.Marker.prototype.getCurNode = function() {
Marker.prototype.getCurNode = function() {
return this.curNode_;
};
@@ -84,7 +85,7 @@ Blockly.Marker.prototype.getCurNode = function() {
* output or previous connection on a stack.
* @param {Blockly.ASTNode} newNode The new location of the marker.
*/
Blockly.Marker.prototype.setCurNode = function(newNode) {
Marker.prototype.setCurNode = function(newNode) {
const oldNode = this.curNode_;
this.curNode_ = newNode;
if (this.drawer_) {
@@ -96,7 +97,7 @@ Blockly.Marker.prototype.setCurNode = function(newNode) {
* Redraw the current marker.
* @package
*/
Blockly.Marker.prototype.draw = function() {
Marker.prototype.draw = function() {
if (this.drawer_) {
this.drawer_.draw(this.curNode_, this.curNode_);
}
@@ -105,7 +106,7 @@ Blockly.Marker.prototype.draw = function() {
/**
* Hide the marker SVG.
*/
Blockly.Marker.prototype.hide = function() {
Marker.prototype.hide = function() {
if (this.drawer_) {
this.drawer_.hide();
}
@@ -114,8 +115,10 @@ Blockly.Marker.prototype.hide = function() {
/**
* Dispose of this marker.
*/
Blockly.Marker.prototype.dispose = function() {
Marker.prototype.dispose = function() {
if (this.getDrawer()) {
this.getDrawer().dispose();
}
};
exports = Marker;

View File

@@ -105,7 +105,7 @@ goog.addDependency('../../core/internal_constants.js', ['Blockly.internalConstan
goog.addDependency('../../core/keyboard_nav/ast_node.js', ['Blockly.ASTNode'], ['Blockly.connectionTypes', 'Blockly.utils.Coordinate'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/basic_cursor.js', ['Blockly.BasicCursor'], ['Blockly.ASTNode', 'Blockly.Cursor', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/cursor.js', ['Blockly.Cursor'], ['Blockly.ASTNode', 'Blockly.Marker', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/marker.js', ['Blockly.Marker'], ['Blockly.ASTNode']);
goog.addDependency('../../core/keyboard_nav/marker.js', ['Blockly.Marker'], ['Blockly.ASTNode'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/keyboard_nav/tab_navigate_cursor.js', ['Blockly.TabNavigateCursor'], ['Blockly.ASTNode', 'Blockly.BasicCursor', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/marker_manager.js', ['Blockly.MarkerManager'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/menu.js', ['Blockly.Menu'], ['Blockly.browserEvents', 'Blockly.utils.Coordinate', 'Blockly.utils.KeyCodes', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.style'], {'lang': 'es6', 'module': 'goog'});