import MapEditTool from './map-edit-tool';

export default class MapPencilTool extends MapEditTool {


  constructor(mapEditLayer) {
    super(mapEditLayer, 'map-edit-pencil',
      'url("/static/cursor/cursor-pencil.png") 0 24, default');
  }

  override onDragStart(evt: MouseEvent) {
    if (!this.mapEditLayer) return;
    this.mapEditLayer.pencilStart(evt._contentPoint);
  }

  override onDragMove(evt: MouseEvent) {
    this.mapEditLayer.pencilMove(evt._contentPoint);
  }

  override onDragEnd(evt: MouseEvent) {
    if (!this.mapEditLayer) return;
    this.mapEditLayer.pencilEnd();
  }

  override ondblclick(evt: MouseEvent): void {
    this.mapEditLayer.pencilCreateArea(evt._contentPoint);
  }
}
