import { BaseInteractor } from './base-interactor';
/**
 *  The SVGInteractor class extends the BaseInteractor class and provides methods for handling mouse events on SVG elements.
 */
export class SVGInteractor extends BaseInteractor {
  /**
   * This is a constructor function that adds event listeners for click and mouseover events to an SVG element.
   *
   * @param {SVGElement} context - The context parameter is an SVGElement, which is the element that the
   * constructor is being called on. It is used to add event listeners to the element for mouseover and
   * click events.
   */
  constructor(context) {
    super(context);
    this.addContextListener();
  }
  /**
   * This function adds event listeners for click and mouseover events to the context element and calls
   * a registry function with the corresponding event type and event object.
   */
  addContextListener() {
    this.context.addEventListener('click', (event) => {
      this.callRegistry('click', event);
    });
    this.context.addEventListener('mouseover', (event) => {
      this.callRegistry('mouseover', event);
    });
  }
}
