Prevent eventBus from crashing everything under certain conditions
This commit is contained in:
parent
bd5befc18c
commit
787bd1a532
@ -155,8 +155,8 @@ export default {
|
||||
CropModePersistence: CropModePersistence,
|
||||
zoomAspectRatioLocked: true,
|
||||
zoom: {
|
||||
x: 1,
|
||||
y: 1
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -209,17 +209,11 @@ export default {
|
||||
resetZoom() {
|
||||
this.zoom = 1;
|
||||
this.eventBus.send('set-zoom', {zoom: 1});
|
||||
|
||||
console.log('resetting zoom!');
|
||||
|
||||
},
|
||||
changeZoom(newZoom, axis) {
|
||||
newZoom = Math.pow(2, newZoom);
|
||||
console.log('new zoom:', newZoom);
|
||||
|
||||
this.eventBus.send('set-zoom', {zoom: newZoom, axis: axis, noAnnounce: true});
|
||||
|
||||
// this.zoom = newZoom;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ export default class EventBus {
|
||||
}
|
||||
|
||||
send(command: string, config: any, stopPropagation?: boolean) {
|
||||
if (!this.commands ||!this.commands[command]) {
|
||||
// ensure send is not being called for commands that we have no subscriptions for
|
||||
return;
|
||||
}
|
||||
|
||||
for (const eventBusCommand of this.commands[command]) {
|
||||
eventBusCommand.function(config);
|
||||
|
||||
@ -31,6 +36,11 @@ export default class EventBus {
|
||||
}
|
||||
|
||||
sendGlobal(command: string, config: any) {
|
||||
if (!this.commands ||!this.commands[command]) {
|
||||
// ensure send is not being called for commands that we have no subscriptions for
|
||||
return;
|
||||
}
|
||||
|
||||
for (const eventBusCommand of this.commands[command]) {
|
||||
this.sendUpstream(command, config);
|
||||
this.sendDownstream(command, config);
|
||||
|
Loading…
Reference in New Issue
Block a user