Refactoring Ui events in core (#4418)

* Ui events base (#4370)

* Add constants for new ui event types

* Add property to indicate an event as UI event

* Click events (#4372)

* Creating new ui base class.

* Refactor theme event (#4391)

* Add themeName property to theme event

* Refactor marker move events. (#4389)

* Refactor trashcan open event (#4392)

* Refactor selected event (#4387)

* Refactor toolbox item change event (#4394)

* Refactor bubble open events (#4390)

* Refactor block drag event (#4388)

* Viewport events (#4395)

* Fix event filtering for ui events (#4401)

* Move events to new directory and rename Ui events base (#4400)

* Move events to new directory and rename Ui events base

* Add missing fromJson implementation for click event (#4410)

* Adding serialization tests for events

* Zoom controls event (#4407)

* Refactor zoom event

* Rename IS_UI_EVENT to isUiEvent
This commit is contained in:
Monica Kozbial
2020-11-04 14:43:54 -08:00
committed by GitHub
parent d782e2f4af
commit 40ef586260
42 changed files with 1288 additions and 293 deletions

View File

@@ -345,7 +345,7 @@ WorkspaceFactoryInit.addWorkspaceFactoryEventListeners_ = function(controller) {
// Only enable "Edit Block" when a block is selected and it has a
// surrounding parent, meaning it is nested in another block (blocks that
// are not nested in parents cannot be shadow blocks).
if (e.type == Blockly.Events.BLOCK_MOVE || (e.type == Blockly.Events.UI &&
if (e.type == Blockly.Events.BLOCK_MOVE || (e.isUiEvent &&
e.element == 'selected')) {
var selected = Blockly.selected;

View File

@@ -133,10 +133,11 @@ Minimap.mousemove = function(e) {
/**
* Run non-UI events from the main workspace on the minimap.
* @param {!Event} event Event that triggered in the main workspace.
* @param {!Blockly.Events.Abstract} event Event that triggered in the main
* workspace.
*/
Minimap.mirrorEvent = function(event) {
if (event.type == Blockly.Events.UI) {
if (event.isUiEvent) {
return; // Don't mirror UI events.
}
// Convert event to JSON. This could then be transmitted across the net.