/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import Snap, { Options as SnapOptions } from 'ol/interaction/Snap';
import { InteractionMode } from '../interaction-mode';

export class SnapInteractionMode extends InteractionMode {
  private interactions: Snap[] = [];

  constructor(snapOptions: SnapOptions[]) {
    super();
    snapOptions.map((snapOption) => new Snap(snapOption)).map((interaction) => this.interactions.push(interaction));
  }

  activate() {
    this.interactions.forEach((i) => this.activateInteraction(i));
    super.activate();
  }
}
