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,
|
CropModePersistence: CropModePersistence,
|
||||||
zoomAspectRatioLocked: true,
|
zoomAspectRatioLocked: true,
|
||||||
zoom: {
|
zoom: {
|
||||||
x: 1,
|
x: 0,
|
||||||
y: 1
|
y: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -209,17 +209,11 @@ export default {
|
|||||||
resetZoom() {
|
resetZoom() {
|
||||||
this.zoom = 1;
|
this.zoom = 1;
|
||||||
this.eventBus.send('set-zoom', {zoom: 1});
|
this.eventBus.send('set-zoom', {zoom: 1});
|
||||||
|
|
||||||
console.log('resetting zoom!');
|
|
||||||
|
|
||||||
},
|
},
|
||||||
changeZoom(newZoom, axis) {
|
changeZoom(newZoom, axis) {
|
||||||
newZoom = Math.pow(2, newZoom);
|
newZoom = Math.pow(2, newZoom);
|
||||||
console.log('new zoom:', newZoom);
|
|
||||||
|
|
||||||
this.eventBus.send('set-zoom', {zoom: newZoom, axis: axis, noAnnounce: true});
|
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) {
|
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]) {
|
for (const eventBusCommand of this.commands[command]) {
|
||||||
eventBusCommand.function(config);
|
eventBusCommand.function(config);
|
||||||
|
|
||||||
@ -31,6 +36,11 @@ export default class EventBus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendGlobal(command: string, config: any) {
|
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]) {
|
for (const eventBusCommand of this.commands[command]) {
|
||||||
this.sendUpstream(command, config);
|
this.sendUpstream(command, config);
|
||||||
this.sendDownstream(command, config);
|
this.sendDownstream(command, config);
|
||||||
|
Loading…
Reference in New Issue
Block a user