Use the new "reporttelemetry" event in more viewer components

By utilizing the recently added "reporttelemetry" event, we can avoid having to manually pass in `externalServices` to a number of viewer components.
This commit is contained in:
Jonas Jenwald 2023-09-20 14:08:28 +02:00
parent f2d75d9221
commit fe60db27b1
3 changed files with 16 additions and 18 deletions

View file

@ -56,7 +56,7 @@ class SecondaryToolbar {
* @param {SecondaryToolbarOptions} options
* @param {EventBus} eventBus
*/
constructor(options, eventBus, externalServices) {
constructor(options, eventBus) {
this.toolbar = options.toolbar;
this.toggleButton = options.toggleButton;
this.buttons = [
@ -155,7 +155,6 @@ class SecondaryToolbar {
};
this.eventBus = eventBus;
this.externalServices = externalServices;
this.opened = false;
// Bind the event listeners for click, cursor tool, and scroll/spread mode
@ -214,9 +213,12 @@ class SecondaryToolbar {
if (close) {
this.close();
}
this.externalServices.reportTelemetry({
type: "buttons",
data: { id: element.id },
this.eventBus.dispatch("reporttelemetry", {
source: this,
details: {
type: "buttons",
data: { id: element.id },
},
});
});
}