Skip to content

Commit 25a4ef3

Browse files
committed
Fixed errors.
1 parent 589df0e commit 25a4ef3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/blocks/mrc_event_handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const EVENT_HANDLER = {
222222
let foundMechanism = false;
223223
const mechanismsInRobot = editor.getMechanismsFromRobot();
224224
for (const mechanismInRobot of mechanismsInRobot) {
225-
if (mechanismInRobot.blockId === this.mrcMechanismBlockId) {
225+
if (mechanismInRobot.mechanismId === this.mrcMechanismBlockId) {
226226
foundMechanism = true;
227227

228228
// If the mechanism name has changed, we can handle that.
@@ -235,7 +235,7 @@ const EVENT_HANDLER = {
235235
const mechanismEvents: storageModuleContent.Event[] = mechanism
236236
? editor.getEventsFromMechanism(mechanism) : [];
237237
for (const mechanismEvent of mechanismEvents) {
238-
if (mechanismEvent.blockId === this.mrcOtherBlockId) {
238+
if (mechanismEvent.eventId === this.mrcOtherBlockId) {
239239
foundMechanismEvent = true;
240240
if (this.getFieldValue(FIELD_EVENT_NAME) !== mechanismEvent.name) {
241241
this.setFieldValue(mechanismEvent.name, FIELD_EVENT_NAME);
@@ -279,7 +279,7 @@ const EVENT_HANDLER = {
279279
this.setWarningText(null, WARNING_ID_EVENT_CHANGED);
280280
}
281281
},
282-
getEventBlockId: function(this: EventHandlerBlock): string {
282+
getEventId: function(this: EventHandlerBlock): string {
283283
return this.mrcOtherBlockId;
284284
},
285285
renameMechanismName: function(this: EventHandlerBlock, mechanismBlockId: string, newName: string): void {
@@ -447,8 +447,8 @@ function createMechanismEventHandlerBlock(
447447
const extraState: EventHandlerExtraState = {
448448
senderType: SenderType.MECHANISM,
449449
params: [],
450-
otherBlockId: event.blockId,
451-
mechanismBlockId: mechanismInRobot.blockId,
450+
otherBlockId: event.eventId,
451+
mechanismBlockId: mechanismInRobot.mechanismId,
452452
};
453453
event.args.forEach(arg => {
454454
extraState.params.push({

src/editor/editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export class Editor {
322322
mechanismInRobot: storageModuleContent.MechanismInRobot): eventHandler.EventHandlerBlock[] {
323323
const eventHandlerBlocks: eventHandler.EventHandlerBlock[] = [];
324324
eventHandler.getMechanismEventHandlerBlocks(
325-
this.blocklyWorkspace, mechanismInRobot.blockId, eventHandlerBlocks);
325+
this.blocklyWorkspace, mechanismInRobot.mechanismId, eventHandlerBlocks);
326326
return eventHandlerBlocks;
327327
}
328328

src/toolbox/event_handlers_category.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ class EventHandlersCategory {
9898
const eventsFromRobot = editor.getEventsFromRobot();
9999
// Remove events if there is already a corresponding handler in the workspace.
100100
const eventHandlerBlocks = editor.getRobotEventHandlersAlreadyInWorkspace();
101-
const eventBlockIds: string[] = [];
101+
const eventIds: string[] = [];
102102
eventHandlerBlocks.forEach(eventHandlerBlock => {
103-
eventBlockIds.push(eventHandlerBlock.getEventBlockId());
103+
eventIds.push(eventHandlerBlock.getEventId());
104104
});
105105
const eventsToShow = eventsFromRobot.filter(event => {
106-
return !eventBlockIds.includes(event.blockId);
106+
return !eventIds.includes(event.eventId);
107107
});
108108
addRobotEventHandlerBlocks(eventsToShow, contents);
109109
}
@@ -127,12 +127,12 @@ class EventHandlersCategory {
127127
// Remove events if there is already a corresponding handler in the workspace.
128128
const eventHandlerBlocks = editor.getMechanismEventHandlersAlreadyInWorkspace(
129129
this.mechanismInRobot);
130-
const eventBlockIds: string[] = [];
130+
const eventIds: string[] = [];
131131
eventHandlerBlocks.forEach(eventHandlerBlock => {
132-
eventBlockIds.push(eventHandlerBlock.getEventBlockId());
132+
eventIds.push(eventHandlerBlock.getEventId());
133133
});
134134
const eventsToShow = eventsFromMechanism.filter(event => {
135-
return !eventBlockIds.includes(event.blockId);
135+
return !eventIds.includes(event.eventId);
136136
});
137137
addMechanismEventHandlerBlocks(this.mechanismInRobot, eventsToShow, contents);
138138
if (contents.length === 0) {

0 commit comments

Comments
 (0)