mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Migrate core/events/events_viewport.js to goog.module
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Events.ViewportChange');
|
||||
goog.module('Blockly.Events.ViewportChange');
|
||||
goog.module.declareLegacyNamespace();
|
||||
|
||||
goog.require('Blockly.Events');
|
||||
goog.require('Blockly.Events.UiBase');
|
||||
@@ -33,9 +34,9 @@ goog.require('Blockly.utils.object');
|
||||
* @extends {Blockly.Events.UiBase}
|
||||
* @constructor
|
||||
*/
|
||||
Blockly.Events.ViewportChange = function(opt_top, opt_left, opt_scale,
|
||||
const ViewportChange = function(opt_top, opt_left, opt_scale,
|
||||
opt_workspaceId, opt_oldScale) {
|
||||
Blockly.Events.ViewportChange.superClass_.constructor.call(this, opt_workspaceId);
|
||||
ViewportChange.superClass_.constructor.call(this, opt_workspaceId);
|
||||
|
||||
/**
|
||||
* Top-edge of the visible portion of the workspace, relative to the workspace
|
||||
@@ -63,21 +64,21 @@ Blockly.Events.ViewportChange = function(opt_top, opt_left, opt_scale,
|
||||
*/
|
||||
this.oldScale = opt_oldScale;
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.Events.ViewportChange,
|
||||
Blockly.utils.object.inherits(ViewportChange,
|
||||
Blockly.Events.UiBase);
|
||||
|
||||
/**
|
||||
* Type of this event.
|
||||
* @type {string}
|
||||
*/
|
||||
Blockly.Events.ViewportChange.prototype.type = Blockly.Events.VIEWPORT_CHANGE;
|
||||
ViewportChange.prototype.type = Blockly.Events.VIEWPORT_CHANGE;
|
||||
|
||||
/**
|
||||
* Encode the event as JSON.
|
||||
* @return {!Object} JSON representation.
|
||||
*/
|
||||
Blockly.Events.ViewportChange.prototype.toJson = function() {
|
||||
const json = Blockly.Events.ViewportChange.superClass_.toJson.call(this);
|
||||
ViewportChange.prototype.toJson = function() {
|
||||
const json = ViewportChange.superClass_.toJson.call(this);
|
||||
json['viewTop'] = this.viewTop;
|
||||
json['viewLeft'] = this.viewLeft;
|
||||
json['scale'] = this.scale;
|
||||
@@ -89,8 +90,8 @@ Blockly.Events.ViewportChange.prototype.toJson = function() {
|
||||
* Decode the JSON event.
|
||||
* @param {!Object} json JSON representation.
|
||||
*/
|
||||
Blockly.Events.ViewportChange.prototype.fromJson = function(json) {
|
||||
Blockly.Events.ViewportChange.superClass_.fromJson.call(this, json);
|
||||
ViewportChange.prototype.fromJson = function(json) {
|
||||
ViewportChange.superClass_.fromJson.call(this, json);
|
||||
this.viewTop = json['viewTop'];
|
||||
this.viewLeft = json['viewLeft'];
|
||||
this.scale = json['scale'];
|
||||
@@ -98,4 +99,6 @@ Blockly.Events.ViewportChange.prototype.fromJson = function(json) {
|
||||
};
|
||||
|
||||
Blockly.registry.register(Blockly.registry.Type.EVENT,
|
||||
Blockly.Events.VIEWPORT_CHANGE, Blockly.Events.ViewportChange);
|
||||
Blockly.Events.VIEWPORT_CHANGE, ViewportChange);
|
||||
|
||||
exports = ViewportChange;
|
||||
|
||||
@@ -44,7 +44,7 @@ goog.addDependency('../../core/events/events_selected.js', ['Blockly.Events.Sele
|
||||
goog.addDependency('../../core/events/events_theme_change.js', ['Blockly.Events.ThemeChange'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
|
||||
goog.addDependency('../../core/events/events_toolbox_item_select.js', ['Blockly.Events.ToolboxItemSelect'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
|
||||
goog.addDependency('../../core/events/events_trashcan_open.js', ['Blockly.Events.TrashcanOpen'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
|
||||
goog.addDependency('../../core/events/events_viewport.js', ['Blockly.Events.ViewportChange'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object']);
|
||||
goog.addDependency('../../core/events/events_viewport.js', ['Blockly.Events.ViewportChange'], ['Blockly.Events', 'Blockly.Events.UiBase', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../core/events/ui_events.js', ['Blockly.Events.Ui', 'Blockly.Events.UiBase'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.registry', 'Blockly.utils.object']);
|
||||
goog.addDependency('../../core/events/variable_events.js', ['Blockly.Events.VarBase', 'Blockly.Events.VarCreate', 'Blockly.Events.VarDelete', 'Blockly.Events.VarRename'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.registry', 'Blockly.utils.object']);
|
||||
goog.addDependency('../../core/events/workspace_events.js', ['Blockly.Events.FinishedLoading'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.registry', 'Blockly.utils.object'], {'lang': 'es5'});
|
||||
|
||||
Reference in New Issue
Block a user